test(e2e): web-app tool open-path suite + pl_editor open/wizard-skip
Add an e2e suite that drives the real React web app (not the standalone harness): tests/playwright-web.config.ts + tests/web/tools-open.spec.ts navigate /p/demo/<tool>/<file> for all five tools and assert each boots, opens its demo file (title drops "untitled"), shows no first-run wizard, and emits no WASM abort or URL-regex modal. global-setup-web.ts re-seeds the demo project through the API if missing, so the suite is self-sufficient against a running dev stack. Wired as `npm run test:web`. Also at the harness level: - pl_editor-load.spec.ts: prove the pl_editor kicadOpenFile embind hook opens a .kicad_wks (mirrors eeschema-load.spec.ts). - seed KiCad config in pl_editor.html / symbol_editor.html (matching eeschema.html and the web app's boot.ts) so the harness boots wizard-free; repurpose pl_editor.spec.ts's stale "wizard completes" test into a wizard-skip regression. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0157741660
commit
3ef461a0f6
8 changed files with 385 additions and 7 deletions
|
|
@ -140,10 +140,34 @@
|
|||
console.log('[KICAD] cwd set to ' + home);
|
||||
};
|
||||
|
||||
// single_top.cpp runs STARTWIZARD on launch: a modal first-run "Setup"
|
||||
// wizard shown whenever the settings dir lacks a kicad_common.json or valid
|
||||
// global library tables. In this ephemeral MEMFS that is EVERY load, and the
|
||||
// wizard's modal event loop crashes Asyncify. Seed a minimal default config
|
||||
// before main() so every provider reports NeedsUserInput()==false and the
|
||||
// wizard never opens — same as eeschema.html and the web app's boot.ts.
|
||||
var seedKicadConfig = function() {
|
||||
var cfgDir = '/home/kicad/.config/kicad/kicad/9.99';
|
||||
FS.mkdirTree(cfgDir);
|
||||
|
||||
var writeIfAbsent = function(path, contents) {
|
||||
try { FS.stat(path); return; } catch (e) { /* absent — seed it */ }
|
||||
FS.writeFile(path, contents);
|
||||
console.log('[KICAD] Seeded ' + path);
|
||||
};
|
||||
|
||||
writeIfAbsent(cfgDir + '/kicad_common.json', JSON.stringify({
|
||||
do_not_show_again: { update_check_prompt: true, data_collection_prompt: true }
|
||||
}, null, 2));
|
||||
writeIfAbsent(cfgDir + '/sym-lib-table', '(sym_lib_table\n (version 7)\n)\n');
|
||||
writeIfAbsent(cfgDir + '/fp-lib-table', '(fp_lib_table\n (version 7)\n)\n');
|
||||
writeIfAbsent(cfgDir + '/design-block-lib-table', '(design_block_lib_table\n (version 7)\n)\n');
|
||||
};
|
||||
|
||||
var Module = {
|
||||
thisProgram: '/usr/bin/pl_editor', // Fake absolute path for argv[0]
|
||||
|
||||
preRun: [createCanvas, writeResources, setupHomeDir],
|
||||
preRun: [createCanvas, writeResources, setupHomeDir, seedKicadConfig],
|
||||
postRun: [],
|
||||
|
||||
print: function(text) {
|
||||
|
|
|
|||
|
|
@ -137,10 +137,34 @@
|
|||
}
|
||||
};
|
||||
|
||||
// single_top.cpp runs STARTWIZARD on launch: a modal first-run "Setup"
|
||||
// wizard shown whenever the settings dir lacks a kicad_common.json or valid
|
||||
// global library tables. In this ephemeral MEMFS that is EVERY load, and the
|
||||
// wizard's modal event loop crashes Asyncify. Seed a minimal default config
|
||||
// before main() so every provider reports NeedsUserInput()==false and the
|
||||
// wizard never opens — same as eeschema.html and the web app's boot.ts.
|
||||
var seedKicadConfig = function() {
|
||||
var cfgDir = '/home/kicad/.config/kicad/kicad/9.99';
|
||||
FS.mkdirTree(cfgDir);
|
||||
|
||||
var writeIfAbsent = function(path, contents) {
|
||||
try { FS.stat(path); return; } catch (e) { /* absent — seed it */ }
|
||||
FS.writeFile(path, contents);
|
||||
console.log('[KICAD] Seeded ' + path);
|
||||
};
|
||||
|
||||
writeIfAbsent(cfgDir + '/kicad_common.json', JSON.stringify({
|
||||
do_not_show_again: { update_check_prompt: true, data_collection_prompt: true }
|
||||
}, null, 2));
|
||||
writeIfAbsent(cfgDir + '/sym-lib-table', '(sym_lib_table\n (version 7)\n)\n');
|
||||
writeIfAbsent(cfgDir + '/fp-lib-table', '(fp_lib_table\n (version 7)\n)\n');
|
||||
writeIfAbsent(cfgDir + '/design-block-lib-table', '(design_block_lib_table\n (version 7)\n)\n');
|
||||
};
|
||||
|
||||
var Module = {
|
||||
thisProgram: '/usr/bin/symbol_editor', // Fake absolute path for argv[0] (KiCad DEBUG check)
|
||||
|
||||
preRun: [createCanvas, writeResources],
|
||||
preRun: [createCanvas, writeResources, seedKicadConfig],
|
||||
postRun: [],
|
||||
|
||||
print: function(text) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue