pcbjam/tests/e2e/utils/fixtures.ts
Viktor Vaczi 0a093b918e Add element registry for semantic E2E test automation
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>
2025-12-29 12:11:33 +01:00

29 lines
1 KiB
TypeScript

import { test as base } from '@playwright/test';
import * as path from 'path';
import { setupTestLogger, writeTestLogs, TestLogger, MAIN_CANVAS, waitForApp, tryLoadApp, getCanvasBox, WXWIDGETS_LOGS_DIR, getTestFileName } from './test-utils';
// Extend base test with automatic logging
export const test = base.extend<{
testLogger: TestLogger;
}>({
testLogger: async ({ page }, use, testInfo) => {
// Build test name from describe block + test title
const testName = testInfo.titlePath.join(' - ');
const logger = setupTestLogger(page);
await use(logger);
// Write logs to wxwidgets/<test-file>/ directory
const testFileName = getTestFileName(testInfo.file);
const logsDir = path.join(WXWIDGETS_LOGS_DIR, testFileName);
writeTestLogs(testName, logger, logsDir);
logger.cleanup();
},
});
export { expect } from '@playwright/test';
export { MAIN_CANVAS, waitForApp, tryLoadApp, getCanvasBox };
// Element tracking utilities for semantic element identification
export * from './element-tracker';