-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E2E tests replace Puppeteer with Playwright #18762
Conversation
…tests-migrate-to-playwright
…tests-migrate-to-playwright � Conflicts: � projects/plugins/jetpack/yarn.lock
…tests-migrate-to-playwright � Conflicts: � projects/plugins/jetpack/yarn.lock
Caution: This PR has changes that must be merged to WordPress.com |
Scheduled Jetpack release: February 16, 2021. Thank you for the great PR description! When this PR is ready for review, please apply the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a small linting issue in README
file, otherwise, it looks good!
Co-authored-by: Yaroslav Kukharuk <[email protected]>
…tests-migrate-to-playwright
…tests-migrate-to-playwright
…tests-migrate-to-playwright
if ( ! CI ) { | ||
executablePath = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; | ||
} | ||
let { E2E_DEBUG, HEADLESS, SLOWMO } = process.env; | ||
|
||
if ( E2E_DEBUG ) { | ||
process.env.DEBUG = 'pw:browser|api|error'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this doesn't really work. This code works in a jest
's setup process, while tests are running in separate processes. And I believe the environment is not shared between these processes.
Try accessing DEBUG
value in one of the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it works. Not sure how, they're probably shared or inherited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
r220908-wpcom |
This PR replaces Puppeteer with Playwright as the browser automation library used in E2E tests.
The initial POC was part of PR 17814, closed now in favor of this one.
Changes proposed in this Pull Request:
Added dependencies:
playwright
jest-playwright-preset
Removed dependencies:
puppeteer
jest-puppeteer
Configuration changes
added testRunner: 'jasmine2' in jest.config.js to fix "referenceError: jasmine is not defined"
Code changes due to API differences
waitAndClick
andwaitAndType
with Playwright'spage.click
andpage.type
. RemovedwaitAndClick
andwaitAndType
as they are now obsoletepage.waitFor
withpage.waitForTimeout
page.setCookie()
withpage.browserContext().addCookies()
page.$x
withpage.$$(xpath='locator')
page.waitForXPath()
withpage.waitForSelector()
page.setViewport()
withpage.setViewportSize()
PUPPETEER_HEADLES
toHEADLESS
Changes unrelated to migration
tests/e2e/output
Jetpack product discussion
n/a
Does this pull request change what data or activity we track or use?
n/a
Testing instructions:
All E2E tests need to pass
Proposed changelog entry for your changes:
no changelog entry needed