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:
parent
04eebab024
commit
64142aa8de
27 changed files with 1710 additions and 839 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// wxCalendarCtrl Tests - Date selection
|
||||
import { test, expect, tryLoadApp } from './utils/fixtures';
|
||||
import { clickByLabel, clickCalendarDate } from './utils/element-tracker';
|
||||
|
||||
test.describe('wxCalendarCtrl Tests', () => {
|
||||
|
||||
|
|
@ -23,13 +24,10 @@ test.describe('wxCalendarCtrl Tests', () => {
|
|||
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
const canvas = page.locator('#canvas');
|
||||
const box = await canvas.boundingBox();
|
||||
if (box) {
|
||||
// Click on a day in the calendar
|
||||
await page.mouse.click(box.x + 150, box.y + 200);
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
// Click on day 15 in the calendar using element registry
|
||||
const clicked = await clickCalendarDate(page, 15);
|
||||
expect(clicked, 'Calendar date 15 should be found and clicked').toBe(true);
|
||||
await page.waitForTimeout(200);
|
||||
|
||||
await page.screenshot({ path: 'test-results/calendar-02-select-date.png', fullPage: true });
|
||||
});
|
||||
|
|
@ -44,13 +42,10 @@ test.describe('wxCalendarCtrl Tests', () => {
|
|||
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
const canvas = page.locator('#canvas');
|
||||
const box = await canvas.boundingBox();
|
||||
if (box) {
|
||||
// Click Next Month button
|
||||
await page.mouse.click(box.x + 480, box.y + 170);
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
// Click Next Month button using element registry
|
||||
const clicked = await clickByLabel(page, 'Next Month');
|
||||
expect(clicked, 'Next Month button should be found').toBe(true);
|
||||
await page.waitForTimeout(200);
|
||||
|
||||
await page.screenshot({ path: 'test-results/calendar-03-next-month.png', fullPage: true });
|
||||
});
|
||||
|
|
@ -65,13 +60,10 @@ test.describe('wxCalendarCtrl Tests', () => {
|
|||
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
const canvas = page.locator('#canvas');
|
||||
const box = await canvas.boundingBox();
|
||||
if (box) {
|
||||
// Click Previous Month button
|
||||
await page.mouse.click(box.x + 480, box.y + 200);
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
// Click Previous Month button using element registry
|
||||
const clicked = await clickByLabel(page, 'Previous Month');
|
||||
expect(clicked, 'Previous Month button should be found').toBe(true);
|
||||
await page.waitForTimeout(200);
|
||||
|
||||
await page.screenshot({ path: 'test-results/calendar-04-prev-month.png', fullPage: true });
|
||||
});
|
||||
|
|
@ -86,16 +78,15 @@ test.describe('wxCalendarCtrl Tests', () => {
|
|||
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
const canvas = page.locator('#canvas');
|
||||
const box = await canvas.boundingBox();
|
||||
if (box) {
|
||||
// First go to next month
|
||||
await page.mouse.click(box.x + 480, box.y + 170);
|
||||
await page.waitForTimeout(100);
|
||||
// Click Today button
|
||||
await page.mouse.click(box.x + 480, box.y + 140);
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
// First go to next month
|
||||
const nextClicked = await clickByLabel(page, 'Next Month');
|
||||
expect(nextClicked, 'Next Month button should be found').toBe(true);
|
||||
await page.waitForTimeout(100);
|
||||
|
||||
// Click Today button using element registry
|
||||
const todayClicked = await clickByLabel(page, 'Today');
|
||||
expect(todayClicked, 'Today button should be found').toBe(true);
|
||||
await page.waitForTimeout(200);
|
||||
|
||||
await page.screenshot({ path: 'test-results/calendar-05-today.png', fullPage: true });
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue