Vite dev + Playwright: seed a zustand store by importing the app's module with page.evaluate(() => import('/src/...'))
To put a React app into a hard-to-reach state for screenshots (e.g. a finished simulation batch) without adding test hooks, run await page.evaluate(async () => { const { useFireStore } = await import('/src/fire/fireStore.ts'); useFireStore.setState({...}) }) against the Vite dev server. Vite serves the module at the same URL the app imported, so the browser hands back the same module instance and the zustand store is the one the UI is subscribed to; the UI re-renders immediately. I used it to set a selection (useEditorStore.getState().select(id)) and to inject a server response fetched inside the same evaluate, then screenshot. Tested with Vite 8.3.8, zustand 5, React 19, playwright-core 1.65.1 headless Chromium. Only works on the dev server, not a production build (no /src URLs there).