mercredi 4 mars 2015

Protractor "before each" hook error with added non protractor page for login in OnPrepare()

I added the login authorization in OpPrepare() via ms azure:



//Login before `enter code here`run the tests
`enter code here`browser.driver.get(browser.baseUrl);

element(by.css('#ms-login')).click();

userID.sendKeys(browser.params.login.user);
userPass.sendKeys(browser.params.login.password);
signInButton.click();
browser.sleep(1000);
signInButton.click();

// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to
// index.html.
browser.driver.wait(function () {
return browser.driver.getCurrentUrl().then(function(url) {
return /dashboard/.test(url);
});
});


And after it I see the time to time the same error (maybe in 40% of test runs) after authorization on 'dashboard' page.


Error code:



dashboard landing page
1) "before each" hook


0 passing (50s)
1 failing

1) dashboard landing page "before each" hook:
Error: timeout of 50000ms exceeded


For example spec page:



describe('dashboard landing page', function () {
var dashboardPage = require('./dashboard.page.js');

beforeEach(function () {
browser.get('#/dashboard');
});

it('should have some', function () {
expect(dashboardPage.some.count()).to.eventually.equal(5);
});
});


What i'm doing wrong. please help?


Aucun commentaire:

Enregistrer un commentaire