From d78266011d802051c44b7dd85cd9d89c2ea35eb7 Mon Sep 17 00:00:00 2001 From: David Montero Date: Sat, 15 Aug 2026 08:29:39 +0200 Subject: [PATCH] chore(dev): expose core stores on window in dev builds for the QA harness DEV-guarded (import.meta.env.DEV): the platform-bugs Playwright harness drives store paths (property updates, group switches) the way the agent tools do, which raw DOM access cannot reach. Production bundles never ship it. --- frontend/src/main.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 57b2a7ab..8c930599 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -89,3 +89,22 @@ if (import.meta.env.VITE_DESKTOP) { .then((m) => m.mountDesktop?.()) .catch((err) => console.warn('[desktop] failed to load hooks:', err)); } + +// DEV-only: expose the core stores for E2E harnesses (the platform-bugs QA +// harness drives the STORE paths — property updates, group switches — the +// way the agent tools do, which raw DOM access cannot reach). Guarded by +// import.meta.env.DEV so production bundles never ship it. +if (import.meta.env.DEV) { + Promise.all([ + import('./store/useSimulatorStore'), + import('./store/useEditorStore'), + import('./store/useElectricalStore'), + ]).then(([sim, ed, el]) => { + (window as unknown as Record).__velxioStores = { + useSimulatorStore: sim.useSimulatorStore, + useEditorStore: ed.useEditorStore, + useElectricalStore: el.useElectricalStore, + getBoardSimulator: sim.getBoardSimulator, + }; + }); +}