Running E2E Tests
Gherkin features run with Playwright via playwright-bdd.
Prerequisites
- A running OpenCloud backend (root docker-compose.yml,
docker-compose up -d) pnpm buildrun once (repo root)- Install playwright browsers:
npx playwright install(intests/e2e)
Generating Tests From Features
Feature files (tests/e2e/features/**/*.feature) are compiled into Playwright spec (tests/e2e/.features-gen, gitignored)
files with playwright-bdd:
(cd tests/e2e && pnpm bddgen)
Re-run after adding/changing a .feature file or adding/renaming a step. All commands below assume
.features-gen is up to date.
Running Tests From the Terminal
pnpm test:e2e # from repo root: runs bddgen + playwright test
Tests run headless by default. See the Playwright CLI docs for all flags:
pnpm test:e2e --headed # show the browser
pnpm test:e2e test --ui # interactive UI mode (https://playwright.dev/docs/test-ui-mode)
pnpm test:e2e favorites.feature.spec.js:10 --project=chromium # single scenario, single project
pnpm test:e2e -g "mark and unmark resources as favorites using batch action"
pnpm test:e2e --workers=1 # override worker count (default: ~4 locally, 1 on CI)
Available projects: chromium, firefox, webkit, mobile-chromium, mobile-webkit,
ipad-chromium, ipad-landscape-webkit.
Useful env vars (set before the command, e.g. OC_BASE_URL=... pnpm test:e2e; full list in
playwright.config.ts appConfig):
| Variable | Default | Description |
|---|---|---|
OC_BASE_URL | host.docker.internal:9200 | URL of the OpenCloud instance |
BASIC_AUTH | false | Basic auth instead of OIDC login |
KEYCLOAK | false | Enable Keycloak-specific tests |
FEDERATED_SERVER | false | Run against the federated server |
SLOW_MO | 0 | Slow down operations by N ms |
TEST_TIMEOUT | 120 | Per-test timeout in seconds |
FAIL_ON_UNCAUGHT_CONSOLE_ERR | true | Fail on uncaught console errors |
Running Tests in VS Code
Install Playwright Test for VSCode
(recommended in .vscode/extensions.json).
cd tests/e2e && pnpm bddgenat least once.- Open the Testing sidebar (flask icon) — generated specs appear as a tree.
- Run/debug via the ▶ icons; toggle "Show browser" for
--headed.
Test Report
HTML report of the last test run
(playwright-report/):
(cd tests/e2e && pnpm exec playwright show-report)
Debugging
pnpm playwright test --debug— Playwright Inspector (combine with--project=chromium -g "scenario name"to target one test).pnpm playwright show-trace <trace.zip>— Trace Viewer for a recorded trace (recordedon-first-retryby default, seeplaywright.config.ts).
Timeouts
There is a single per-test timeout, testTimeout (default 120s, override with TEST_TIMEOUT). It is the
budget for the whole scenario (all steps + hooks)
When a scenario needs more time, use (playwright-bdd special tags):
@slow # test.slow() → triples the timeout
Scenario: Upload large resources ...
@timeout:300000 # exact timeout in milliseconds
Scenario: something even longer ...