- Extract common logging code to tests/e2e/utils/ - fixtures.ts: Playwright fixture with automatic log capture - test-utils.ts: Logging utilities and helper functions - Each test now automatically captures: - Console logs with timestamps and log levels - Page errors with full stack traces - Log files written per test to tests/logs/ - <test-name>.log for all console output - <test-name>.errors.log only when errors occur - Update all 13 spec files to use shared fixtures - Update README with test structure and logging docs - Net reduction of ~700 lines by removing duplicated code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
109 lines
3.4 KiB
TypeScript
109 lines
3.4 KiB
TypeScript
// wxAuiManager Tests - AUI docking system KiCad uses extensively
|
|
import { test, expect, MAIN_CANVAS, tryLoadApp, getCanvasBox } from './utils/fixtures';
|
|
|
|
test.describe('wxAuiManager Tests', () => {
|
|
|
|
test('AUI test app loads successfully', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
|
|
await page.screenshot({ path: 'test-results/aui-01-loaded.png', fullPage: true });
|
|
|
|
const hasStartup = testLogger.consoleLogs.some(l => l.includes('AUI test app started'));
|
|
|
|
expect(loaded, 'AUI app should load').toBe(true);
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
});
|
|
|
|
test('AUI dockable panels are visible', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
await page.screenshot({ path: 'test-results/aui-02-panels.png', fullPage: true });
|
|
|
|
const hasPanelsLog = testLogger.consoleLogs.some(l => l.includes('dockable panels'));
|
|
|
|
expect(hasPanelsLog).toBe(true);
|
|
});
|
|
|
|
test('Panel close button can be clicked', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
const box = await getCanvasBox(page);
|
|
|
|
// Click on Properties panel close button (top right of left panel)
|
|
await page.mouse.click(box.x + 145, box.y + 35);
|
|
await page.waitForTimeout(500);
|
|
|
|
await page.screenshot({ path: 'test-results/aui-03-close-clicked.png', fullPage: true });
|
|
|
|
// Smoke test
|
|
expect(true).toBe(true);
|
|
});
|
|
|
|
test('Panel can be dragged', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
const box = await getCanvasBox(page);
|
|
|
|
// Drag Properties panel title bar
|
|
const titleX = box.x + 75;
|
|
const titleY = box.y + 35;
|
|
|
|
await page.mouse.move(titleX, titleY);
|
|
await page.mouse.down();
|
|
await page.mouse.move(box.x + 300, box.y + 200, { steps: 10 });
|
|
await page.mouse.up();
|
|
await page.waitForTimeout(500);
|
|
|
|
await page.screenshot({ path: 'test-results/aui-04-dragged.png', fullPage: true });
|
|
|
|
// Smoke test
|
|
expect(true).toBe(true);
|
|
});
|
|
|
|
test('Multiple panels can be interacted with', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
const box = await getCanvasBox(page);
|
|
|
|
// Click in Properties panel
|
|
await page.mouse.click(box.x + 75, box.y + 200);
|
|
await page.waitForTimeout(200);
|
|
|
|
// Click in Layers panel (right side)
|
|
await page.mouse.click(box.x + 720, box.y + 200);
|
|
await page.waitForTimeout(200);
|
|
|
|
// Click in Messages panel (bottom)
|
|
await page.mouse.click(box.x + 400, box.y + 550);
|
|
await page.waitForTimeout(200);
|
|
|
|
// Click in center (Event Log)
|
|
await page.mouse.click(box.x + 400, box.y + 300);
|
|
await page.waitForTimeout(200);
|
|
|
|
await page.screenshot({ path: 'test-results/aui-05-multi-panel.png', fullPage: true });
|
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
});
|
|
});
|