Skip to content

The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.

test(ego-browser): give wheel-scrolling E2E actions a longer budget

Zhuowei Wange214e27cb941
diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/page-click-hit-target.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/page-click-hit-target.mjs
index 8fccc3b..3e04395 100644
--- a/package/ego-browser/scripts/real-browser-e2e/cases/page-click-hit-target.mjs
+++ b/package/ego-browser/scripts/real-browser-e2e/cases/page-click-hit-target.mjs
@@ -157,13 +157,13 @@ export function pageClickHitTargetCase() {
visibleInput.id = "visible-fillable-duplicate";
document.body.append(hiddenInput, visibleInput);
});
- await page.click(".usable-duplicate");
+ await page.click(".usable-duplicate", { timeout: scrollingActionTimeout });
assertEqual(
await page.evaluate("window.__usableDuplicateClicks"),
1,
"click uses the sole visible, enabled duplicate"
);
- await page.fill(".fillable-duplicate", "filled");
+ await page.fill(".fillable-duplicate", "filled", { timeout: scrollingActionTimeout });
assertEqual(
await page.evaluate("document.querySelector('#visible-fillable-duplicate').value"),
"filled",
diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/page-oopif.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/page-oopif.mjs
index 67ff55a..3aa1553 100644
--- a/package/ego-browser/scripts/real-browser-e2e/cases/page-oopif.mjs
+++ b/package/ego-browser/scripts/real-browser-e2e/cases/page-oopif.mjs
@@ -27,8 +27,8 @@ export function pageOopifActionCase() {
const snapshot = await page.snapshot({ scope: "full_page" });
assertIncludes(snapshot, "Run iframe action", "snapshot includes cross-site iframe content");
assertIncludes(snapshot, "Iframe field", "snapshot includes the iframe input");
- await page.click('loc=role:button[name="Run iframe action"]');
- await page.fill('loc=css:#iframe-field', "filled through Page");
+ await page.click('loc=role:button[name="Run iframe action"]', { timeout: scrollingActionTimeout });
+ await page.fill('loc=css:#iframe-field', "filled through Page", { timeout: scrollingActionTimeout });
const outerScrollState = await page.evaluate(() => ({
scrollY,
@@ -77,8 +77,12 @@ export function pageOopifActionCase() {
covered.addEventListener("click", () => covered.dataset.clicked = "true");
document.body.append(covered);
});
- await sameOrigin.click('text="Run iframe action"');
- await sameOrigin.fill('loc=css:#iframe-field', "same process");
+ await sameOrigin.click('text="Run iframe action"', {
+ timeout: scrollingActionTimeout,
+ });
+ await sameOrigin.fill('loc=css:#iframe-field', "same process", {
+ timeout: scrollingActionTimeout,
+ });
const sameOriginState = await sameOrigin.evaluate(() => {
const frame = document.querySelector("#fixture-frame");
return {
diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/page-selector-compatibility.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/page-selector-compatibility.mjs
index c3a1046..2740cc4 100644
--- a/package/ego-browser/scripts/real-browser-e2e/cases/page-selector-compatibility.mjs
+++ b/package/ego-browser/scripts/real-browser-e2e/cases/page-selector-compatibility.mjs
@@ -183,7 +183,7 @@ export function pageSelectorCompatibilityCase() {
":has-text includes text from the candidate's open shadow root"
);
- await page.click('button:has-text("Run iframe action")');
+ await page.click('button:has-text("Run iframe action")', { timeout: scrollingActionTimeout });
assertEqual(
await page.evaluate(() =>
document
diff --git a/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs b/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs
index bb6f751..24cd212 100644
--- a/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs
+++ b/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs
@@ -26,6 +26,14 @@ export function egoSource(body, context) {
const metadataPath = ${JSON.stringify(metadataPath)};
const keepTaskSpace = ${JSON.stringify(keepTaskSpace)};
+ // Budget for a Page action that has to wheel-scroll its target into view
+ // first. While the browser window is covered (for example by the terminal
+ // running this suite), macOS slows its frames to about one per second,
+ // and Chromium holds the next mouse event's acknowledgement for up to a
+ // second until the wheel gesture ends. Such an action is still correct
+ // but can take more than the 3 s default.
+ const scrollingActionTimeout = 10_000;
+
// The Ego Lite launcher does not forward arbitrary environment variables
// to the SDK Node process. Set isolated test configuration before the first
// taskSpace() call; page-model reads these values lazily.