Skip to main content
Version: rolling

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 build run once (repo root)
  • Install playwright browsers: npx playwright install (in tests/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)
info

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):

VariableDefaultDescription
OC_BASE_URLhost.docker.internal:9200URL of the OpenCloud instance
BASIC_AUTHfalseBasic auth instead of OIDC login
KEYCLOAKfalseEnable Keycloak-specific tests
FEDERATED_SERVERfalseRun against the federated server
SLOW_MO0Slow down operations by N ms
TEST_TIMEOUT120Per-test timeout in seconds
FAIL_ON_UNCAUGHT_CONSOLE_ERRtrueFail on uncaught console errors

Running Tests in VS Code

Install Playwright Test for VSCode (recommended in .vscode/extensions.json).

  1. cd tests/e2e && pnpm bddgen at least once.
  2. Open the Testing sidebar (flask icon) — generated specs appear as a tree.
  3. 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 --debugPlaywright Inspector (combine with --project=chromium -g "scenario name" to target one test).
  • pnpm playwright show-trace <trace.zip>Trace Viewer for a recorded trace (recorded on-first-retry by default, see playwright.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 ...