1
我正在運行量角器測試並使用下拉式填充表單。我怎樣才能確保每個下拉菜單都有一個承諾,在下一個下拉菜單之前解決?現在我正在睡覺,並知道這不可能是正確的方式。量角器從承諾下拉列表中選擇數值
Describe('Filling site utility form', function() {
beforeEach(function(){
var input_monthly = by.linkText('Input Monthly');
browser.wait(function() {
return browser.isElementPresent(input_monthly);
});
var field1 = element(by.id('field1'));
Test.dropdown(field1, 1);
var field2 = element(by.id('field2'));
Test.dropdown(field2, 1);
});
我的下拉作用是:
dropdown = function(element, index, milliseconds) {
element.findElements(by.tagName('option'))
.then(function(options) {
options[index].click();
});
if (typeof milliseconds !== 'undefined') {
browser.sleep(milliseconds);
}
}