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:
parent
079522d1e7
commit
fcad12d251
1 changed files with 21 additions and 38 deletions
|
|
@ -2,27 +2,29 @@ import { test, expect, type Page } from '@playwright/test';
|
|||
import { clickByTooltip, stableShot, waitForWxApp } from '../e2e/utils/element-tracker';
|
||||
|
||||
/**
|
||||
* Cmd+S in a CHILD editor (Footprint Editor opened from a board session) must
|
||||
* save the open footprint through the lib write bridge, exactly like the
|
||||
* toolbar Save icon does.
|
||||
* Cmd+S in the Footprint Editor must save the open footprint through the lib
|
||||
* write bridge, exactly like the toolbar Save icon does.
|
||||
*
|
||||
* 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
|
||||
* proves the Meta chord saves in the MAIN frames under a macOS UA, so the gap
|
||||
* is child-frame specific. Recipe: board session → toolbar "Create, delete and
|
||||
* edit board footprints" → expand Resistor_SMD → open a footprint → dirty it
|
||||
* (select-all + Delete) → Cmd+S → expect one `save` request on
|
||||
* window.kicadLibs.request. The Save toolbar button is 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.
|
||||
* proves the Meta chord saves in the MAIN frames under a macOS UA; this spec
|
||||
* covers the lib editor frame. Recipe: `-/footprint_editor` → expand
|
||||
* Resistor_SMD → open a footprint → dirty it (select-all + R) → Cmd+S → expect
|
||||
* one `save` request on window.kicadLibs.request. The Save toolbar button is
|
||||
* the control.
|
||||
*
|
||||
* 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
|
||||
* every key stayed with the input. wxWindowWasm::SetFocus now blurs the active
|
||||
* wx-dom control when a canvas-drawn window takes wx focus (wxDomBlurActive).
|
||||
* The from-pcbnew variant needs the board route (collab); a local
|
||||
* web/standalone/.env pointing VITE_YJS_* at :3055 breaks that route locally.
|
||||
* The bug is a wx-layer focus rule, so the standalone frame reproduces it
|
||||
* 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';
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
test.describe('footprint editor from pcbnew: Cmd+S saves', () => {
|
||||
test.describe('footprint editor: Cmd+S saves', () => {
|
||||
test.describe.configure({ timeout: 480000 });
|
||||
test.use({
|
||||
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',
|
||||
});
|
||||
|
||||
async function run(page: Page, entry: 'from-pcbnew' | 'standalone'): Promise<void> {
|
||||
async function run(page: Page): Promise<void> {
|
||||
const logs: string[] = [];
|
||||
page.on('console', (m) => logs.push(`[${m.type()}] ${m.text()}`));
|
||||
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 waitForWxApp(page, { timeout: BOOT_TIMEOUT });
|
||||
}
|
||||
await page.goto(`/${SCOPE}/projects/demo/-/footprint_editor`);
|
||||
await waitForWxApp(page, { timeout: BOOT_TIMEOUT });
|
||||
await page.waitForFunction(() => !!(window as unknown as SpyWindow).kicadLibs, null, {
|
||||
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
|
||||
.poll(() => frameNames(page), { message: 'ModEditFrame opened', timeout: BOOT_TIMEOUT })
|
||||
.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);
|
||||
}
|
||||
|
||||
test('standalone footprint editor: Cmd+S on a dirty footprint reaches the lib save bridge', async ({ page }) => {
|
||||
await run(page, 'standalone');
|
||||
});
|
||||
|
||||
test('from pcbnew: Cmd+S on a dirty footprint reaches the lib save bridge', async ({ page }) => {
|
||||
await run(page, 'from-pcbnew');
|
||||
test('Cmd+S on a dirty footprint reaches the lib save bridge', async ({ page }) => {
|
||||
await run(page);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue