Javascript 使用onPrepare登录站点后量角器超时
我有一个测试,应该只是检查网站的标题后,登录到该网站。要执行登录,我在配置文件中使用onPrepare语句。 当站点已经登录时,我的规范中的测试应该运行,但我会继续运行Javascript 使用onPrepare登录站点后量角器超时,javascript,angularjs,timeout,protractor,Javascript,Angularjs,Timeout,Protractor,我有一个测试,应该只是检查网站的标题后,登录到该网站。要执行登录,我在配置文件中使用onPrepare语句。 当站点已经登录时,我的规范中的测试应该运行,但我会继续运行 Failed: Timed out waiting for Protractor to synchronize with the page after 11 seconds. 如果我在测试规范中添加beforeach语句,则测试用户未登录,因此我无法测试需要运行的所有“登录”特定测试 这是我的配置文件: 'use strict
Failed: Timed out waiting for Protractor to synchronize with the page after 11 seconds.
如果我在测试规范中添加beforeach语句,则测试用户未登录,因此我无法测试需要运行的所有“登录”特定测试
这是我的配置文件:
'use strict';
var env = require('./enviroment');
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
directConnect: true,
specs: [
'photostream/*.spec.js'
],
capabilities: {
name: 'Chrome',
browserName: 'chrome'
},
baseUrl: env.baseUrl,
jasmineNodeOpts: {
showColors: true,
includeStackTrace: true
},
onPrepare: function(){
browser.driver.get(env.baseUrl);
// find the sign in button
browser.driver.findElement(by.id('homepage_sign_in_btn')).click();
browser.sleep(1000);
// fire click event of the sign in button
// check that the Sign In to Lifecake panel is opened
// enter a email address
browser.driver.findElement(by.id('sign-in-menu-email')).sendKeys(env.testUserAcc.email);
// enter the password
browser.driver.findElement(by.id('sign-in-menu-password')).sendKeys(env.testUserAcc.password);
browser.sleep(5000);
// click the sign in button
browser.driver.findElement(by.id('home_menu_sign_in_btn')).click();
return browser.driver.wait(function(){
return browser.driver.getCurrentUrl().then(function(url){
return url + '/index.html#/photos';
})
}, 5000)
}
}
这是我的测试规范文件:
'use strict';
var PhotostreamHelper = require('./photostream.page.js');
describe('Tests for the Photostream - ',function(){
it('The title of the site should be Lifecake', function () {
expect(browser.getTitle()).toEqual('Lifecake');
browser.sleep(2000);
});
});
我也有同样的问题。你解决那个问题了吗?