Skip to content

ci: run e2e tests on pull requests with an auto-generated test user - #1232

Open
mahdi2ba wants to merge 5 commits into
Greenstand:keycloakfrom
mahdi2ba:feat/pr-e2e-ci
Open

ci: run e2e tests on pull requests with an auto-generated test user#1232
mahdi2ba wants to merge 5 commits into
Greenstand:keycloakfrom
mahdi2ba:feat/pr-e2e-ci

Conversation

@mahdi2ba

Copy link
Copy Markdown
Collaborator

Description

Wires the existing WebdriverIO + Cucumber E2E suite into CI so it runs automatically on every pull request, and removes the suite's dependency on shared/hardcoded test credentials by generating a unique Keycloak user per scenario
Specifically:

  • New workflow .github/workflows/treetracker-frontend-e2e-pr.yml ("E2E Tests"): starts the app, runs the suite headless in Chrome on every PR (+ manual dispatch), and uploads the Allure HTML report and the run video as a downloadable artifact.
  • New helper features/support/testUser.js: registers a fresh unique user (treetracker-bdd-<timestamp>-<random>) through the Keycloak sign-up page per run,and remembers it for later steps in the same scenario.
  • De-hardcoded the login, registration, change-password, update-account and organization steps to use that generated user instead of a fixed committed account.
  • Un-skipped the login scenarios (they now register → log out → log back in).
  • admin.feature: the one scenario needing the greenstand-admin role reads its credentials from BDD_GREENSTAND_ADMIN_USERNAME / BDD_GREENSTAND_ADMIN_PASSWORD secrets and skips cleanly when they're absent (e.g. on fork PRs).
  • wdio.conf.js made CI-ready: CHROMEDRIVER_PATH / headless via env vars, safe video-capture fallback when ffmpeg is missing, and disableWebdriverStepsReporting: true so typed passwords are never written into the uploaded report.
  • README.md documents the CI workflow and the env vars used.

Issue(s) addressed

What kind of change(s) does this PR introduce?

  • Enhancement
  • Bug fix
  • Refactor

Please check if the PR fulfils these requirements

  • The commit message follows our guidelines (conventional commits — ci:)
  • Tests for the changes have been added (this PR is the E2E test automation itself)
  • Docs have been added / updated (README CI section)

Issue

What is the current behavior?

The WebdriverIO + Cucumber E2E suite exists under features/ but is never executed in CI — the PR pipeline only runs lint, build and Jest unit tests. The suite also depends on a shared account whose username/password are hardcoded in plain text in the feature/step files, and the login/registration scenarios are disabled with @skip.

What is the new behavior?

The E2E suite runs automatically on every pull request (headless Chrome) and publishes its report + video as an artifact. Each scenario provisions its own disposable Keycloak user at runtime, so there are no shared/hardcoded credentials; the previously skipped scenarios no run. The privileged admin scenario is driven by repository secrets and skips gracefully when they aren't available.

Breaking change

Does this PR introduce a breaking change?

No. The change is additive — a new, non-blocking CI check plus test-suite refactoring.
There are no application (src/) code changes.

Other useful information

  • The E2E check is intentionally informational (non-blocking) for now; it can be promoted to a required check later (note the paths filter first — see the workflow file).
  • CHROMEDRIVER_PATH is set automatically in CI; local-run instructions are in the README.
  • Out of scope (follow-up): removing the ~2.7 GB of committed reports/ and publishing
    the report + video to a live GitHub Pages URL are intentionally left for a separate PR.

@mahdi2ba
mahdi2ba requested a review from a team as a code owner July 25, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant