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:
| Suite | Covers | Runs against |
|---|---|---|
apps/open-ent-e2e/src/modules/NN_<module>/ | One application per numbered directory, replayed for each member role through Playwright projects | http://localhost:8090, or the target URL |
apps/dashboard-e2e/src/modules/NN_<domain>/ | The screens of the administration console | http://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" }
]
}
]
}
| Field | Meaning |
|---|---|
status | passing, failing, partial, or pending when no spec of the module has run yet |
artifact | The module the tests cover, as named in the build artifacts |
section | apps for the application suite, dashboard for the administration console suite |
run_url | Filled 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. Setent_base_urlanddashboard_base_urlto the platform under test; alocalhostaddress is not reachable from the runner.run_open_ent_e2eandrun_dashboard_e2elimit the run to one suite. - It needs the secrets
E2E_ADMIN_USERandE2E_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. --refselects 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:
| Variable | Role | Default |
|---|---|---|
ENT_URL | URL of the platform under test | http://localhost:8090 |
ENT_USER, ENT_PASSWORD | Instructor account, the standard member of the specs | The sample instructor account |
ENT_ADMIN_USER, ENT_ADMIN_PASS | Platform administrator account, for administration actions | The 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:
| Job | Trigger | Scope |
|---|---|---|
smoke | Every push and pull request | Checks that the test platform answers, authenticates and serves the portal |
full-e2e | On demand | Runs 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.