Because WebDriver tests are asynchronous and involve many components, there are several reasons why a timeout could occur in a Protractor test.
Subscribe to my youtube channel :
When navigating to a new page using the browser.get, Protractor waits for the page to be loaded and the new URL to appear before continuing.
Before performing any action, Protractor waits until there are no pending asynchronous tasks in your Angular application. This means that all timeouts and HTTP requests are finished.
You may also need to fix this problem with a change to your application.
AngularJS If your AngularJS application continuously polls $timeout or $http, Protractor will wait indefinitely and time out. You should use the $interval for anything that polls continuously (introduced in Angular 1.2rc3).
Angular For Angular apps, Protractor will wait until the Angular Zone stabilizes. This means long-running async operations will block your test from continuing. To work around this, run these tasks outside the Angular zone.
For example:
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
// Changes here will not propagate into your view.
this.ngZone.run(() => {
// Run inside the ngZone to trigger change detection.
});
}, REALLY_LONG_DELAY);
});
As an alternative to either of these options, you could disable waiting for Angular, see below.
Protractor waits for the angular variable to be present when loading a new page.
If you need to navigate to a page which does not use Angular, you can turn off waiting for Angular by setting browser.waitForAngularEnabled(false)
browser.waitForAngularEnabled(false);
browser.get('/non-angular-login-page.html');
element(by.id('username')).sendKeys('Jane');
element(by.id('password')).sendKeys('1234');
element(by.id('clickme')).click();
browser.waitForAngularEnabled(true);
browser.get('/page-containing-angular.html');
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.
If a spec (an 'it' block) takes longer than the Jasmine timeout for any reason, it will fail.
I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.
im encountering specific issue im using mail listerner to search for an email, issue is when there are no mail, mail listener timed out but protractor keep waiting, so i want to add a method to timeout the test after specific time
` it('1-should login with a registration code sent to an email', function (done) {
// setTimeout(function () {
flow.execute(browser.params.getLastEmail)
.then(function (email) {
expect(email.subject)
.toEqual('[email protected] submitted feedback');
expect(email.headers.to)
.toEqual('[email protected]');
expect(email.html.includes('User feedback details: accountId: 12345, related To: dashboard, description: ' + D.feedbackMsg + ''))
.toEqual(true);
console.log(email.html);
// done();
});
});`
i have tried all other way browser.manager...etc , default time out for jasmine , setting particular timeout for it block non of them work