【发布时间】:2018-12-16 18:28:55
【问题描述】:
美好的一天!
由于#2969,我正在关闭 Protractor jasmine conf 中的 SELENIUM_PROMISE_MANAGER
在我的 PageObject 方法中,我有一个 setter,它使 textBox 元素中的“sendKeys”从对象字面量传递给这个 setter,例如:
set informationSection(object) {
for (let element in object) {
this[element].sendKeys(object[element]);
}
}
在测试用例中:
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”,然后是“apply”方法。 但是 setter 是同步工作的,有时会在“mainPage.apply()”之后完成。
在使用量角器控制流程的情况下没有这样的问题。 有人知道允许将 setter 推入异步堆栈的解决方法吗?
提前谢谢你。
【问题讨论】:
标签: typescript jasmine async-await protractor getter-setter