Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 913
Mike Haas Avatar asked Aug 07 '15 15:08

Mike Haas


People also ask

How do you write a test case using a Protractor?

Files required by ProtractorThe test code is written by using the syntax of our testing framework. For example, if we are using Jasmine framework, then the test code will be written by using the syntax of Jasmine. This file will contain all the functional flows and assertions of the test.


1 Answers

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/

like image 90
Dylan Watson Avatar answered Sep 19 '22 06:09

Dylan Watson