我正在进行量角器测试。 有一个不是Angular的登录部分,然后是Angular部分的主页。 通过登录部分后 - 在Chrome上我获得了超时,但在FF上它继续成功。 之前它曾经在Chrome上运行过,使用Robot Framework的朋友即使使用chrome也不会超时。
错误消息:
timeout: timed out after 30000 msec waiting for spec to complete
我也尝试添加
defaultTimeoutInterval: 360000
但它没有帮助。它只是在等待。
config.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
// 'browserName': 'firefox'
},
specs: ['*/loginEAPTest.js'],
params: {
login: {
user: '****',
password: '****'
}
},
resultJsonOutputFile: 'TestResults/Test.js',
jasmineNodeOpts: {
isVerbose: true,
showColors: true,
//defaultTimeoutInterval: 360000,
includeStackTrace: true
},
onPrepare: function() {
// for non-angular page
browser.ignoreSynchronization = true;
}
};
loginEAPTest.js:
var LoginPage = require('../global/LoginPage');
var capture = require('../global/screenshots');
describe('login Testing', function () {
var login = new LoginPage();
beforeEach(function(){
login.get();
login.justClickLogin();
}
);
it('Should login using Email & Password', function () {
browser.sleep(10000);
browser.driver.findElement(by.id('userName_str')).sendKeys ("****");
browser.driver.findElement(by.id('password')).sendKeys("******");
browser.driver.findElement(by.xpath("//input[contains(@value,'Log In')]")).click();
browser.ignoreSynchronization = false;
browser.sleep(5000);
browser.switchTo().defaultContent();
expect(element(by.css('[data-ui-sref=myApps]')).isDisplayed()).toBe(true);
});
});
LoginPage.js(相关部分):
this.justClickLogin = function() {
var loginObj = this;
loginObj.signInButton.click().then(function () {
console.log("press login");
var loginframe = element(by.tagName('iframe'));
console.log("before switch");
browser.switchTo().frame(0);
console.log("after switch");
browser.sleep(4000);
});
};
感谢。