Page MenuHomePhabricator

Investigate WebdriverIO async mode
Open, MediumPublic

Description

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJun 29 2020, 11:08 AM
zeljkofilipin triaged this task as Medium priority.
zeljkofilipin moved this task from Backlog to In Progress on the User-Soham board.

Change 615418 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] WIP WDIO(async): remove wdio-sync npm package

https://gerrit.wikimedia.org/r/615418

Change 615419 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] WIP WDIO(async): skipping all test suites

https://gerrit.wikimedia.org/r/615419

Change 615592 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/specs/user.js async

https://gerrit.wikimedia.org/r/615592

See also:

In October as part of T234002 and https://gerrit.wikimedia.org/r/539865 I explored using the wdio-async mode but abandoned the idea. From what I can tell, wdio-sync is the only well-understood and supported mode in upstream for wdio. Without it things get quite confusing, fall apart somewhat, and the code doesn't become better, either.

What I did do, is remove all use of browser.call() which was the only publicly exposed usage of Fiber in our code (in favour of native async-await).

This means we no longer use Fiber to weirdly pause execution and wait for our own promises and async code. It is however still used by wdio internally to make browser.goto(), and $() and waitFor and all other wdio commands appear synchronous which is by design and hard to avoid.

Has upstream Wdio decided to make async the default recommended, advertised and documented mode for all examples etc?

See also:

In October as part of T234002 and https://gerrit.wikimedia.org/r/539865 I explored using the wdio-async mode but abandoned the idea. From what I can tell, wdio-sync is the only well-understood and supported mode in upstream for wdio. Without it things get quite confusing, fall apart somewhat, and the code doesn't become better, either.

What I did do, is remove all use of browser.call() which was the only publicly exposed usage of Fiber in our code (in favour of native async-await).

This means we no longer use Fiber to weirdly pause execution and wait for our own promises and async code. It is however still used by wdio internally to make browser.goto(), and $() and waitFor and all other wdio commands appear synchronous which is by design and hard to avoid.

Has upstream Wdio decided to make async the default recommended, advertised and documented mode for all examples etc?

@Krinkle after writing the first test in async mode for wdio, I personally that the tests are more elegant when written in the sync mode. The idea was to replicate some syntax sort of similar to that we use for Puppeteer however clearly with async mode, the test lose their readability for wdio which is the opposite to what we aimed for! Maybe I am doing things the wrong way. I'll add you as reviewer, maybe I am doing something the wrong way

Change 615701 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] WIP WDIO(async): make tests in tests/selenium/page.js async

https://gerrit.wikimedia.org/r/615701

Change 615786 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/specialwatchlist.js async

https://gerrit.wikimedia.org/r/615786

Change 615791 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/specialrecentchanges.js async

https://gerrit.wikimedia.org/r/615791

@Krinkle could you please review patches linked to this task? Your advice on if webdriverio async mode is ready for use is also highly appreciated. ๐Ÿ˜

Feel free to set up a meeting with @Soham if you think that would make the review faster.

Upstream advertises the sync mode and that is how most people use it.

I looked into async mode as I suspected the Fibers layer might be behind the slowness, but it wasn't the root cause (the root cause was badly written MW tests).

What problem are we looking to solve by changing to async mode?

Upstream advertises the sync mode and that is how most people use it.

I looked into async mode as I suspected the Fibers layer might be behind the slowness, but it wasn't the root cause (the root cause was badly written MW tests).

What problem are we looking to solve by changing to async mode?

@Krinkle I would say the problem is more towards the cosmetic side of things. We were really impressed with the async-await syntax used by Puppeteer for how clean and legible it is. So we thought it might be a good opportunity to conduct a short PoC. It was a plan to hold a short meeting to discuss regarding the same with you but with the GSoC deadlines to respect it went a little lower in the list of agendas. Would you be willing to set up a short meet with @Zeljko9889 and me possibility sometime next week?

Would you be willing to set up a short meet with @Zeljko9889 and me possibility sometime next week?

I'm not sure if @Zeljko9889 cares about webdriverio, but @zeljkofilipin does. ๐Ÿ˜‰

@Krinkle @Soham This was an interesting experiment, inspired by puppeteer async syntax. (See T247843: Evaluate Puppeteer as a WebdriverIO replacement for our browser automation framework and related commits.) I think the conclusion is that webdriverio async is not ready yet. Please correct me if I'm wrong. Also, feel free to reopen the task if you disagree or if there's anything left to do.

I'll abandon commits related to this task.

Change 615418 abandoned by Zfilipin:
[mediawiki/core@master] WIP WDIO(async): remove wdio-sync npm package

Reason:

https://gerrit.wikimedia.org/r/615418

Change 615419 abandoned by Zfilipin:
[mediawiki/core@master] WIP WDIO(async): skipping all test suites

Reason:

https://gerrit.wikimedia.org/r/615419

Change 615592 abandoned by Zfilipin:
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/specs/user.js async

Reason:

https://gerrit.wikimedia.org/r/615592

Change 615701 abandoned by Zfilipin:
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/page.js async

Reason:

https://gerrit.wikimedia.org/r/615701

Change 615786 abandoned by Zfilipin:
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/specialwatchlist.js async

Reason:

https://gerrit.wikimedia.org/r/615786

Change 615791 abandoned by Zfilipin:
[mediawiki/core@master] WIP WDIO(async): Make tests in tests/selenium/specialrecentchanges.js async

Reason:

https://gerrit.wikimedia.org/r/615791

zeljkofilipin updated the task description. (Show Details)