mirror of
https://github.com/mgeeky/decode-spam-headers.git
synced 2026-02-22 05:23:31 +01:00
MAESTRO: add browser cache e2e test
This commit is contained in:
@@ -73,7 +73,7 @@ All tasks in this phase are parallelizable [P] since they are independent E2E sp
|
|||||||
- [x] T056 [P] Create `frontend/e2e/file-drop.spec.ts` — test US1 file drop flow: dispatch synthetic DataTransfer+drop events on drop zone with `.eml` fixture → verify textarea auto-populates with header content → click Analyse → verify report renders. Test rejection of unsupported file types (e.g., `.pdf`)
|
- [x] T056 [P] Create `frontend/e2e/file-drop.spec.ts` — test US1 file drop flow: dispatch synthetic DataTransfer+drop events on drop zone with `.eml` fixture → verify textarea auto-populates with header content → click Analyse → verify report renders. Test rejection of unsupported file types (e.g., `.pdf`)
|
||||||
- [x] T057 [P] Create `frontend/e2e/test-selection.spec.ts` — test US2: open test selector → verify 106+ tests listed → click Deselect All → select 3 specific tests → analyse → verify only 3 results in report. Test search/filter narrows visible tests. Test DNS and decode-all toggle states persist through analysis
|
- [x] T057 [P] Create `frontend/e2e/test-selection.spec.ts` — test US2: open test selector → verify 106+ tests listed → click Deselect All → select 3 specific tests → analyse → verify only 3 results in report. Test search/filter narrows visible tests. Test DNS and decode-all toggle states persist through analysis
|
||||||
- [x] T058 [P] Create `frontend/e2e/report-interaction.spec.ts` — test US4 report features: expand all cards → collapse all → search for a term → verify filtered results → clear search → export JSON → verify downloaded file is valid JSON. Export HTML → verify downloaded file contains styled content
|
- [x] T058 [P] Create `frontend/e2e/report-interaction.spec.ts` — test US4 report features: expand all cards → collapse all → search for a term → verify filtered results → clear search → export JSON → verify downloaded file is valid JSON. Export HTML → verify downloaded file contains styled content
|
||||||
- [ ] T059 [P] Create `frontend/e2e/browser-cache.spec.ts` — test US5: complete analysis → reload page → verify headers and results restored from cache → click Clear Cache → verify input and report cleared → reload → verify empty state
|
- [x] T059 [P] Create `frontend/e2e/browser-cache.spec.ts` — test US5: complete analysis → reload page → verify headers and results restored from cache → click Clear Cache → verify input and report cleared → reload → verify empty state
|
||||||
- [ ] T060 [P] Create `frontend/e2e/rate-limiting.spec.ts` — test US6 rate limiting flow: submit requests until 429 response → verify CAPTCHA modal appears → solve CAPTCHA → verify bypass token stored → retry original request succeeds. Test that the CAPTCHA modal is keyboard accessible and visually correct
|
- [ ] T060 [P] Create `frontend/e2e/rate-limiting.spec.ts` — test US6 rate limiting flow: submit requests until 429 response → verify CAPTCHA modal appears → solve CAPTCHA → verify bypass token stored → retry original request succeeds. Test that the CAPTCHA modal is keyboard accessible and visually correct
|
||||||
- [ ] T061 [P] Create `frontend/e2e/visual-regression.spec.ts` — screenshot-based visual testing at 4 viewports (320×568, 768×1024, 1280×720, 2560×1080). Capture: landing page (empty state), landing page with headers pasted, progress indicator active, report view with results expanded, hop chain visualisation. Use `expect(page).toHaveScreenshot()` with `animations: 'disabled'` and `mask` for dynamic content (timestamps, elapsed time). Baselines stored in `frontend/e2e/__snapshots__/`
|
- [ ] T061 [P] Create `frontend/e2e/visual-regression.spec.ts` — screenshot-based visual testing at 4 viewports (320×568, 768×1024, 1280×720, 2560×1080). Capture: landing page (empty state), landing page with headers pasted, progress indicator active, report view with results expanded, hop chain visualisation. Use `expect(page).toHaveScreenshot()` with `animations: 'disabled'` and `mask` for dynamic content (timestamps, elapsed time). Baselines stored in `frontend/e2e/__snapshots__/`
|
||||||
- [ ] T062 [P] Create `frontend/e2e/accessibility.spec.ts` — WCAG 2.1 AA audit using `@axe-core/playwright`. Run `AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21aa']).analyze()` on: landing page (empty), landing page with input, report view, CAPTCHA modal (if rate-limited). Assert zero violations. Document any necessary exceptions with justification
|
- [ ] T062 [P] Create `frontend/e2e/accessibility.spec.ts` — WCAG 2.1 AA audit using `@axe-core/playwright`. Run `AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21aa']).analyze()` on: landing page (empty), landing page with input, report view, CAPTCHA modal (if rate-limited). Assert zero violations. Document any necessary exceptions with justification
|
||||||
|
|||||||
47
frontend/e2e/browser-cache.spec.ts
Normal file
47
frontend/e2e/browser-cache.spec.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
import fs from "fs/promises";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
import { AnalyzerPage } from "./pages/analyzer-page";
|
||||||
|
|
||||||
|
const headersPath = path.resolve(__dirname, "fixtures/sample-headers.txt");
|
||||||
|
|
||||||
|
test("browser cache restores analysis and clears on demand", async ({ page }) => {
|
||||||
|
const headers = await fs.readFile(headersPath, "utf8");
|
||||||
|
const analyzer = new AnalyzerPage(page);
|
||||||
|
|
||||||
|
await analyzer.goto();
|
||||||
|
await analyzer.pasteHeaders(headers);
|
||||||
|
await analyzer.clickAnalyse();
|
||||||
|
await analyzer.waitForResults();
|
||||||
|
|
||||||
|
const headerInput = page.getByRole("textbox", { name: "Header Input" });
|
||||||
|
const reportContainer = page.getByTestId("report-container");
|
||||||
|
|
||||||
|
await expect(headerInput).toHaveValue(headers);
|
||||||
|
await expect(reportContainer).toBeVisible();
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
await expect(headerInput).toHaveValue(headers);
|
||||||
|
await expect(reportContainer).toBeVisible();
|
||||||
|
await expect(page.getByText("Cached Result")).toBeVisible();
|
||||||
|
|
||||||
|
const clearCacheButton = page.getByRole("button", { name: "Clear Cache" });
|
||||||
|
await expect(clearCacheButton).toBeEnabled();
|
||||||
|
await analyzer.clearCache();
|
||||||
|
|
||||||
|
await expect(headerInput).toHaveValue("");
|
||||||
|
await expect(page.getByTestId("report-container")).toHaveCount(0);
|
||||||
|
await expect(page.getByText("Cached Result")).toHaveCount(0);
|
||||||
|
await expect(clearCacheButton).toBeDisabled();
|
||||||
|
await expect(
|
||||||
|
page.getByText("No cached analysis yet. Run an analysis to save this session."),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
await expect(headerInput).toHaveValue("");
|
||||||
|
await expect(page.getByTestId("report-container")).toHaveCount(0);
|
||||||
|
await expect(page.getByText("Cached Result")).toHaveCount(0);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user