End-to-end tests against the real backend (#116) #143
Merged
+431
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All our Playwright tests answered the API calls with made-up data, so no test went from the browser to the database. This adds 11 tests that use the real backend and a PostgreSQL test database.
What the tests cover
How to run them
They need the same test database as the backend's database tests (see "Database tests" in
docs/api.md):npm run check -- --e2eruns them too. WithoutTEST_DATABASE_URLthey are skipped, so the check still works for someone who has not made the test database.How it works
frontend/e2e-api/, with their own config infrontend/playwright.api.config.ts.backend/.env.npm run db:e2e:clean).e2e_, so the tests can run at the same time.vite.config.tsnow reads the backend address fromBACKEND_URL. Without it, the address ishttp://localhost:3001as before.Testing
npm run check -- --e2epasses withTEST_DATABASE_URLset, and the new tests passed three runs in a row. Without the variable, the 11 tests are skipped and the check passes.The README test table and
docs/api.mddescribe the new tests.Closes #116