0
votes

I have migrated our Angular JS(1.5) app to a Hybrid app. I am using Angular6/AngularJS (1.6) both. I am trying to run protractor e2e of the existing e2e tests for angular js pages.

My all the existing tests are running very fast. and Most of e2e tests are now failing with reasons like "Element not visible", or "Element not enabled", so now I have add wait for elements at multiple places to get them fixed. Any reasons why they are running too fast ? I have hundreds of test cases, and to put the wait in the test cases is a time consuming task.

Any other setting which I use to make them passing, since those were working fine in Angular JS only app.

In the Angular JS application my protractor version was "4.0.9" and "webdriver-manager ": "10.2.3". and that now after moving to a angular hybrid app here updated version

My protractor version : protractor": "^5.3.2 "webdriver-manager": "12.0.6", "selenium-webdriver": "4.0.0-alpha.1",

Node Version: `8.11.3 Protractor Version: 5.3.2 Angular Version: 6.0.4 AngularJS Version: 1.6.4 Browser(s): Chrome, firefix

1

1 Answers

-1
votes

You don't need add waiters before each action in your tests. You can implement wrapper with some common actions. Take a look at this idea:

public async clickOn(): Promise<void> {
    try {
      await this.waitForClickable();
    } catch (e) {
      throw new Error(`Can not click on fragment of not clickable fragment. ${e}`);
    }
    await this.click();
  }

  public async type(text: string): Promise<void> {
    await this.clearInput();
    await this.sendKeys(text);
  }

  public async clearInput(): Promise<void> {
    try {
      await this.waitForVisible();
    } catch (e) {
      throw new Error(`Can not clear the input of not visible fragment. ${e}`);
    }
    await this.clear();
  }

I hope you get the idea.