mercredi 11 novembre 2015

On a protractor helper function, how can I know if browser.get was ever called?

I'm creating a helper function for my protractor tests to log in the application only if necessary.

That is useful to allow me to run each test in isolation to debug it and, when running the whole suite, I get a little performance boost from not having to log in before every test.

I have to actually login in two situations:

  1. If no page was ever loaded (browser.get() was not called).
  2. We are on a page, but not logged in yet.

Situation 2 is easy. The application has an element that is shown on all pages when the user is logged in.

The hard part is 1. If I try to find the element that indicates the user is logged in before I load any pages, I get the following error:

Error while waiting for Protractor to sync with the page: "angular could not be found on the window"

And I didn't see anything on the protractor API or source code that could help me determine if any pages were already loaded.

Any pointers are appreciated.

Aucun commentaire:

Enregistrer un commentaire