72 lines
3.1 KiB
JavaScript
72 lines
3.1 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const root = process.cwd();
|
|
const workflowSource = () => readFileSync(join(root, ".github/workflows/tests.yml"), "utf8");
|
|
const networkFixtureSource = () => readFileSync(join(root, "tests/e2e/support/network.js"), "utf8");
|
|
|
|
describe("Playwright full E2E workflow grouping", () => {
|
|
it("orders full-suite matrix dimensions by browser, device, then role", () => {
|
|
const source = workflowSource();
|
|
|
|
expect(source).toContain("name: E2E-full-${{ matrix.browser_label }}-${{ matrix.device }}-${{ matrix.role }}");
|
|
expect(source).toContain("browser: [chromium, webkit, firefox]");
|
|
expect(source).toContain("device: [mobile, desktop, tablet]");
|
|
expect(source).toContain("role: [superuser, admin, customer, subuser]");
|
|
});
|
|
|
|
it("uses browser-device-role artifact namespaces and generated test lists", () => {
|
|
const source = workflowSource();
|
|
|
|
expect(source).toContain(
|
|
"PLAYWRIGHT_ARTIFACT_NAMESPACE: e2e-full-${{ matrix.browser }}-${{ matrix.device }}-${{ matrix.role }}"
|
|
);
|
|
expect(source).toContain(
|
|
"name: playwright-report-full-${{ matrix.browser }}-${{ matrix.device }}-${{ matrix.role }}"
|
|
);
|
|
expect(source).toContain(
|
|
"output/playwright/test-lists/${{ matrix.browser }}-${{ matrix.device }}-${{ matrix.role }}.txt"
|
|
);
|
|
});
|
|
|
|
it("keeps full-suite runner pressure bounded and diagnosable", () => {
|
|
const source = workflowSource();
|
|
|
|
expect(source).toMatch(/e2e-full:[\s\S]*?max-parallel: 2/u);
|
|
expect(source).toMatch(/e2e-full:[\s\S]*?PLAYWRIGHT_WORKERS: 1/u);
|
|
expect(source).toMatch(/e2e-full:[\s\S]*?PLAYWRIGHT_VIDEO_MODE: off/u);
|
|
expect(source).toContain("scripts/ci/with-systemd-inhibit.sh");
|
|
expect(source).toContain("scripts/ci/runner-diagnostics.sh");
|
|
});
|
|
|
|
it("keeps PR E2E runner pressure bounded and diagnosable", () => {
|
|
const source = workflowSource();
|
|
|
|
expect(source).toMatch(/e2e-pr:[\s\S]*?max-parallel: 4/u);
|
|
expect(source).toMatch(/e2e-pr:[\s\S]*?PLAYWRIGHT_WORKERS: 1/u);
|
|
expect(source).toMatch(/e2e-pr:[\s\S]*?PLAYWRIGHT_VIDEO_MODE: on-first-retry/u);
|
|
expect(source).toMatch(/e2e-pr:[\s\S]*?--env PLAYWRIGHT_WORKERS="\$PLAYWRIGHT_WORKERS"/u);
|
|
expect(source).toMatch(/e2e-pr:[\s\S]*?--env PLAYWRIGHT_VIDEO_MODE="\$PLAYWRIGHT_VIDEO_MODE"/u);
|
|
});
|
|
|
|
it("allows CI to reduce Playwright video artifact pressure", () => {
|
|
const source = readFileSync(join(root, "playwright.config.ts"), "utf8");
|
|
|
|
expect(source).toContain("PLAYWRIGHT_VIDEO_MODE");
|
|
expect(source).toContain('"retain-on-failure"');
|
|
expect(source).toContain('"on-first-retry"');
|
|
});
|
|
|
|
it("serves Font Awesome from local fixtures so external stylesheets cannot block page load", () => {
|
|
const source = networkFixtureSource();
|
|
|
|
expect(source).toContain("fixtures/fontawesome/6.7.1");
|
|
expect(source).toContain("FONT_AWESOME_CSS");
|
|
expect(source).toContain("FONT_AWESOME_WEBFONTS");
|
|
expect(source).toContain('contentType: "text/css"');
|
|
expect(source).toContain('contentType: "font/woff2"');
|
|
expect(source).toContain("body: FONT_AWESOME_CSS");
|
|
});
|
|
});
|