0
votes

I have written this test, however browser doesn't wait those 20 seconds before looking for an element. It ignores that part and only wait those default 11 seconds. Is there something wrong with my code?

it('should navigate to Home tab', function() {
    element(by.css('[ui-sref="main.home"]')).click();

    var telematicsSection = element(by.id('teleMap'));

    var EC = protractor.ExpectedConditions;
    browser.wait(EC.presenceOf(telematicsSection), 20000);
});

This is an error I get

Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular While waiting for element with locator - Locator: By(css selector, *[id="teleMap"]).

@edit

I've managed to fix it. Yash Jagdale's code and

allScriptsTimeout: 20000

in conf.js made it work.

2
In your config file, what value do you have set for allScriptsTimeout?Gunderson
Have you read through the link given?demouser123
As Gunderson pointed out, it is likely an issue with your declaration of timeouts. Can you show us your conf.js code?Ben Mohorc

2 Answers

0
votes

You can use below way to handle async cycle properly

    it('should navigate to Home tab', function(callback) {
        element(by.css('[ui-sref="main.home"]')).click().then(function() {

        var telematicsSection = element(by.id('teleMap'));

        var EC = protractor.ExpectedConditions;
        browser.wait(EC.presenceOf(telematicsSection), 20000).then(function() {
           callback();
         });
      });
    }, 40000);
0
votes

Add browser.ignoreSynchronization = true; in onPrepare of protractor conf.js

onPrepare: function() {

  browser.ignoreSynchronization = true;