Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于使用API元素(选择器、标签)进行angularJS e2e测试的说明。查询(fn)_Angularjs_Angularjs E2e - Fatal编程技术网

关于使用API元素(选择器、标签)进行angularJS e2e测试的说明。查询(fn)

关于使用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

我的angularJS应用程序中有以下e2e测试代码。

请阅读代码和注释以了解我的问题。我还附上了一张显示测试输出的图片

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控制台

下面是我的问题。

  • 为什么在控制台中记录元素[i].innerText时,即使它有值,它也会被计算为未定义?请参阅附件中的图像

  • 另外,最后一个for循环在控制台中不显示任何内容。有人能给我解释一下吗


  • 请提前帮助和感谢。

    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);
        }
    
    });