ui-ux-pro-max-skill/cli/tests/e2e/preview.spec.ts
Yassire 1b774be863 chore: repo health files, CI test wiring, and Playwright e2e smoke test
- Add SECURITY.md and CODE_OF_CONDUCT.md (community health was at 50%)
- Add bug/feature issue templates and a PR template
- Wire the existing pytest suite under .claude/skills/*/scripts/tests into
  a new CI workflow; the test docstrings claimed "the existing pytest CI
  runs them" but no workflow actually did
- Add @playwright/test to cli/ with a smoke test that loads the shipped
  preview/xiaomaomi-app.html and asserts no console errors
- Fix a malformed SVG path (invalid `d` attribute) in
  preview/xiaomaomi-app.html found by that new test, replacing it with
  the equivalent valid paw icon path already used elsewhere in the file
2026-07-03 21:25:03 -04:00

32 lines
1.2 KiB
TypeScript

import { test, expect } from '@playwright/test';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* Smoke test for the generated design-system preview pages under /preview.
* These files are shipped as proof that the design system generator produces
* working, self-contained HTML (see README "How Design System Generation Works").
* This guards against a preview shipping with broken markup or JS errors.
*/
const PREVIEW_DIR = path.resolve(__dirname, '../../../preview');
const PREVIEW_FILE = 'xiaomaomi-app.html';
test.describe('generated preview pages', () => {
test(`${PREVIEW_FILE} renders without console errors`, async ({ page }) => {
const consoleErrors: string[] = [];
page.on('console', (msg) => {
if (msg.type() === 'error') consoleErrors.push(msg.text());
});
page.on('pageerror', (err) => consoleErrors.push(err.message));
const fileUrl = pathToFileURL(path.join(PREVIEW_DIR, PREVIEW_FILE)).href;
await page.goto(fileUrl);
await expect(page.locator('body')).toBeVisible();
expect(consoleErrors, `console errors: ${consoleErrors.join('\n')}`).toHaveLength(0);
});
});