test: exhaustive Playwright E2E tests for emu UI#54
Open
Conversation
Add comprehensive E2E test suite covering: - Page load and plugin accessibility (9 tests) - Adversary emulation plan listing and API verification (6 tests) - Navigation to abilities/adversaries pages and back (5 tests) - Error states: API failures, network timeouts, empty data (8 tests) Tests run against a live Caldera instance via CALDERA_URL env var (default http://localhost:8888) with Chromium and Firefox projects.
|
There was a problem hiding this comment.
Pull request overview
Adds a comprehensive Playwright E2E test suite for the Emu plugin UI, covering page load, emulation plan listing, navigation flows, and error/edge-case handling across Chromium and Firefox.
Changes:
- New Playwright config, package.json, and shared auth fixture for Caldera login
- 4 spec files with 28 tests covering page load/accessibility, emulation plan listing with API verification, navigation flows, and error state handling
- Test infrastructure with env-var-driven base URL and CI-aware configuration
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tests/e2e/playwright.config.ts |
Playwright configuration with Chromium/Firefox projects, CI retries, and CALDERA_URL support |
tests/e2e/package.json |
Package definition with Playwright dependency and test scripts |
tests/e2e/fixtures/caldera-auth.ts |
Shared fixture handling Caldera login for authenticated page tests |
tests/e2e/specs/emu-page-load.spec.ts |
9 tests for plugin nav, heading, description, counts, and buttons |
tests/e2e/specs/emu-emulation-plans.spec.ts |
6 tests for ability/adversary counts, navigation, and API response validation |
tests/e2e/specs/emu-navigation.spec.ts |
5 tests for abilities/adversaries page navigation, return flow, and count preservation |
tests/e2e/specs/emu-error-states.spec.ts |
8 tests for API 500, network abort, empty data, and non-emu filtering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const emuAdversaries = adversaries.filter( | ||
| (a: any) => a.plugin === "emu" | ||
| ); | ||
| expect(emuAdversaries.length).toBeGreaterThanOrEqual(0); |
|
|
||
| const initialAbilityText = await abilitiesCount.textContent(); | ||
|
|
||
| // Navigate away and back |
Comment on lines
+64
to
+69
| const abilitiesResponse = await page.waitForResponse( | ||
| (response) => | ||
| response.url().includes("/api/v2/abilities") && | ||
| response.status() === 200, | ||
| { timeout: 20_000 } | ||
| ); |
Comment on lines
+85
to
+90
| const adversariesResponse = await page.waitForResponse( | ||
| (response) => | ||
| response.url().includes("/api/v2/adversaries") && | ||
| response.status() === 200, | ||
| { timeout: 20_000 } | ||
| ); |
| (a: any) => a.plugin === "emu" | ||
| ); | ||
| // There should be at least some emu abilities if the plugin is loaded | ||
| expect(emuAbilities.length).toBeGreaterThanOrEqual(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
CALDERA_URLenv var support (defaulthttp://localhost:8888)Test breakdown
emu-page-load.spec.tsemu-emulation-plans.spec.tsemu-navigation.spec.tsemu-error-states.spec.tsTest plan
cd tests/e2e && npm install && npx playwright install --with-deps chromium firefoxCALDERA_URL=http://localhost:8888 npx playwright test