https://github.com/regenrek/nuxt-playwright-template
A simple nuxt.js template for jest and playwright tests
https://github.com/regenrek/nuxt-playwright-template
Last synced: about 1 month ago
JSON representation
A simple nuxt.js template for jest and playwright tests
- Host: GitHub
- URL: https://github.com/regenrek/nuxt-playwright-template
- Owner: regenrek
- Created: 2021-02-21T17:01:46.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-21T18:09:01.000Z (about 4 years ago)
- Last Synced: 2025-02-08T12:46:23.268Z (3 months ago)
- Language: TypeScript
- Size: 116 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

Run simple browser tests with [playwright](https://playwright.dev/) and [jest](https://jestjs.io/) for nuxt.
## 🖍️ Why
This repository exists to write playwright browser tests for your nuxt application. It's using [nuxt/test-utils](https://github.com/nuxt/test-utils) under the hood with some modifications to it.
### Why not using `@nuxt/test-utils`?
For my use case I run my nuxt application in a docker container (See: [nuxt-docker Starter](https://github.com/regenrek/nuxt-docker)) and run these tests against it. So I don't need to configure the nuxt build process (Nuxt builder) and avoid problems with dependencies (like esmodule, transpile errors, postcss problems e.g.) on startup.
While writing tests its also easier for me that my nuxt application is always up (in a docker container) and I can run my tests against it.
The last part is the `rootDir/testDir` configuration nuxt/test-utils project which just didn't work out of the box with my application.
## 📌 Prerequisites
* As I explained above you need to run nuxt manually.
* Only ssr supported## What this repository is not intended for
* Auto startup nuxt on running tests -> `nuxt builder`
* Testing static builds -> `nuxt-generate` (will maybe support later)
* Nuxt modules testingYou should consider using [nuxt/test-utils](https://github.com/nuxt/test-utils)
## 🚀 Features
* Nuxt.js
* Nginx (Access site via `localhost:8080`)## 📦 Install
```
[email protected]:regenrek/nuxt-playwright-template.git my-webapp-tests
cd my-webapp-tests
``````
yarn
```## 📦 Usage
### Run your tests
This will run tests in the `test` directory```
yarn test
```More verbose output
```
yarn test:debug
```## Cookie support
Sometimes you want to set cookies when starting the application. For example to disable a cookie-law banner e.g.
So you can fill the `test/testdata/cookiesDummy.json` with your custom cookies.You can disable cookie support with
```
const page = await createPage('/', { disableDefaultCookies: true })
```## License
[MIT License](./LICENSE)