Extend element registry and migrate all tests to semantic selectors

Phase 2 of element registry migration - eliminate hardcoded coordinates:

Element tracker additions:
- wxTreeCtrl items (clickTreeItem, findTreeItem)
- wxDataViewCtrl items and column headers
- wxPropertyGrid rows
- wxListBox items
- wxSpinButton arrows
- wxSlider thumb/track
- wxTextCtrl area
- wxSearchCtrl field
- wxAuiManager pane content areas
- wxCalendarCtrl dates

Test migrations:
- 24 test files updated to use element registry helpers
- Replaced coordinate-based clicks with semantic selectors
- Added find-hardcoded-coords.sh script for auditing

Remaining coordinates are legitimate (scroll positioning, drawing, test.fail blocks).

🤖 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-30 14:17:51 +01:00
commit 64142aa8de
27 changed files with 1710 additions and 839 deletions

View file

@ -1,5 +1,6 @@
// Specialized wxWidgets Controls Tests - Treebook, RearrangeCtrl, BitmapComboBox
import { test, expect, tryLoadApp } from './utils/fixtures';
import { clickByLabel, clickComboButton, selectComboItem, clickListboxItem } from './utils/element-tracker';
test.describe('Specialized wxWidgets Controls Tests', () => {
@ -37,13 +38,9 @@ test.describe('Specialized wxWidgets Controls Tests', () => {
await page.waitForTimeout(300);
const canvas = page.locator('#canvas');
const box = await canvas.boundingBox();
if (box) {
// Click on Display > Colors sub-page in tree
await page.mouse.click(box.x + 80, box.y + 180);
await page.waitForTimeout(200);
}
// Click on Colors sub-page in tree using element registry
await clickByLabel(page, 'Colors');
await page.waitForTimeout(200);
await page.screenshot({ path: 'test-results/specialized-03-treebook-subpage.png', fullPage: true });
});
@ -58,13 +55,9 @@ test.describe('Specialized wxWidgets Controls Tests', () => {
await page.waitForTimeout(300);
const canvas = page.locator('#canvas');
const box = await canvas.boundingBox();
if (box) {
// Click on Editing page
await page.mouse.click(box.x + 80, box.y + 220);
await page.waitForTimeout(200);
}
// Click on Editing page using element registry
await clickByLabel(page, 'Editing');
await page.waitForTimeout(200);
await page.screenshot({ path: 'test-results/specialized-04-treebook-expand.png', fullPage: true });
});
@ -79,13 +72,10 @@ test.describe('Specialized wxWidgets Controls Tests', () => {
await page.waitForTimeout(300);
const canvas = page.locator('#canvas');
const box = await canvas.boundingBox();
if (box) {
// Click on layer combo box to open dropdown
await page.mouse.click(box.x + 620, box.y + 110);
await page.waitForTimeout(300);
}
// Click on layer combo box to open dropdown using element tracking
const opened = await clickComboButton(page);
expect(opened, 'Should be able to open BitmapComboBox dropdown').toBe(true);
await page.waitForTimeout(300);
await page.screenshot({ path: 'test-results/specialized-05-bitmapcombo-dropdown.png', fullPage: true });
});
@ -100,16 +90,10 @@ test.describe('Specialized wxWidgets Controls Tests', () => {
await page.waitForTimeout(300);
const canvas = page.locator('#canvas');
const box = await canvas.boundingBox();
if (box) {
// Open combo dropdown
await page.mouse.click(box.x + 620, box.y + 110);
await page.waitForTimeout(200);
// Select B.Cu layer
await page.mouse.click(box.x + 620, box.y + 180);
await page.waitForTimeout(200);
}
// Select B.Cu layer using element tracking
const selected = await selectComboItem(page, 'B.Cu');
expect(selected, 'Should be able to select B.Cu from dropdown').toBe(true);
await page.waitForTimeout(200);
await page.screenshot({ path: 'test-results/specialized-06-bitmapcombo-select.png', fullPage: true });
});
@ -128,7 +112,7 @@ test.describe('Specialized wxWidgets Controls Tests', () => {
await page.screenshot({ path: 'test-results/specialized-07-rearrange-list.png', fullPage: true });
});
test('wxRearrangeCtrl Get Layer Order button works', async ({ page, testLogger }) => {
test('wxRearrangeCtrl Get Layer Status button works', async ({ page, testLogger }) => {
await page.goto('/standalone/specialized/specialized_test.html');
const loaded = await tryLoadApp(page);
if (!loaded) {
@ -138,13 +122,9 @@ test.describe('Specialized wxWidgets Controls Tests', () => {
await page.waitForTimeout(300);
const canvas = page.locator('#canvas');
const box = await canvas.boundingBox();
if (box) {
// Click Get Layer Order button
await page.mouse.click(box.x + 620, box.y + 480);
await page.waitForTimeout(200);
}
// Click Get Layer Status button using element registry
await clickByLabel(page, 'Get Layer Status');
await page.waitForTimeout(200);
await page.screenshot({ path: 'test-results/specialized-08-get-order.png', fullPage: true });
});