关于使用API元素(选择器、标签)进行angularJS e2e测试的说明。查询(fn)
我的angularJS应用程序中有以下e2e测试代码。 请阅读代码和注释以了解我的问题。我还附上了一张显示测试输出的图片关于使用API元素(选择器、标签)进行angularJS e2e测试的说明。查询(fn),angularjs,angularjs-e2e,Angularjs,Angularjs E2e,我的angularJS应用程序中有以下e2e测试代码。 请阅读代码和注释以了解我的问题。我还附上了一张显示测试输出的图片 it('应显示表格标题值',函数(){ var_mockTopicTitles=[ {name:'课程ID'}, {name:'标题/合流'}, {name:'所有者'}, {name:'创建日期'}, {name:'审核日期'}, {name:'NCRU'}, {name:'持续时间(小时)}, {name:'调查'}, {name:'NPS Stats'} ]; var
it('应显示表格标题值',函数(){
var_mockTopicTitles=[
{name:'课程ID'},
{name:'标题/合流'},
{name:'所有者'},
{name:'创建日期'},
{name:'审核日期'},
{name:'NCRU'},
{name:'持续时间(小时)},
{name:'调查'},
{name:'NPS Stats'}
];
var promise=element(“.tab窗格:first.panel内容表thead tr th”,“遍历表thead行”).query(函数(elements,done){
对于(var i=0;i
我不能直接附加图像,因为它需要10个声誉。这就是我上传的原因
它在云端。请看这张图片
显然,图像部分的左侧是runner.html,右侧是chrome控制台
下面是我的问题。
请提前帮助和感谢。1)我不知道,可能是框架有缺陷。希望一些AngularJS专家能回答这个问题。2) 它正在按设计工作。感谢@AdrianEdiomaMigraso在第2条中给出的答案。:)希望有人也能回答问题1。
it('should display the table header values', function() {
var _mockTopicTitles = [
{name: 'Course ID'},
{name: 'Title/Confluence'},
{name: 'Owner'},
{name: 'Date Created'},
{name: 'Reviewed Date'},
{name: 'NCRU'},
{name: 'Duration (Hrs)'},
{name: 'Survey'},
{name: 'NPS Stats'}
];
var promise = element(".tab-pane:first .panel-content table thead tr th", "traversing the table thead rows").query(function(elements, done) {
for (var i = 0; i < elements.length; i++) {
//a. This will log in the chrome console. See the attached image.
console.log("Elements[]", elements[i].innerText);
//b. However, elements[i].innerText is evaluated as undefined when running the test. See the image.
expect(elements[i].innerText).toEqual(_mockTopicTitles[i]["name"]);
}
done();
});
for (var i = 0; i < promise.length; i++) {
//c. Why the code below isn't logged in the chrome console?
console.log("Promise[]", promise[i].innerText);
}
});