feat(test): Update wizard test to use dynamic button labels
- Test now correctly finds "Finish" button on last wizard page - Added CLAUDE.md note about running e2e tests via npm scripts - Simplified test to click through wizard with proper button detection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
014816b7a5
commit
528ed97692
4 changed files with 42 additions and 23 deletions
|
|
@ -10,6 +10,7 @@ The test have screenshots that are tracked with git, use compare-screenshots.sh
|
|||
Update test images with /scripts/update-baseline-screenshots.sh when a new image is added
|
||||
The tests have log files in tests/logs/{wxwidgets/kicad}/{test-name} after each run where the js console and cpp logs are visible
|
||||
Always check screenshots for validating tests
|
||||
Run e2e tests from /tests folder: `npm run test:kicad` or `npm run test:e2e` (not playwright directly)
|
||||
|
||||
Build wxwidgets with scripts/build-wxuniversal-wasm.sh
|
||||
Build kicad with docker/build.sh
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Emscripten LEGACY_GL_EMULATION - Immediate Mode Notes
|
||||
Wha# Emscripten LEGACY_GL_EMULATION - Immediate Mode Notes
|
||||
|
||||
## Overview
|
||||
|
||||
|
|
|
|||
|
|
@ -1,39 +1,57 @@
|
|||
import { test, expect } from './fixtures';
|
||||
import { clickByLabel, dumpElements } from '../e2e/utils/element-tracker';
|
||||
|
||||
/**
|
||||
* PCBnew WASM E2E Tests
|
||||
*
|
||||
* These tests verify that the KiCad PCBnew application runs correctly in the browser.
|
||||
* The WASM files are served from apps/kicad/ via the web server.
|
||||
*
|
||||
* Logs are written to tests/logs/:
|
||||
* - {test-name}.log - console output
|
||||
* - {test-name}.errors.log - page errors (if any)
|
||||
*/
|
||||
|
||||
test.describe('PCBnew WASM', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Navigate to PCBnew via web server (apps/kicad/pcbnew.html)
|
||||
await page.goto('/kicad/pcbnew.html');
|
||||
});
|
||||
|
||||
test('should load PCBnew WASM module', async ({ page, testLogger }) => {
|
||||
test('click through setup wizard to load PCBnew', async ({ page, testLogger }) => {
|
||||
// Wait for main canvas to be visible (KiCad takes time to initialize)
|
||||
await expect(page.locator('#canvas')).toBeVisible({ timeout: 90000 });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Verify multiple canvases are created (11 for setup wizard)
|
||||
// Screenshot initial wizard state
|
||||
await page.screenshot({ path: 'test-results/wizard-00-initial.png' });
|
||||
|
||||
// Click through wizard - try Next >, then Finish if not found
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
// Dump buttons before clicking to see what's available
|
||||
console.log(`Step ${i}: Looking for buttons...`);
|
||||
await dumpElements(page);
|
||||
|
||||
// Try "Next >" first (exact button label)
|
||||
let clicked = await clickByLabel(page, 'Next >');
|
||||
if (clicked) {
|
||||
console.log(`Step ${i}: Clicked "Next >"`);
|
||||
} else {
|
||||
// Try Finish button
|
||||
clicked = await clickByLabel(page, 'Finish');
|
||||
if (clicked) {
|
||||
console.log(`Step ${i}: Clicked "Finish"`);
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({ path: `test-results/wizard-${String(i).padStart(2, '0')}-finish.png` });
|
||||
break;
|
||||
} else {
|
||||
console.log(`Step ${i}: No "Next >" or "Finish" found`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({ path: `test-results/wizard-${String(i).padStart(2, '0')}.png` });
|
||||
}
|
||||
|
||||
// Wait for PCBnew to fully load
|
||||
await page.waitForTimeout(2000);
|
||||
await page.screenshot({ path: 'test-results/pcbnew-loaded.png' });
|
||||
|
||||
// Verify PCBnew loaded
|
||||
const canvasCount = await page.locator('canvas').count();
|
||||
console.log('Canvas count after wizard:', canvasCount);
|
||||
expect(canvasCount).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test.skip('should render without JavaScript errors', async ({ page, testLogger }) => {
|
||||
await page.goto('/kicad/pcbnew.html');
|
||||
await page.waitForTimeout(5000); // Give time for WASM to load
|
||||
|
||||
// Check captured errors (excluding known acceptable ones)
|
||||
const criticalErrors = testLogger.errors.filter(e =>
|
||||
!e.includes('ResizeObserver') && !e.includes('favicon')
|
||||
);
|
||||
expect(criticalErrors).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d07cf78508951e204ff6c57c68e1930462838c39
|
||||
Subproject commit 47ebb3991d91614ca7cd6396bb6305a73d184232
|
||||
Loading…
Reference in a new issue