Anu*_*apu 2 javascript testing multi-select angularjs protractor
我正在使用https://github.com/isteven/angular-multi-select 中的angular-multi-select 下拉列表。现在我想在量角器中编写测试用例。
<div ng-show="!attribute.isMultivalued && page != 'view'"
class="select-group"
multi-select
input-model="typesDataDup"
output-model="attribute.types"
button-label="typeName"
item-label="typeName"
tick-property="ticked"
selection-mode="single"
helper-elements="filter"
is-disabled = "page == 'view'">
</div>
Run Code Online (Sandbox Code Playgroud)
我无法使用模型发送数据,因为这里我们没有提到 ng-model。
有人可以帮我写测试用例吗?
您可以依赖其他属性并使用它by.css来查找元素。例如:
element(by.css('div.select-group'))
Run Code Online (Sandbox Code Playgroud)
或者
element(by.css('div[multi-select]'))
Run Code Online (Sandbox Code Playgroud)
就我从angular-multi-select源代码中看到的而言,选择选项是用按钮元素表示的。使用element.all()发现里面所有的按钮,然后单击所需的一个,例如Select All:
element.all(by.css('div[multi-select] button')).then(function(options) {
options.forEach(function(option) {
option.getText().then(function(text) {
if (text.indexOf("Select All") != -1) {
option.click();
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4289 次 |
| 最近记录: |