add playwright tests
This commit is contained in:
@@ -62,3 +62,24 @@ cargo fmt --all -- --check
|
||||
cargo check
|
||||
cargo test
|
||||
```
|
||||
|
||||
### End-to-end tests (Playwright)
|
||||
|
||||
The e2e tests live in `e2e/` and use Playwright with a real browser. Each test
|
||||
starts its own server against a fresh, throwaway database on a unique port, so
|
||||
tests are fully isolated from each other and from your real `sustenance.db`.
|
||||
|
||||
```sh
|
||||
# one-time setup
|
||||
cd e2e
|
||||
npm install
|
||||
npx playwright install chromium
|
||||
|
||||
# run the tests (builds the server automatically via globalSetup)
|
||||
cd e2e
|
||||
npx playwright test
|
||||
```
|
||||
|
||||
The Playwright `globalSetup` runs `cargo build` before the suite, and each test
|
||||
launches its own server against a fresh database, so no manual build or server
|
||||
start is required.
|
||||
|
||||
Reference in New Issue
Block a user