Skip to content

test: exhaustive Playwright E2E tests for emu UI#54

Open
deacon-mp wants to merge 1 commit intomasterfrom
test/exhaustive-ui-e2e-tests
Open

test: exhaustive Playwright E2E tests for emu UI#54
deacon-mp wants to merge 1 commit intomasterfrom
test/exhaustive-ui-e2e-tests

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

Summary

  • Add comprehensive Playwright E2E test suite for the Emu plugin UI with 28 tests across 4 spec files
  • Tests cover page load/accessibility, emulation plan listing with API verification, navigation flows, and error/edge-case handling
  • Configured for Chromium + Firefox with CALDERA_URL env var support (default http://localhost:8888)
  • Includes shared auth fixture for Caldera login and reusable test infrastructure

Test breakdown

Spec file Tests
emu-page-load.spec.ts 9 — plugin nav, heading, description, counts, buttons
emu-emulation-plans.spec.ts 6 — ability/adversary counts, navigation, API response validation
emu-navigation.spec.ts 5 — abilities/adversaries page nav, return flow, count preservation
emu-error-states.spec.ts 8 — API 500, network abort, empty data, non-emu filtering

Test plan

  • Install deps: cd tests/e2e && npm install && npx playwright install --with-deps chromium firefox
  • Start Caldera with emu plugin enabled
  • Run: CALDERA_URL=http://localhost:8888 npx playwright test
  • Verify all 28 tests pass on both Chromium and Firefox

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.
@deacon-mp deacon-mp requested a review from Copilot March 16, 2026 14:52
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
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.

2 participants