fix(e2e): cross-protocol browser.execute() — works with both WebDriver + CDP

Root cause: WebDriverIO devtools protocol wraps functions in a polyfill
that puts `return` inside eval() (not a function body) → "Illegal return".

Fix: exec() wrapper in helpers/execute.ts converts function args to IIFE
strings before passing to browser.execute(). Works identically on both
WebDriver (Tauri) and CDP/devtools (Electrobun CEF).

- 35 spec files updated (browser.execute → exec)
- 4 config files updated (string-form expressions)
- helpers/actions.ts + assertions.ts updated
- 560 vitest + 116 cargo passing
This commit is contained in:
Hibryda 2026-03-22 06:33:55 +01:00
parent 407e49cc32
commit 6a8181f33a
42 changed files with 630 additions and 541 deletions

View file

@ -113,13 +113,13 @@ export const config = {
},
async before() {
// Wait for Electrobun app to render
// Wait for Electrobun app to render — use string script for CDP compatibility
await browser.waitUntil(
async () => {
const hasEl = await browser.execute(() =>
document.querySelector('.app-shell') !== null
|| document.querySelector('.project-grid') !== null
|| document.querySelector('.status-bar') !== null
const hasEl = await browser.execute(
'return document.querySelector(".app-shell") !== null' +
' || document.querySelector(".project-grid") !== null' +
' || document.querySelector(".status-bar") !== null'
);
return hasEl;
},