【发布时间】:2017-09-10 02:07:02
【问题描述】:
我是量角器的新手,现在我的工作需要为 angularjs 应用程序创建测试项目。 我从指南开始,但在开始时遇到错误:
Error: Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.4.0/$rootScope/infdig?p0=10&p1=%5B%5D
http://localhost/main-f3fbd0c72e8415cd0a449214b66bdacc-cached.js:2140
at window.onerror (http://localhost/main-f3fbd0c72e8415cd0a449214b66bdacc-cached.js:1277:52)
配置文件
exports.config = {
directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: ['specs/spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
测试文件:
"use strict";
describe('WEB test project', function() {
var wl5StartPage = require('../pages/startPage.js');
it('Its start login page', function() {
wl5StartPage.get();
wl5StartPage.wl5Login();
});
});
startPage.js:
var WL5LoginPage = function() {
this.userName = element(by.model('loginInfo.userId'));
this.loginButton = element(by.css('[ng-click="login()"]'));
this.get = function() {
browser.get('http://localhost/login');
};
this.wl5Login = function() {
this.userName.sendKeys("user1");
this.loginButton.click();
};
}
module.exports = new WL5LoginPage();
它的测试非常简单,但不幸的是,当我输入用户名并单击“登录”时它崩溃了。 有什么方法可以忽略此类浏览器错误吗?或者有什么办法解决问题?
提前谢谢你。
【问题讨论】:
-
在规范中发布您的登录代码,以便我们知道发生了什么...
-
是的,登录代码已添加到帖子中。
标签: angularjs webdriver protractor