docs: update information about playwright test runner

This commit is contained in:
Daniel Roe 2024-03-19 10:34:26 +00:00
parent cbf4d5436a
commit 8e635fd233
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -16,7 +16,7 @@ In order to allow you to manage your other testing dependencies, `@nuxt/test-uti
- you can choose between `happy-dom` and `jsdom` for a runtime Nuxt environment
- you can choose between `vitest`, `cucumber`, `jest` and `playwright` for end-to-end test runners
- `playwright-core` is only required if you wish to use the built-in browser testing utilities
- `playwright-core` is only required if you wish to use the built-in browser testing utilities (and are not using `@playwright/test` as your test runner)
::code-group
```bash [yarn]
@ -388,7 +388,7 @@ await setup({
## End-To-End Testing
For end-to-end testing, we support [Vitest](https://github.com/vitest-dev/vitest) and [Jest](https://jestjs.io) as test runners.
For end-to-end testing, we support [Vitest](https://github.com/vitest-dev/vitest), [Jest](https://jestjs.io), [Cucumber](https://cucumber.io/) and [Playwright](https://playwright.dev/) as test runners.
### Setup
@ -493,11 +493,11 @@ const pageUrl = url('/page')
### Testing in a Browser
We provide built-in support using Playwright within `@nuxt/test-utils`, but you can also use other test runners for end-to-end browser testing.
We provide built-in support using Playwright within `@nuxt/test-utils`, either programmatically or via the Playwright test runner.
#### `createPage(url)`
You can create a configured Playwright browser instance, and (optionally) point it at a path from the running server. You can find out more about the API methods available from [in the Playwright documentation](https://playwright.dev/docs/api/class-page).
Within `vitest`, `jest` or `cucumber`, you can create a configured Playwright browser instance with `createPage`, and (optionally) point it at a path from the running server. You can find out more about the API methods available from [in the Playwright documentation](https://playwright.dev/docs/api/class-page).
```ts twoslash
import { createPage } from '@nuxt/test-utils/e2e'
@ -508,7 +508,7 @@ const page = await createPage('/page')
#### Testing with Playwright Test Runner
We provide first-class support for using `@nuxt/test-utils` within a Playwright test runner.
We also provide first-class support for using `@nuxt/test-utils` within [the Playwright test runner](https://playwright.dev/docs/intro).
You can provide global Nuxt configuration, with the same configuration details as the `setup()` function mentioned earlier in this section.