美好的一天!
由于#2969,我将关闭量角器茉莉花conf中的SELENIUM_PROMISE_MANAGER
在我的PageObject方法中,我有一个设置器,它使传给此设置器的对象文字的textBox元素中的“ sendKeys”传递给该设置器,例如:
set informationSection(object) {
for (let element in object) {
this[element].sendKeys(object[element]);
}
}
和在testCase中:
it('description of spec', async() => {
const information = {
field1: 'Field 1 description,
field2: 'Field 2 description,
};
await mainPage.openInformationDialod();
//Here need to call setter
mainPage.informationSection = information;
await mainPage.apply();
})
在此示例中,我希望首先从setter中“发送sendKeys”,然后“应用”方法。 但是setter会同步工作,有时会在“ mainPage.apply()”之后完成。
在使用量角器控制流程的情况下,没有这样的问题。 有人知道有什么解决方法可以将setter推送到异步堆栈中吗?
谢谢。
答案 0 :(得分:0)
您还应该await
sendKeys()
:
set async informationSection(object) {
for (let element in object) {
await this[element].sendKeys(object[element]);
}
}