Files
sencho/e2e/screenshots.spec.ts
Anso 1115650e78 chore(ci): drop auto screenshot refresh job, switch to manual capture (#884)
The release-only `update-screenshots` job opened a `chore/refresh-screenshots`
PR and immediately tried to squash-merge it. Branch protection (1 review,
6 status checks) rejected the merge on every release, leaving an open PR
behind. Screenshots will instead be refreshed manually after UI changes.

Removed:
- The `update-screenshots` job from ci.yml (~57 lines).
- The `paths-ignore: docs/images/**` push trigger filter; its sole purpose
  was to break the auto-merge re-trigger cascade. Its absence also fixes a
  latent bug where docs-only pushes to main would have skipped sync-docs.
- Four `head_ref != 'chore/refresh-screenshots'` guards in other jobs.
- The "doc screenshots" mention in the skip-bot-PRs comment.

Reworked the screenshot capture spec to be opt-in:
- playwright.config.ts now defines two projects. The default `chromium`
  project ignores screenshots.spec.ts; a separate `screenshots` project
  matches it and is invoked manually.
- The e2e CI job runs `--project=chromium` so the screenshots project
  cannot accidentally run in CI.
- Updated the spec's module comment with the new manual invocation.

Net: 86 lines removed, 27 added.
2026-05-02 15:57:45 -04:00

54 lines
1.8 KiB
TypeScript

/**
* Docs screenshot capture.
*
* Takes canonical screenshots of key UI views and writes them to docs/images/.
* Run manually after a UI change that affects a documented view:
* npx playwright test --project=screenshots
* Then review the diff under docs/images/ and commit on a chore branch.
* The default `playwright test` invocation skips this spec via the
* project-level testIgnore in playwright.config.ts.
*/
import * as fs from 'fs';
import * as path from 'path';
import { test } from '@playwright/test';
import { loginAs } from './helpers';
const DOCS_IMAGES = path.resolve(__dirname, '../docs/images');
test.use({
viewport: { width: 1280, height: 800 },
// Always capture - this spec exists solely to produce screenshots
screenshot: 'on',
});
test.beforeAll(() => {
fs.mkdirSync(DOCS_IMAGES, { recursive: true });
});
test('login page', async ({ page }) => {
await page.context().clearCookies();
await page.goto('/');
await page.waitForTimeout(600);
await page.screenshot({ path: path.join(DOCS_IMAGES, 'login.png'), fullPage: true });
});
test('dashboard', async ({ page }) => {
await loginAs(page);
// Wait for stats widgets to settle
await page.waitForTimeout(1_000);
await page.screenshot({ path: path.join(DOCS_IMAGES, 'dashboard.png'), fullPage: true });
});
test('stacks', async ({ page }) => {
await loginAs(page);
await page.getByRole('button', { name: 'Create Stack' }).waitFor({ timeout: 10_000 });
await page.screenshot({ path: path.join(DOCS_IMAGES, 'stacks.png'), fullPage: true });
});
test('resources', async ({ page }) => {
await loginAs(page);
await page.getByRole('button', { name: /resources/i }).click();
await page.waitForTimeout(800);
await page.screenshot({ path: path.join(DOCS_IMAGES, 'resources.png'), fullPage: true });
});