Skip to main content

End-to-end tests

End-to-end tests replay what a member does in a browser, with Playwright.

What they check​

  • Complete journeys. Signing in, searching, creating and sharing a resource, from one screen to the next.
  • Integration. That the user interface, the server, the databases and the APIs work together.
  • Regressions across components. A change to a server API that breaks a journey without failing any unit test.
  • The interface itself. That it reacts to the member's actions as expected.

Where the tests live​

The Playwright tests are in the open-ent/open-ent-frontend repository, in two independent suites:

SuiteCoversRuns against
apps/open-ent-e2e/src/modules/NN_<module>/One application per numbered directory, replayed for each member role through Playwright projectshttp://localhost:8090, or the target URL
apps/dashboard-e2e/src/modules/NN_<domain>/The screens of the administration consolehttp://localhost:3001, or the target URL

Running the tests​

The script apps/open-ent-e2e/run-tests.sh runs the suite, accumulates the reports and regenerates the results file:

cd apps/open-ent-e2e
./run-tests.sh --project=enseignant # one role
./run-tests.sh --project=eleve --grep Blog
./run-tests.sh --merge # HTML report and cumulative results file

Project names are those declared in playwright.config.ts.

On each run, the accumulated blob reports are merged, then transformed by scripts/build-dashboard-json.mjs, which groups results by module directory and writes e2e-results.json. The script accepts the JSON reports of both suites (--in and --in-dashboard) and merges them into one file.

Results can be merged only when the run used the blob reporter. A run started with another reporter alone succeeds and leaves nothing to consolidate.

Results file​

{
"generated_at": "YYYY-MM-DD",
"source": { "repo": "open-ent/open-ent-frontend", "tool": "Playwright",
"run_url": null, "report_url": null },
"modules": [
{
"name": "Resource booking",
"folder": "35_reservation_ressources",
"section": "apps",
"e2e_app": "35_reservation_ressources",
"artifact": "rbs",
"status": "passing | failing | partial | pending",
"totals": { "passed": 3, "failed": 0, "skipped": 0, "total": 3 },
"specs": [
{ "file": "09_synchronisation_agenda.spec.ts",
"title": "...", "tests": 3, "status": "passing" }
]
}
]
}
FieldMeaning
statuspassing, failing, partial, or pending when no spec of the module has run yet
artifactThe module the tests cover, as named in the build artifacts
sectionapps for the application suite, dashboard for the administration console suite
run_urlFilled in automatically from the GITHUB_* variables when the run happens in continuous integration

Publication workflow​

The workflow deploy-e2e-to-ovh.yml of the open-ent repository runs both suites against a real URL, consolidates the results and publishes the HTML report and the results file.

  • It is started by hand only (workflow_dispatch), never on push. Set ent_base_url and dashboard_base_url to the platform under test; a localhost address is not reachable from the runner. run_open_ent_e2e and run_dashboard_e2e limit the run to one suite.
  • It needs the secrets E2E_ADMIN_USER and E2E_ADMIN_PASS, the platform administrator account of the target environment. Each test step continues on error, so a run without valid credentials ends as successful with no test having signed in.
  • --ref selects the branch whose workflow and specs are run. Without it, the default branch of the repository is used.
gh workflow run deploy-e2e-to-ovh.yml -R open-ent/open-ent \
--ref develop \
-f ent_base_url="https://openent.example.org" \
-f dashboard_base_url="https://openent.example.org" \
-f run_open_ent_e2e=true -f run_dashboard_e2e=true

Tests of the application modules​

The open-ent/open-ent-mods repository has its own end-to-end suite, with one spec file per module under tests/.

Target and accounts​

Each spec opens its own session on /auth/login. The target URL and the accounts come from environment variables, with development values as defaults, so a local run needs no setup:

VariableRoleDefault
ENT_URLURL of the platform under testhttp://localhost:8090
ENT_USER, ENT_PASSWORDInstructor account, the standard member of the specsThe sample instructor account
ENT_ADMIN_USER, ENT_ADMIN_PASSPlatform administrator account, for administration actionsThe sample administrator account

On a shared test platform, both accounts must exist with the right roles and application access.

Two levels in continuous integration​

The workflow .github/workflows/playwright.yml has two jobs:

JobTriggerScope
smokeEvery push and pull requestChecks that the test platform answers, authenticates and serves the portal
full-e2eOn demandRuns the whole suite against the test platform. The dashboard-embed-* specs, which also need the administration console at DASH_URL, are excluded unless it is provided.

The full-e2e job regenerates mods-e2e-results.json, which has the same structure as e2e-results.json.