-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
docs: added guide for Playwright #11498
Conversation
Friendly ping @SimenB. Any chance that this gets merged? |
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.
question about whether we should have it, but if we go with yes - can you also add versioned versions (hah) of this doc?
}); | ||
``` | ||
|
||
There's no need to launch the browser manually. Playwright's `page`, `context`, and `browser` classes will automatically be exposed as global variables see [here](https://github.com/playwright-community/jest-playwright#globals). |
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's no need to launch the browser manually. Playwright's `page`, `context`, and `browser` classes will automatically be exposed as global variables see [here](https://github.com/playwright-community/jest-playwright#globals). | |
There's no need to launch the browser manually. Playwright's `page`, `context`, and `browser` classes will automatically be exposed as global variables see [here](https://github.com/playwright-community/jest-playwright/blob/master/README.md#globals). |
otherwise link doesn't work on mobile
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.
Another option (not necessarily any better than @SimenB's suggestion), tested on iOS:
https://github.com/playwright-community/jest-playwright#user-content-globals
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.
works on android as well 🙂
|
||
## Use jest-playwright Preset | ||
|
||
[jest-playwright-preset](https://github.com/playwright-community/jest-playwright) provides all required configuration to run your tests using Playwright. |
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.
should we add this when you don't recommend its usage? https://github.com/playwright-community/jest-playwright/blob/c536b17fc391c272d9493f7e57bf19bfd223c264/README.md#%EF%B8%8F-we-recommend-the-official-playwright-test-runner-playwrighttest-%EF%B8%8F
it should at least be acknowledged here and maybe mention tradeoffs?
Oh, and a rebase should trigger GH actions as well |
Sorry for the confusion! I'm closing the PR for now since Playwright's own test-runner turned out to be much more flexible for writing end-to-end tests and we recommend this to the users. |
fair enough 🙂 |
## Use jest-playwright Preset | ||
|
||
[jest-playwright-preset](https://github.com/playwright-community/jest-playwright) provides all required configuration to run your tests using Playwright. |
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.
## Use jest-playwright Preset | |
[jest-playwright-preset](https://github.com/playwright-community/jest-playwright) provides all required configuration to run your tests using Playwright. | |
## Playwright Test | |
The recommended approach to using Playwright is the [Playwright Test](https://playwright.dev/docs/intro) test runner, which heavily uses Jest's [`expect`](https://jestjs.io/docs/expect) internally, to power assertions. `expect` is also exposed via [`test.expect`](https://playwright.dev/docs/api/class-test#test-expect). | |
## Jest Playwright | |
[jest-playwright-preset](https://github.com/playwright-community/jest-playwright) provides all required configuration to run your tests using Playwright. |
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.
(Just in case this PR is revived later, here's the small addition I wrote over the weekend, but hadn't gotten around to submitting)
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Playwright is a library to automate Chromium, Firefox, and WebKit which gained popularity over the past year. Users often use it with Jest, so it would be helpful for them to have something in the official documentation to compare the two approaches to use Jest with Playwright.
Test plan
See the Netlify preview link: https://deploy-preview-11498--jestjs.netlify.app/docs/next/playwright
Additional
As a drive-by I fixed the guide to run the website locally in its readme which was not working before for me.
cc @SimenB since you are familiar with Playwright. Thanks!