Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Add async/await into /specs #1154

Merged
merged 11 commits into from
Apr 24, 2018
Merged

Add async/await into /specs #1154

merged 11 commits into from
Apr 24, 2018

Conversation

Stojdza
Copy link
Contributor

@Stojdza Stojdza commented Apr 22, 2018

Specs affected with this PR:

  • wp-log-in-out-spec.js
  • wp-manage-domains-spec.js
  • wp-notifications-spec.js
  • wp-plan-purchase-spec.js
  • wp-reader-spec.js
  • wp-theme-multisite-spec.js
  • wp-theme-switch-spec.js
  • wp-view-site-spec.js
  • wp-signup-spec.js

@alisterscott
Copy link
Contributor

Hi @Stojdza

Could you explain a bit about the approach you're taking here? Does this make the specs run with the promise manager or just move us towards it?

I tried running the login spec with the promise manager disabled and it failed:

env BROWSERSIZE=desktop SELENIUM_PROMISE_MANAGER=0 ./node_modules/.bin/mocha specs/wp-log-in-out-spec.js

Is this expected to fail when the promise manager is disabled?

Can Log In
        ✓ Can log in
(node:47660) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TimeoutError: Timed out waiting for element with css selector of '.is-section-reader' to be present and displayed
Wait timed out after 21907ms
(node:47660) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:47660) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TimeoutError: Timed out waiting for element with css selector of '.is-section-reader' to be present and displayed
Wait timed out after 23915ms

Thanks!

@Stojdza
Copy link
Contributor Author

Stojdza commented Apr 23, 2018

Hey @alisterscott,

As you said, this is just moving us toward complete solution. For now, tests should run as usual - with the enabled promise manager. It is expected for tests to fail if you set SELENIUM_PROMISE_MANAGER=0.

Both, tests and methods behind the tests (components/pages/flows) should be asyncified. It would be much more understandable and easier for PR to split this into several smaller steps:

  1. Add async/await into specs (probably more than 1 PR)
  2. When specs are asyncified, add async/await into components/pages/flows (this includes removing promises and add async instead, as in Remove promise from shopping-cart-widget-component.js and add async/await #1153)

After this, we can disable promise manager and calmly await for promise manager deprecation

Copy link
Contributor

@alisterscott alisterscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this - LGTM as is ✅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants