# Desktop form submission proof driver

Build each revision with `vp i` and `vp run build:desktop`. Start its renderer with `T3CODE_DEV_SEED=0 vp run dev:web`; use the web and server ports printed by the runner.

Start `node echo-server.cjs`. Run `headless-desktop node desktop-driver.cjs <checkout> <base-or-head> <web-port> <server-port>` interactively. Each side uses its own isolated profile and T3 home. No provider turns are sent.

At the driver prompt, select the app page:

```js
page=app.windows().find(p=>p.url().startsWith('t3code'))
```

Complete welcome without importing history: Review all, Select none, Start. Add a New project named Form preview proof. Set the window size and close automatically opened developer tools:

```js
app.evaluate(({BrowserWindow})=>{const w=BrowserWindow.getAllWindows()[0];w.setSize(1440,900);w.webContents.closeDevTools();})
```

Open the right panel, choose Browser, and select localhost:8765 from Local servers. Then run the identical recorded flow on each side:

```js
eval(fs.readFileSync(path.join(__dirname,'submissions.js'),'utf8'))
```

The flow uses real pointer clicks for each form and the Browser Back button between forms. It records URL-encoded target=_blank, multipart target=_blank, and the same-tab multipart control. Before every still it requires two identical screenshots 500 ms apart. JSON results come from the echo destination rendered inside the actual guest. Window and webview counts are recorded after the flow.

The recorded window is 1440x900 on a 1920x1080 Xvfb screen, light theme, at x=410 y=150. Native X11 capture is used because Playwright screenshots miscomposite the webview text on this setup. For another window position, adjust the recording and screenshot crop in submissions.js to the app window bounds.

Close stdin to stop the Electron app after capturing. Stop the renderer and echo server separately.
