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
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue