Monday, October 9, 2017

Moving Protractor tests to async/await (leaving selenium control flow)

I want to move appart from the selenium control flow in my Protractor tests.

Here are the steps and problems I went through so far:

1. Disable it test by test

My first idea was to use SELENIUM_PROMISE_MANAGER in order to move from selenium promises to async/await code.

Unfortunately, I found no way to put one test to SELENIUM_PROMISE_MANAGER=0 while keeping others to SELENIUM_PROMISE_MANAGER=1 in order to do the migration smoothly.

2. Keep it but use async/await too

So I thought about a code using async/await while keeping SELENIUM_PROMISE_MANAGER=1.

Unfortunately it seems not to be compatible: https://github.com/angular/protractor/tree/master/exampleTypescript/asyncAwait

There is nothing about such issue on Selenium side so I am wondering if this is an advice or a real it always fails.

3. Override promise.USE_PROMISE_MANAGER

Using protractor.promise.USE_PROMISE_MANAGER=false does not work for me (in beforeEach).

4. Call the control flow on async code

protractor.promise.controlFlow().execute(/* my async code*/);

For me it seems to mix async/await to control flow…

What is the right strategy?

I am wondering, what is the right strategy to move to async/await in Protractor tests?

I don’t want to put everything in async/await in one change but to spread the change in multiple small changes

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/09/moving-protractor-tests-to-asyncawait-leaving-selenium-control-flow/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment