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>
This commit is contained in:
Viktor Vaczi 2025-12-29 13:06:54 +01:00
commit 04eebab024
6 changed files with 336 additions and 77 deletions

View file

@ -1,5 +1,6 @@
// wxAuiManager Tests - AUI docking system KiCad uses extensively
import { test, expect, MAIN_CANVAS, tryLoadApp, getCanvasBox } from './utils/fixtures';
import { clickAuiButton, findRenderedByLabel, findRenderedByType } from './utils/element-tracker';
test.describe('wxAuiManager Tests', () => {
@ -38,16 +39,16 @@ test.describe('wxAuiManager Tests', () => {
return;
}
const box = await getCanvasBox(page);
// 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);
// Click on Properties panel close button (top right of left panel)
await page.mouse.click(box.x + 145, box.y + 35);
// 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);
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 }) => {
@ -60,20 +61,18 @@ test.describe('wxAuiManager Tests', () => {
const box = await getCanvasBox(page);
// Drag Properties panel title bar
const titleX = box.x + 75;
const titleY = box.y + 35;
// 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();
await page.mouse.move(titleX, titleY);
// Drag panel title bar using registry coordinates
await page.mouse.move(caption!.centerX, caption!.centerY);
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 }) => {