我有一个功能,我需要更新多个下拉列表。
由于我想删除手动干预,我希望测试自动决定使用哪些数据。
我的主要测试中有两组数组/变量。
arrDefinition1 = ['Section;Sec1', 'Domain;test1', 'Process layer;test1', 'Skill;test1'];
arrDefinition2 = ['Section;Sec2', 'Domain;test2', 'Process layer;test2', 'Skill;test2'];
如果下拉列表的当前值为" Sec1 "然后将使用 arrDefinition2 ,反之亦然。
但由于承诺,我的 IF 条件首先在 IT 之前执行,而包含getText值的变量包含&#34; undefined < / strong>&#34;,这意味着将始终使用 arrDefinition2 。
it('should click the Edit icon of the first row of Activity table', function() {
waitForElement(5, elmFirstRow, true);
editFirstRow.click();
waitForElement(5, element(by.id('section')), true);
element(by.id('section')).getText().then(function (tmpText) {
tempObject.strSection = tmpText;
});
});
if (tempObject.strSection == 'Sec1') {
console.log('first');
fillUpForm(0, tempObject.arrDefinition2, 'UpdateMDef');
} else {
console.log('second');
fillUpForm(0, tempObject.arrDefinition1, 'UpdateMDef');
}
注意:函数fillUpForm由 IT 函数组成。
非常感谢任何建议。