Add Playwright end-to-end tests#3441
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces Playwright-based end-to-end testing infrastructure for the Web UI, adds initial downtime-management E2E coverage (with API mocking), and wires the tests into GitHub Actions.
Changes:
- Add Playwright configuration/scripts and an initial cross-service “downtime” E2E test suite (shared tests + page object + API mocks).
- Update Web UI components/types to support stable E2E selectors and new API fields.
- Add a GitHub Actions workflow to build Pelican binaries and run Playwright tests per-service.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| web_ui/frontend/types.ts | Extends DowntimeGet type to include deletedAt. |
| web_ui/frontend/playwright.config.ts | Adds Playwright config, dotenv loading, and per-service projects. |
| web_ui/frontend/package.json | Adds Playwright + dotenv dev deps and e2e-related scripts. |
| web_ui/frontend/package-lock.json | Locks Playwright/dotenv and updates transitive dependencies. |
| web_ui/frontend/jest.config.js | Excludes e2e/ from Jest test discovery. |
| web_ui/frontend/e2e/shared_tests/downtimeTests.ts | Implements shared downtime tests reused across services. |
| web_ui/frontend/e2e/shared_pages/DowntimePage.ts | Adds shared page object for downtime UI interactions. |
| web_ui/frontend/e2e/README.md | Documents how to run/configure Playwright E2E tests. |
| web_ui/frontend/e2e/origin/pages/OriginDowntimePage.ts | Adds an origin-specific page object (currently unused). |
| web_ui/frontend/e2e/origin/downtime.spec.ts | Registers shared downtime tests for origin. |
| web_ui/frontend/e2e/mocks/api/v1.0/downtime/get.ts | Adds GET downtime fixtures and a helper route mock. |
| web_ui/frontend/e2e/mocks/api/v1.0/downtime/crud.ts | Adds stateful CRUD API mocking for downtime endpoints. |
| web_ui/frontend/e2e/cache/downtime.spec.ts | Registers shared downtime tests for cache. |
| web_ui/frontend/docker-compose.yml | Updates local build/run commands for Pelican binaries/server. |
| web_ui/frontend/components/Downtime/Card.tsx | Adds data-testid/attributes and improves edit button accessibility for E2E. |
| web_ui/frontend/.gitignore | Ignores Playwright outputs and local e2e .env. |
| .github/workflows/test-webui-e2e.yml | Adds CI workflow to build Pelican and run Playwright E2E tests per service. |
Files not reviewed (1)
- web_ui/frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@CannonLock Could you fix the failed tests? Seems like they are not those flaky ones. |
- Adds playwright - Templates for future tests - Automates test running Signed-off-by: clock <clock@wisc.edu>
h2zh
left a comment
There was a problem hiding this comment.
This is a nice testing framework for webUI and a big step for Pelican! There are a few places worth a second look.
| * Intercepts GET /api/v1.0/downtime and returns the provided fixture. | ||
| * Defaults to a two-entry list with one scheduled and one indefinite downtime. | ||
| */ | ||
| export async function mockGetDowntime( |
There was a problem hiding this comment.
This function is not being used anywhere.
| this.submitButton = this.modal.getByRole('button', { name: 'Submit' }); | ||
| this.closeModalButton = this.modal.getByRole('button').first(); | ||
|
|
||
| this.editModal = page.getByRole('presentation').filter({ |
There was a problem hiding this comment.
editModal duplicates modal on line 68. Could you explain why?
| - `cache`: Tests running against the Cache service | ||
| - `director`: Tests running against the Director service | ||
| - `registry`: Tests running against the Registry service | ||
| - `federation`: Tests that span multiple services (e.g. Origin + Cache) |
There was a problem hiding this comment.
I can't find this project in playwright.config.ts
| registry/ | ||
| pages/ | ||
| *.spec.ts | ||
| ``` |
There was a problem hiding this comment.
shared_pages, shared_tests direcotries are missing in this doc
| Capabilities: | ||
| - Reads | ||
| - Listings | ||
| EOF |
There was a problem hiding this comment.
To fix the current failed CI
Cannot create token, failed to initialize configuration: no discovery endpoint was resolved;
ensure Federation.DiscoveryUrl or Federation.DirectorUrl is configured
I think we should add the Federation.DiscoveryUrl here
| EOF | |
| Federation: | |
| DiscoveryUrl: https://localhost:8444 | |
| EOF |
| fi | ||
| health_ok=false | ||
| key_ok=false | ||
| curl -sk https://localhost:8444/api/v1.0/health > /dev/null 2>&1 && health_ok=true |
There was a problem hiding this comment.
It would be nice to also wait for director's metadata-publish step. What do you think?
curl -sk https://localhost:8444/.well-known/pelican-configuration > /dev/null && meta_ok=true
@h2zh This is just the start of the tests to get a base in to build on.