Mike Haas
Mike Haas

Reputation: 2553

What is the proper way to use Protractor with SystemJS?

This problem should apply to requirejs as well.

The specifics:

The reason I'm asking is because I have just a couple very basic cucumber tests and sometimes I get errors (inconsistently) involving timeouts or waiting to sync with the page etc. Other times my tests pass and no timeout errors are given. There is not a ton of authoritative information on these problems. Mainly just a bunch of SO and github issues.

What is the proper way to use Protractor with SystemJS?

Upvotes: 9

Views: 364

Answers (1)

Dylan Watson
Dylan Watson

Reputation: 2323

These don't sound like issues specific to SystemJS.

Rather, in my experience, they are pretty much the joys of working with Protractor.

Things the you can do to mitigate the issues however include:

  • Add browser.manage().timeouts().implicitlyWait(5000); before any tests run. Perhaps in your protractor onPrepare config method
  • Try browser.waitForAngular();
    • Theoretically its called internally in Protractor, but somethings it seems to be needed..?
  • Wait for elements to be clickable, before clicking them: browser.wait(protractor.ExpectedConditions.elementToBeClickable(elm), 2000); elm.click();

You may also be interested to see that there is a new project that hopes to avoid all the pitfalls with selenium based test frameworks.. by not using selenium at all. It claims to be much simpler, faster and less error-prone: https://www.cypress.io/

Upvotes: 1

Related Questions