mardi 21 janvier 2020

Protractor can't find angular variable and wait until jasmine default time resulting in failure of tests

I am automating some test cases for an angular app. I have the following understanding with Protractor as:

  1. In angular apps there is no need of explicit waiting like selenium as protractor 90% commands return promises i.e. it means that protractor waits by its own.
  2. Protractor's function WaitForAngularEnabled() is by default true.

The problem i am having is that while automating tests for my angular app, when i test my app, protractor waits (and i guess it waits for angular variable) until jasmine default time expires and all test cases fails. When I test my app as Non-Angular (change my protractor conf. settings (code attached)), all test cases work finely, but I have to explicitly add waits which results in much flaky tests. It also increases test execution time. Can anyone help me in above mentioned issue. Will be much thankful to you.

onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    browser.waitForAngularEnabled(false);//Disabled angular here
    browser.driver.manage().window().maximize();
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }

Aucun commentaire:

Enregistrer un commentaire