1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-05-18 14:51:02 +00:00
bramw_baserow/docs/development/e2e-testing.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
2 KiB
Markdown
Raw Permalink Normal View History

2023-01-30 13:26:33 +00:00
# End-to-end testing
2023-02-27 16:05:07 +00:00
Baserow comes with end-to-end test suite in the `e2e-tests` folder. The test suite
uses [Playwright](https://playwright.dev/) testing tool to run UI tests against a
running Baserow instance using one or multiple browsers.
2023-01-30 13:26:33 +00:00
2023-02-27 16:05:07 +00:00
## When and what to e2e test
2023-01-30 13:26:33 +00:00
2023-02-27 16:05:07 +00:00
As of February 2023 the e2e test suite is brand new, we recommend you add any e2e
tests you think make sense. Some ideas on what to test:
1. Complicated multiservice UX flows like duplicating a database
2. Complicated frontend code that is hard to test with unit tests
3. The serialization boundary between the frontend client and backend api
4. Critical features that often accidentally break or features that often break in
other browsers, and we don't notice.
2023-01-30 13:26:33 +00:00
2023-02-27 16:05:07 +00:00
## Installation and running locally
2023-01-30 13:26:33 +00:00
You'll need Node.js to run the end-to-end test suite locally. Using [nvm](https://github.com/nvm-sh/nvm),
it can be installed with:
```bash
nvm install v<version>
```
Replace `<version>` with a supported Node.js version listed in
`baserow/docs/installation/supported.md`.
To run the end-to-end tests:
2023-01-30 13:26:33 +00:00
```bash
2023-02-27 16:05:07 +00:00
# Startup your local env which will be tested
$ ./dev.sh
$ cd e2e-tests
# The below script installs the e2e test package, waits for your dev env to be healthy
# and then runs the tests.
$ ./run-e2e-tests-locally.sh
# After which you can manually re-run the tests with various manual commands:
2023-01-30 13:26:33 +00:00
yarn test # headless
yarn test-headed
2024-11-14 12:30:42 +00:00
yarn test-ui # starts the UI mode. Best way to debug you tests.
yarn codegen # Helps to generate tests directly in a browsers. Use it as inspiration;
# the skeleton can be used, but some of its generated code is bad.
# Tweak it yourself after use.
2023-01-30 13:26:33 +00:00
```
2024-11-14 12:30:42 +00:00
`yarn test` and `yarn test-*` will run all tests in Chrome.
2023-01-30 13:26:33 +00:00
## Configuration
2023-02-27 16:05:07 +00:00
Besides Playwright configuration defined in `e2e-tests/playwright.config.ts` you can set
environment variables to target a Baserow instance on any URL
with `PUBLIC_WEB_FRONTEND_URL` and `PUBLIC_BACKEND_URL`. You can also
use `e2e-tests/.env` file to do so, see `e2e-tests/.env-example`.