Playwright end-to-end tests for OpenProject-Nextcloud-Keycloak integration.
- Node.js 18+
- npm
- Integration cluster deployed via https://github.com/opf/integration-qa-helmfile
- Playwright browsers installed
-
Install dependencies:
npm install npm run playwright:install
-
Set env for local (gitignored):
cat > .env.local <<'EOF' OPENPROJECT_HOST=openproject.test NEXTCLOUD_HOST=nextcloud.test KEYCLOAK_HOST=keycloak.test E2E_OP_ADMIN_USER=admin E2E_OP_ADMIN_PASS=admin E2E_NC_ADMIN_USER=admin E2E_NC_ADMIN_PASS=admin E2E_KC_ADMIN_USER=admin E2E_KC_ADMIN_PASS=admin EOF
-
Run tests (choose env):
E2E_ENV=local npm test # local Helm/defaults E2E_ENV=edge npm test # edge/staging secrets must be exported E2E_ENV=stage npm test # stage secrets must be exported
# Run with explicit env selection (preferred)
E2E_ENV=edge npm test
E2E_ENV=stage npm test
E2E_ENV=local npm test
# Override worker count to re-enable parallelism (default is 1)
npx playwright test --workers 4
# Shortcuts
npm run test:edge # uses E2E_ENV=edge
npm run test:stage # uses E2E_ENV=stage
npm run test:local # uses E2E_ENV=local
# Run in headed mode
npm run test:e2e:headed
# Run with UI mode
npm run test:e2e:ui# Open test report
npm run report:showUse --grep to include tags:
npx playwright test --grep @fastSkip a tag with --grep-invert:
npx playwright test --grep-invert @fastLogical OR (either tag):
npx playwright test --grep "@fast|@slow"Logical AND (both tags via lookahead):
npx playwright test --grep "(?=.*@fast)(?=.*@slow)"All tests now live directly under tests/:
kc-integration.spec.ts- Keycloak integration (@smoke,@regression,@integration)nc-integration.spec.ts- Nextcloud integration (@regression,@integration)op-integration.spec.ts- OpenProject integration (@regression,@integration)
All specs run for the single supported setup (sso-external). Use --grep to target @smoke, @regression, or @integration.
Defaults (overridable via env):
- OpenProject admin:
E2E_OP_ADMIN_USER/E2E_OP_ADMIN_PASS(defaultadmin/admin) - Nextcloud admin:
E2E_NC_ADMIN_USER/E2E_NC_ADMIN_PASS(defaultadmin/admin) - Keycloak admin:
E2E_KC_ADMIN_USER/E2E_KC_ADMIN_PASS(defaultadmin/admin) - Keycloak realm users:
E2E_ALICE_USER/E2E_ALICE_PASS(defaultalice/1234),E2E_BRIAN_USER/E2E_BRIAN_PASS(defaultbrian/1234)
Import from e2e/utils/test-users.ts:
import { OP_ADMIN_USER, NC_ADMIN_USER, ADMIN_USER, ALICE_USER, BRIAN_USER } from '../utils/test-users';Use the helpers in utils/test-helpers.ts to keep specs focused on behaviour instead of data setup:
- Ensure a user has admin rights (idempotent):
import { ensureUserIsAdmin } from '../utils/test-helpers';
const loginIdentifier = ALICE_USER.email ?? `${ALICE_USER.username}@example.com`;
const { userId, updated } = await ensureUserIsAdmin(loginIdentifier);- Ensure a project exists and has a Nextcloud storage configured via API:
import { ensureProjectHasNextcloudStorage } from '../utils/test-helpers';
await ensureProjectHasNextcloudStorage('demo-project');- Copy the demo project via UI using the existing page objects:
import { ensureDemoProjectCopyViaUi } from '../utils/test-helpers';
await ensureDemoProjectCopyViaUi(page, 'test');Hosts (preferred):
OPENPROJECT_HOST, NEXTCLOUD_HOST, KEYCLOAK_HOST
Versions (optional):
OPENPROJECT_VERSION, NEXTCLOUD_VERSION, INTEGRATION_APP_VERSION, KEYCLOAK_VERSION
Credentials (see Test Users):
E2E_OP_ADMIN_USER, E2E_OP_ADMIN_PASS, E2E_NC_ADMIN_USER, E2E_NC_ADMIN_PASS, E2E_KC_ADMIN_USER, E2E_KC_ADMIN_PASS, E2E_ALICE_USER, E2E_ALICE_PASS, E2E_BRIAN_USER, E2E_BRIAN_PASS
Other controls:
SETUP_METHOD (sso-external only), SETUP_JOB_CHECK=true to enforce cluster setup-job wait (off by default), E2E_ENV to pick env preset.
Local runs: put the above in .env.local (already gitignored). CI ignores this file.
Tests fail to connect?
- Verify pods are running:
kubectl get pods -n opnc-integration - Check port forwarding is active
Playwright complains about missing browser executable?
- Make sure you've run
npm run playwright:install(ornpx playwright install) afternpm install. - Re-run your test command, e.g.
npm run test:local.
## More Information
- Tests run in parallel by default (both browsers + multiple test files)
- Uses Page Object Model pattern
- Locators stored in JSON files
- See `e2e/utils/locators_guide.md` for locator usage examples