Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

mxschmitt
Copy link
Contributor

@mxschmitt mxschmitt commented May 31, 2021

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!

@mxschmitt
Copy link
Contributor Author

Friendly ping @SimenB. Any chance that this gets merged?

Copy link
Member

@SimenB SimenB left a 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).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Contributor

@mrienstra mrienstra Oct 8, 2021

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

Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

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

@SimenB
Copy link
Member

SimenB commented Oct 8, 2021

Oh, and a rebase should trigger GH actions as well

@mxschmitt
Copy link
Contributor Author

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.

@mxschmitt mxschmitt closed this Oct 11, 2021
@SimenB
Copy link
Member

SimenB commented Oct 11, 2021

fair enough 🙂

@mxschmitt mxschmitt deleted the docs/added-guide-playwright branch October 11, 2021 09:13
Comment on lines +8 to +10
## Use jest-playwright Preset

[jest-playwright-preset](https://github.com/playwright-community/jest-playwright) provides all required configuration to run your tests using Playwright.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## 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.

Copy link
Contributor

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)

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants