Files
claude-code-viewer/e2e/captureSnapshot/projects.ts
d-kimsuon c40b07ac83 refactor: replace e2e tests with screenshot capture system
- Delete all Playwright test files from e2e/tests/
- Create new screenshot capture system in e2e/captureSnapshot/
- Add unified execution script (index.ts) to run all captures
- Implement state-based snapshot organization:
  - snapshots/{page}/{state}/{device}.png structure
  - Multiple UI states per page (default, filters-expanded, sidebar-open, etc.)
- Support real session UUIDs and comprehensive page coverage
- Enable single-command execution: npx tsx e2e/captureSnapshot/index.ts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 14:39:11 +09:00

39 lines
1.0 KiB
TypeScript

import { resolve } from "node:path";
import { withPlaywright } from "../utils/withPlaywright";
import { testDevices } from "../testDevices";
// Test different states on projects page
const testStates = [
{ name: 'default', action: null },
{ name: 'empty', action: async (page) => {
// Check for empty state (this will capture whatever state exists)
await page.waitForTimeout(500);
}}
];
for (const state of testStates) {
for (const { device, name } of testDevices) {
await withPlaywright(
async ({ context, cleanUp }) => {
const page = await context.newPage();
await page.goto("http://localhost:3400/projects");
await page.waitForLoadState('networkidle');
if (state.action) {
await state.action(page);
}
await page.screenshot({
path: resolve("e2e", "snapshots", "projects", state.name, `${name}.png`),
fullPage: true,
});
await cleanUp();
},
{
contextOptions: {
...device,
},
},
);
}
}