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

@ -131,10 +131,10 @@ export const config = {
await browser.waitUntil(
async () => {
const title = await browser.getTitle();
const hasEl = await browser.execute(() =>
document.querySelector('[data-testid="status-bar"]') !== null
|| document.querySelector('.project-grid') !== null
|| document.querySelector('.settings-panel') !== null
const hasEl = await browser.execute(
'return document.querySelector(\'[data-testid="status-bar"]\') !== null' +
' || document.querySelector(".project-grid") !== null' +
' || document.querySelector(".settings-panel") !== null'
);
return hasEl || title.toLowerCase().includes('agor') || title.toLowerCase().includes('orchestrator');
},