2025-11-29 16:19:13 +01:00
|
|
|
// wxAuiManager Tests - AUI docking system KiCad uses extensively
|
2025-11-29 20:54:54 +01:00
|
|
|
import { test, expect, MAIN_CANVAS, tryLoadApp, getCanvasBox } from './utils/fixtures';
|
2025-12-30 14:17:51 +01:00
|
|
|
import { clickAuiButton, clickAuiPaneContent, findRenderedByLabel, findRenderedByType } from './utils/element-tracker';
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
test.describe('wxAuiManager Tests', () => {
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('AUI test app loads successfully', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
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 });
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
const hasStartup = testLogger.consoleLogs.some(l => l.includes('AUI test app started'));
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
expect(loaded, 'AUI app should load').toBe(true);
|
2025-11-29 20:54:54 +01:00
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('AUI dockable panels are visible', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/aui-02-panels.png', fullPage: true });
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
const hasPanelsLog = testLogger.consoleLogs.some(l => l.includes('dockable panels'));
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
expect(hasPanelsLog).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Panel close button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
Migrate tests to use rendered element registry for toolbar, menu, layout, and AUI tests
Update tests to use semantic identifiers instead of hardcoded pixel positions:
- toolbar.spec.ts: Use clickToolbarTool('New') instead of click(box.x + 30, box.y + 45)
- menu.spec.ts: Use clickMenuBarItem('File') instead of click(box.x + 30, box.y + 15)
- layout.spec.ts: Use getSplitterSash() to get actual sash position for drag operations
- aui.spec.ts: Use clickAuiButton('close', 'Properties') for panel button clicks
Also extends element-tracker.ts with:
- WxRenderedElement interface for toolbar tools, menu items, sashes, AUI parts
- findRenderedByLabel(), findRenderedByType() query functions
- clickToolbarTool(), clickMenuBarItem(), getSplitterSash(), clickAuiButton() helpers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:06:54 +01:00
|
|
|
// Find all AUI parts to verify they're registered
|
|
|
|
|
const auiParts = await findRenderedByType(page, 'auipart');
|
|
|
|
|
expect(auiParts.length, 'Should have AUI parts registered').toBeGreaterThan(0);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
Migrate tests to use rendered element registry for toolbar, menu, layout, and AUI tests
Update tests to use semantic identifiers instead of hardcoded pixel positions:
- toolbar.spec.ts: Use clickToolbarTool('New') instead of click(box.x + 30, box.y + 45)
- menu.spec.ts: Use clickMenuBarItem('File') instead of click(box.x + 30, box.y + 15)
- layout.spec.ts: Use getSplitterSash() to get actual sash position for drag operations
- aui.spec.ts: Use clickAuiButton('close', 'Properties') for panel button clicks
Also extends element-tracker.ts with:
- WxRenderedElement interface for toolbar tools, menu items, sashes, AUI parts
- findRenderedByLabel(), findRenderedByType() query functions
- clickToolbarTool(), clickMenuBarItem(), getSplitterSash(), clickAuiButton() helpers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:06:54 +01:00
|
|
|
// Click on Properties panel close button using element registry
|
|
|
|
|
const clicked = await clickAuiButton(page, 'close', 'Properties');
|
|
|
|
|
expect(clicked, 'Properties close button should be found and clicked').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(500);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/aui-03-close-clicked.png', fullPage: true });
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Panel can be dragged', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
const box = await getCanvasBox(page);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
Migrate tests to use rendered element registry for toolbar, menu, layout, and AUI tests
Update tests to use semantic identifiers instead of hardcoded pixel positions:
- toolbar.spec.ts: Use clickToolbarTool('New') instead of click(box.x + 30, box.y + 45)
- menu.spec.ts: Use clickMenuBarItem('File') instead of click(box.x + 30, box.y + 15)
- layout.spec.ts: Use getSplitterSash() to get actual sash position for drag operations
- aui.spec.ts: Use clickAuiButton('close', 'Properties') for panel button clicks
Also extends element-tracker.ts with:
- WxRenderedElement interface for toolbar tools, menu items, sashes, AUI parts
- findRenderedByLabel(), findRenderedByType() query functions
- clickToolbarTool(), clickMenuBarItem(), getSplitterSash(), clickAuiButton() helpers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:06:54 +01:00
|
|
|
// Get Properties panel caption using element registry
|
|
|
|
|
const caption = await findRenderedByLabel(page, 'Properties', { elementType: 'auipart', subType: 'caption' });
|
|
|
|
|
expect(caption, 'Properties caption should be found in registry').not.toBeNull();
|
2025-11-29 16:19:13 +01:00
|
|
|
|
Migrate tests to use rendered element registry for toolbar, menu, layout, and AUI tests
Update tests to use semantic identifiers instead of hardcoded pixel positions:
- toolbar.spec.ts: Use clickToolbarTool('New') instead of click(box.x + 30, box.y + 45)
- menu.spec.ts: Use clickMenuBarItem('File') instead of click(box.x + 30, box.y + 15)
- layout.spec.ts: Use getSplitterSash() to get actual sash position for drag operations
- aui.spec.ts: Use clickAuiButton('close', 'Properties') for panel button clicks
Also extends element-tracker.ts with:
- WxRenderedElement interface for toolbar tools, menu items, sashes, AUI parts
- findRenderedByLabel(), findRenderedByType() query functions
- clickToolbarTool(), clickMenuBarItem(), getSplitterSash(), clickAuiButton() helpers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:06:54 +01:00
|
|
|
// Drag panel title bar using registry coordinates
|
|
|
|
|
await page.mouse.move(caption!.centerX, caption!.centerY);
|
2025-11-29 16:19:13 +01:00
|
|
|
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 });
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Multiple panels can be interacted with', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/aui/aui_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click in Properties panel using element tracking
|
|
|
|
|
const propsClicked = await clickAuiPaneContent(page, 'Properties');
|
|
|
|
|
expect(propsClicked, 'Should be able to click Properties pane').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(200);
|
|
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click in Layers panel using element tracking
|
|
|
|
|
const layersClicked = await clickAuiPaneContent(page, 'Layers');
|
|
|
|
|
expect(layersClicked, 'Should be able to click Layers pane').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(200);
|
|
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click in Messages panel using element tracking
|
|
|
|
|
const messagesClicked = await clickAuiPaneContent(page, 'Messages');
|
|
|
|
|
expect(messagesClicked, 'Should be able to click Messages pane').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(200);
|
|
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click in Event Log panel using element tracking
|
|
|
|
|
const eventLogClicked = await clickAuiPaneContent(page, 'Event Log');
|
|
|
|
|
expect(eventLogClicked, 'Should be able to click Event Log pane').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(200);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/aui-05-multi-panel.png', fullPage: true });
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
});
|