Replace hardcoded pixel coordinates with semantic element lookups in tests. The element registry (added to wxWidgets) tracks all wxWindow instances, enabling tests to find buttons by label text instead of pixel positions. Changes: - Add element-tracker.ts with clickByLabel, findByLabel, findByType, etc. - Migrate clipboard, dialog, timer, filedialog, logerror tests to use registry - Update fixtures.ts to export element-tracker utilities - Update README with element registry documentation - Update wxwidgets submodule with registry implementation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
98 lines
3.1 KiB
TypeScript
98 lines
3.1 KiB
TypeScript
// wxFileDialog Tests - File dialogs for KiCad open/save operations
|
|
// Uses element registry for semantic element identification
|
|
import { test, expect, tryLoadApp, waitForRegistry, clickByLabel } from './utils/fixtures';
|
|
|
|
test.describe('wxFileDialog Tests', () => {
|
|
|
|
test('FileDialog test app loads successfully', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-01-loaded.png', fullPage: true });
|
|
|
|
const hasStartup = testLogger.consoleLogs.some(l => l.includes('FileDialog test app started'));
|
|
|
|
expect(loaded, 'wxFileDialog app should load').toBe(true);
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
});
|
|
|
|
test('Open file button can be clicked', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
await waitForRegistry(page);
|
|
|
|
// Click "Open File..." button
|
|
await clickByLabel(page, 'Open File...');
|
|
await page.waitForTimeout(500);
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-02-open-clicked.png', fullPage: true });
|
|
|
|
expect(true).toBe(true); // Smoke test
|
|
});
|
|
|
|
test('Save file button can be clicked', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
await waitForRegistry(page);
|
|
|
|
// Click "Save File..." button
|
|
await clickByLabel(page, 'Save File...');
|
|
await page.waitForTimeout(500);
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-03-save-clicked.png', fullPage: true });
|
|
|
|
expect(true).toBe(true);
|
|
});
|
|
|
|
test('Open multiple button can be clicked', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
await waitForRegistry(page);
|
|
|
|
// Click "Open Multiple..." button
|
|
await clickByLabel(page, 'Open Multiple...');
|
|
await page.waitForTimeout(500);
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-04-multiple-clicked.png', fullPage: true });
|
|
|
|
expect(true).toBe(true);
|
|
});
|
|
|
|
test('All file dialog buttons accessible', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
const loaded = await tryLoadApp(page);
|
|
if (!loaded) {
|
|
test.skip();
|
|
return;
|
|
}
|
|
|
|
await waitForRegistry(page);
|
|
|
|
// Try all three buttons
|
|
await clickByLabel(page, 'Open File...');
|
|
await page.waitForTimeout(300);
|
|
await clickByLabel(page, 'Save File...');
|
|
await page.waitForTimeout(300);
|
|
await clickByLabel(page, 'Open Multiple...');
|
|
await page.waitForTimeout(300);
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-05-all-buttons.png', fullPage: true });
|
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
});
|
|
});
|