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:
parent
407e49cc32
commit
6a8181f33a
42 changed files with 630 additions and 541 deletions
|
|
@ -233,10 +233,10 @@ export const config = {
|
|||
await browser.waitUntil(
|
||||
async () => {
|
||||
const title = await browser.getTitle();
|
||||
const hasKnownEl = await browser.execute(() =>
|
||||
document.querySelector('[data-testid="status-bar"]') !== null
|
||||
|| document.querySelector('.project-grid') !== null
|
||||
|| document.querySelector('.settings-panel') !== null
|
||||
const hasKnownEl = await browser.execute(
|
||||
'return document.querySelector(\'[data-testid="status-bar"]\') !== null' +
|
||||
' || document.querySelector(".project-grid") !== null' +
|
||||
' || document.querySelector(".settings-panel") !== null'
|
||||
);
|
||||
return hasKnownEl || title.toLowerCase().includes('agor') || title.toLowerCase().includes('orchestrator');
|
||||
},
|
||||
|
|
@ -279,10 +279,12 @@ export const config = {
|
|||
// 1. Check for unexpected error toasts
|
||||
let unexpected = [];
|
||||
try {
|
||||
const errors = await browser.execute(() => {
|
||||
const toasts = [...document.querySelectorAll('.toast-error, .load-error')];
|
||||
return toasts.map(t => t.textContent?.trim()).filter(Boolean);
|
||||
});
|
||||
const errors = await browser.execute(
|
||||
'return (function() {' +
|
||||
' var toasts = Array.from(document.querySelectorAll(".toast-error, .load-error"));' +
|
||||
' return toasts.map(function(t) { return (t.textContent || "").trim(); }).filter(Boolean);' +
|
||||
'})()'
|
||||
);
|
||||
|
||||
const expected = browser.__expectedErrors || [];
|
||||
unexpected = errors.filter(e => !expected.some(exp => e.includes(exp)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue