From d8c4aeb1371f128f17665bf1c4b9ffc6da410a3e Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 28 May 2026 09:35:27 -0700 Subject: [PATCH] [eric] e2e+ci: addInitScript in launchApp setting __OPENSWARM_E2E__=true before bundle.js parses so the production-build store-on-window gate fires for specs that drive Redux directly, plus chain selftest-pairwise into verify-all and the e2e workflow so the covering-array math is validated on every CI push --- .github/workflows/e2e.yml | 3 +++ e2e/helpers/launch.ts | 9 ++++++++- scripts/ci/verify-all.js | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4a0b1878..d63bbf44 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -71,6 +71,9 @@ jobs: - name: Preflight race / cache (Layer 4) shell: bash run: node scripts/ci/verify-preflight-race.js + - name: Pairwise generator selftest (covering-array math) + shell: bash + run: node scripts/ci/selftest-pairwise.js # Preflight Layer 5: hostile-env scenarios. Each leg asserts the verdict # matches the expected envelope for that scenario; network=blocked diff --git a/e2e/helpers/launch.ts b/e2e/helpers/launch.ts index ec192d50..848f15ef 100644 --- a/e2e/helpers/launch.ts +++ b/e2e/helpers/launch.ts @@ -79,7 +79,14 @@ export function hasAnyProviderKey(): boolean { export async function launchApp(): Promise { seedTestUserIfClean(); - return electron.launch({ executablePath: packagedAppPath(), args: [] }); + const app = await electron.launch({ executablePath: packagedAppPath(), args: [] }); + // The frontend bundle gates `__OPENSWARM_STORE__` exposure on + // `__OPENSWARM_E2E__` being truthy at module-load time. Adding an init + // script BEFORE the main page navigates guarantees the flag is set before + // bundle.js parses, so specs that read the Redux store directly work + // against the production build. + try { await app.context().addInitScript({ content: '(window).__OPENSWARM_E2E__ = true;' }); } catch { /* best effort */ } + return app; } // The app opens a splash window first, then the main window that loads the React diff --git a/scripts/ci/verify-all.js b/scripts/ci/verify-all.js index ba89ad78..0258417c 100644 --- a/scripts/ci/verify-all.js +++ b/scripts/ci/verify-all.js @@ -31,6 +31,7 @@ function main() { ['preflight rigs (Layer 3: failure simulators)', 'verify-preflight-rigs.js', []], ['preflight race (Layer 4: parallel + cache)', 'verify-preflight-race.js', []], ['preflight matrix (Layer 5: hostile-env scenario)', 'verify-preflight.js', []], + ['pairwise generator selftest (covering array math)', 'selftest-pairwise.js', []], ['packaging parity (Win+Mac stage the same dirs)', 'verify-packaging-parity.js', []], ['deps fully pinned (reproducible backend builds)', 'verify-deps-pinned.js', []], ['no build-host paths leaked into the artifact', 'verify-host-leakage.js', appArg],