量角器和Javascript的新手对我来说很容易。任何人都可以告诉我一个额外的行的语法来调用函数中的以下页面对象(在我的测试规范中),然后再使用我的expect子句吗?量角器/ Javascript - 将函数传递到预期子句的值的参考语法
方法/函数在页面对象:
this.getHeaderText = function(){
element.all(by.css('.ag-header-cell-text'))
.map(function(header){
return header.getText()
}).then(function(headers){
if (headers.toEqual(['Publisher Name', 'IpAddress', 'AddedDate', 'Delete Ip']));
return 1;
});
};
测试规范的呼叫预计:
it('All headers are present', function(){
// Need syntax here for reference to pass PO function into a value to call below
expect(publisher_whitelist_page.getHeaderText.getText().toEqual(1));
});
});
结果我收到以下错误 - 失败:publisher_whitelist_page.getHeaderText.getText是不是一个功能
再次,任何帮助或建议,非常感激和欢迎!
谢谢!
Kirsty
修改如上,仍然出现错误:×所有头文件存在 - 失败:无法读取未定义的属性'toEqual' –
我的不好!我忘了在'getHeaderText()'方法中添加return语句。我已经更新了我的答案,再试一次! –
明白了,并表示感谢! :d –