Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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
发现使用量角器测试AngularJS UI网格很困难_Angularjs_User Interface_Grid_Protractor - Fatal编程技术网

发现使用量角器测试AngularJS UI网格很困难

发现使用量角器测试AngularJS UI网格很困难,angularjs,user-interface,grid,protractor,Angularjs,User Interface,Grid,Protractor,我对量角器非常陌生,测试AngularJS是我第一次。我必须测试一个用角度网格填充的表格。这些值没有任何唯一的id来标识它们。在做了一些研究之后,我发现我们需要使用gridTestUtils.spec.js。我在我的规范文件中尝试了以下方法: var gridTestUtils = require('./gridTestUtils.spec.js'); describe('get row count of grid', function(){ it('get the row count

我对量角器非常陌生,测试AngularJS是我第一次。我必须测试一个用角度网格填充的表格。这些值没有任何唯一的id来标识它们。在做了一些研究之后,我发现我们需要使用gridTestUtils.spec.js。我在我的规范文件中尝试了以下方法:

var gridTestUtils = require('./gridTestUtils.spec.js');

describe('get row count of grid', function(){
    it('get the row count of grid1', function(){
          gridTestUtils.expectRowCount('grid1',8);
    });
});
这是唯一的等级库文件,没有pageobject文件。但这段代码似乎没有运行。它说pageObject没有定义。你能告诉我如何从这里开始吗?我不是专家。请以简单和详细的方式回答,因为我很容易理解

谢谢你的帮助

谢谢,
Mallesh

gridTestUtils
肯定觉得这可能有点过头了。您是否考虑过直接使用较低级别的量角器调用来测试页面?这不是很多代码

describe('get row count of grid', function () {
    before(function () {
        browser.get('http://localhost:9000/orwhatever');
    });

    it('get the row count of grid1', function(){
        expect(element.all(by.repeater('row in rows')).count()).to.eventually.equal(8);
    });
});

用应用程序的url替换url,并用DOM中的
ng repeat
中的相同字符串替换repeater字符串。如果您不使用中继器,只需使用
$$()
函数通过css选择器获取所有元素。

您可以发布完整的错误回溯吗?谢谢。我得到的错误是-Syntax error Unexpected token<它指向第1行。i、 e var GridTestUtils=require('./GridTestUtils.spec.js');嗯。你能把
gridTestUtils.spec.js
的内容发布出来吗?你得到解决方案了吗?我也有类似的情况。@rahoolm-是的,我能够使用gridTestUtils并运行我的测试。你现在面临的确切问题是什么?