Reputation: 81
Well, I'm using chrome. When I run protractor the page begins to load and never finish to load until I refresh the page manually and then everything flow normally. My page use Angular2, is built with MEAN stack.
Here my config file:
// @datatype_void
require('ts-node/register');
exports.config = {
baseUrl: 'https://localhost:3000',
// use `npm run e2e`
specs: [
'../test/*.e2e.*.js'
],
suites: {
dashboard: '../test/Dashboard.e2e.testcase.js'
},
exclude: [],
framework: 'jasmine2',
allScriptsTimeout: 40000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 40000
},
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['show-fps-counter=true']
}
},
onPrepare: function() {
browser.ignoreSynchronization = true;
},
/**
* Angular 2 configuration
*
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
* `rootEl`
*
*/
useAllAngular2AppRoots: true
};
And here is the first to run in my test:
describe('This is Dashboard.', () => {
email = '[email protected]';
pass = 'laslos157';
browser.get('/');
browser.wait(protractor.ExpectedConditions.visibilityOf($('.abcRioButton.abcRioButtonBlue')), 10000);
element(by.css('.abcRioButton.abcRioButtonBlue')).click();
browser.getAllWindowHandles().then(function (handles) {
browser.switchTo().window(handles[1]).then(function () {
enterkeys(element(by.css('#Email')), email);
element(by.css('#next')).click();
browser.wait(protractor.ExpectedConditions.visibilityOf($('#Passwd')), 5000);
enterkeys(element(by.css('#Passwd')), pass);
element(by.css('#signIn')).click();
});
});
browser.getAllWindowHandles().then(function (handles) {
browser.switchTo().window(handles[0]);
});
browser.wait(protractor.ExpectedConditions.visibilityOf($$('.al-sidebar-list-link').get(0)), 10000);
Upvotes: 4
Views: 6898
Reputation: 21
According to me, you don't have to use browser.waitForAngular() as Protractor automatically applies this command before every Web Driver action. Simply using browser.navigate.refresh() should also work.
Upvotes: 0
Reputation: 81
Well, I could "fixed" by adding the lines:
browser.waitForAngular();
browser.navigate().refresh();
but I don't understand why I have to refresh the page. :(
Upvotes: 4