diff --git a/scripts/aut-1-capture-hover-preview.mjs b/scripts/aut-1-capture-hover-preview.mjs new file mode 100644 index 00000000..2404b0fb --- /dev/null +++ b/scripts/aut-1-capture-hover-preview.mjs @@ -0,0 +1,142 @@ +#!/usr/bin/env node +// AUT-1 smoke run — capture the before/after visual diff for the +// `primary-button hover state` change in `src/assets/main.css`. +// +// Renders tests/visual-previews/AUT-1/preview.html in a real Chromium +// against the project's bundled Bulma stylesheet, then takes two +// screenshots: +// +// desktop-before.png — Bulma defaults, button idle (no hover effect). +// desktop-after.png — With the AUT-1 CSS rules applied, button +// hovered (lift + brightness shift visible). +// mobile-before.png — Same as desktop-before, captured at the +// Pixel 5 viewport. +// mobile-after.png — Same as desktop-after, captured at the +// Pixel 5 viewport. +// +// Output is written to tests/visual-previews/AUT-1/. The script is +// idempotent: existing files are overwritten, not appended to. +// +// Invoke with: `node scripts/aut-1-capture-hover-preview.mjs` +// (Chromium must already be installed via `npm run test:e2e:install`.) + +import { chromium } from "playwright"; +import { promises as fs } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, ".."); +const PREVIEW_HTML = path.join( + REPO_ROOT, + "tests/visual-previews/AUT-1/preview.html", +); +const OUTPUT_DIR = path.join(REPO_ROOT, "tests/visual-previews/AUT-1"); + +// The AUT-1 hover rules — kept in lockstep with the diff in +// src/assets/main.css. We inject these via a + +
+