简体   繁体   中英

What is the proper way to use Protractor with SystemJS?

This problem should apply to requirejs as well.

The specifics:

  • Protractor
  • SystemJS loading ES6 BabelJS transpiled system modules
  • Cucumber.js
  • Chai, chai-as-promised

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?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM