tests: fpedit-cmd-save — drop the from-pcbnew variant (CI timeouts), keep the standalone frame

Same FOOTPRINT_EDIT_FRAME and the same wx-layer focus rule; opening a second
editor from a board session never became ready on CI (Chromium 180 s, Firefox
footprint load >60 s).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
This commit is contained in:
Gergő Törcsvári 2026-08-26 09:05:37 +02:00
commit fcad12d251
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322

View file

@ -2,27 +2,29 @@ import { test, expect, type Page } from '@playwright/test';
import { clickByTooltip, stableShot, waitForWxApp } from '../e2e/utils/element-tracker'; import { clickByTooltip, stableShot, waitForWxApp } from '../e2e/utils/element-tracker';
/** /**
* Cmd+S in a CHILD editor (Footprint Editor opened from a board session) must * Cmd+S in the Footprint Editor must save the open footprint through the lib
* save the open footprint through the lib write bridge, exactly like the * write bridge, exactly like the toolbar Save icon does.
* toolbar Save icon does.
* *
* Report (libs 0017): on a Mac, a footprint edited in the editor opened from * Report (libs 0017): on a Mac, a footprint edited in the editor opened from
* pcbnew saved from the Save icon but not from Cmd+S. tests/kicad/save-cmd-key * pcbnew saved from the Save icon but not from Cmd+S. tests/kicad/save-cmd-key
* proves the Meta chord saves in the MAIN frames under a macOS UA, so the gap * proves the Meta chord saves in the MAIN frames under a macOS UA; this spec
* is child-frame specific. Recipe: board session → toolbar "Create, delete and * covers the lib editor frame. Recipe: `-/footprint_editor` → expand
* edit board footprints" → expand Resistor_SMD → open a footprint → dirty it * Resistor_SMD → open a footprint → dirty it (select-all + R) → Cmd+S → expect
* (select-all + Delete) → Cmd+S → expect one `save` request on * one `save` request on window.kicadLibs.request. The Save toolbar button is
* window.kicadLibs.request. The Save toolbar button is the control. * the control.
*
* UA: the Playwright device presets say Windows; wx.js derives the OS from the
* UA and maps the Meta key to ControlDown only on a Mac — so pin a Mac UA.
* *
* Root cause + fix (2026-08-25): the lib-tree filter <input> kept BROWSER focus * Root cause + fix (2026-08-25): the lib-tree filter <input> kept BROWSER focus
* after a canvas click (the wasm mouse callback preventDefaults mousedown), so * after a canvas click (the wasm mouse callback preventDefaults mousedown), so
* every key stayed with the input. wxWindowWasm::SetFocus now blurs the active * every key stayed with the input. wxWindowWasm::SetFocus now blurs the active
* wx-dom control when a canvas-drawn window takes wx focus (wxDomBlurActive). * wx-dom control when a canvas-drawn window takes wx focus (wxDomBlurActive).
* The from-pcbnew variant needs the board route (collab); a local * The bug is a wx-layer focus rule, so the standalone frame reproduces it
* web/standalone/.env pointing VITE_YJS_* at :3055 breaks that route locally. * exactly like the one opened from pcbnew (same FOOTPRINT_EDIT_FRAME); the
* from-pcbnew variant was dropped — opening a second editor from a board
* session timed out on CI (Chromium: frame never opened in 180 s; Firefox:
* footprint load >60 s, the tier footprint-browse-remote also skips).
*
* UA: the Playwright device presets say Windows; wx.js derives the OS from the
* UA and maps the Meta key to ControlDown only on a Mac — so pin a Mac UA.
*/ */
const SCOPE = 'default'; const SCOPE = 'default';
@ -84,28 +86,20 @@ async function clickCanvasCenter(page: Page): Promise<void> {
await page.mouse.click(box!.x + box!.width / 2, box!.y + box!.height / 2); await page.mouse.click(box!.x + box!.width / 2, box!.y + box!.height / 2);
} }
test.describe('footprint editor from pcbnew: Cmd+S saves', () => { test.describe('footprint editor: Cmd+S saves', () => {
test.describe.configure({ timeout: 480000 }); test.describe.configure({ timeout: 480000 });
test.use({ test.use({
userAgent: userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36',
}); });
async function run(page: Page, entry: 'from-pcbnew' | 'standalone'): Promise<void> { async function run(page: Page): Promise<void> {
const logs: string[] = []; const logs: string[] = [];
page.on('console', (m) => logs.push(`[${m.type()}] ${m.text()}`)); page.on('console', (m) => logs.push(`[${m.type()}] ${m.text()}`));
page.on('pageerror', (e) => logs.push(`[pageerror] ${e.message}`)); page.on('pageerror', (e) => logs.push(`[pageerror] ${e.message}`));
if (entry === 'from-pcbnew') {
await page.goto(`/${SCOPE}/projects/demo/demo.kicad_pcb`);
await waitForWxApp(page, { timeout: BOOT_TIMEOUT });
await expect
.poll(() => page.title(), { message: 'board editor up', timeout: BOOT_TIMEOUT })
.toMatch(/PCB Editor/i);
} else {
await page.goto(`/${SCOPE}/projects/demo/-/footprint_editor`); await page.goto(`/${SCOPE}/projects/demo/-/footprint_editor`);
await waitForWxApp(page, { timeout: BOOT_TIMEOUT }); await waitForWxApp(page, { timeout: BOOT_TIMEOUT });
}
await page.waitForFunction(() => !!(window as unknown as SpyWindow).kicadLibs, null, { await page.waitForFunction(() => !!(window as unknown as SpyWindow).kicadLibs, null, {
timeout: 60000, timeout: 60000,
}); });
@ -122,13 +116,6 @@ test.describe('footprint editor from pcbnew: Cmd+S saves', () => {
}; };
}); });
if (entry === 'from-pcbnew') {
expect(await frameNames(page)).toEqual(['PcbFrame']);
expect(
await clickByTooltip(page, 'Create, delete and edit board footprints', { elementType: 'tool' }),
'Footprint Editor toolbar button clicked',
).toBe(true);
}
await expect await expect
.poll(() => frameNames(page), { message: 'ModEditFrame opened', timeout: BOOT_TIMEOUT }) .poll(() => frameNames(page), { message: 'ModEditFrame opened', timeout: BOOT_TIMEOUT })
.toContain('ModEditFrame'); .toContain('ModEditFrame');
@ -207,11 +194,7 @@ test.describe('footprint editor from pcbnew: Cmd+S saves', () => {
expect(afterCmd, 'Cmd+S produced a lib save').toBeGreaterThan(before); expect(afterCmd, 'Cmd+S produced a lib save').toBeGreaterThan(before);
} }
test('standalone footprint editor: Cmd+S on a dirty footprint reaches the lib save bridge', async ({ page }) => { test('Cmd+S on a dirty footprint reaches the lib save bridge', async ({ page }) => {
await run(page, 'standalone'); await run(page);
});
test('from pcbnew: Cmd+S on a dirty footprint reaches the lib save bridge', async ({ page }) => {
await run(page, 'from-pcbnew');
}); });
}); });