diff options
Diffstat (limited to 'test-suite')
| -rw-r--r-- | test-suite/unit/overlay.test.mjs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/test-suite/unit/overlay.test.mjs b/test-suite/unit/overlay.test.mjs index de18da8..cd60522 100644 --- a/test-suite/unit/overlay.test.mjs +++ b/test-suite/unit/overlay.test.mjs @@ -1,6 +1,6 @@ -// Another extension's prompt (1Password) blocks the debugger on a tab. We never close it on our -// own, because the user may be using it; the agent is told, and chrome_clear_overlay closes it -// when asked. +// Another extension's prompt (1Password) blocks the debugger on a tab. Nothing closes it +// automatically, because the user may be using it; the agent is told what is blocking and decides: +// chrome_clear_overlay when it is only in the way, leave it when it is waiting for the user. import assert from "node:assert/strict"; import fs from "node:fs"; import vm from "node:vm"; @@ -35,12 +35,12 @@ function worker({ targets = [frame], clears = true, scriptResult = { removed: [" return { w, calls, isCleared: () => cleared }; } -test("a blocked input is not dismissed with Escape: the agent is told to ask the user", async () => { +test("a blocked input is not dismissed with Escape: the agent is told and decides", async () => { const { w, calls } = worker(); w.cdpRaw = async (_tab, method) => { calls.push({ method }); throw new Error(`${method}: ${BLOCK}`); }; await assert.rejects( () => w.cdp(2, "Input.dispatchMouseEvent", {}), - (e) => /may be using it right now/.test(e.message) && /ask the user/.test(e.message) && /chrome_clear_overlay/.test(e.message) && /aeblf/.test(e.message), + (e) => /only in your way/.test(e.message) && /waiting for the user to sign in or approve/.test(e.message) && /leave it alone/.test(e.message) && /chrome_clear_overlay/.test(e.message) && /aeblf/.test(e.message), ); assert.deepEqual(calls.map((c) => c.method), ["Input.dispatchMouseEvent"]); }); @@ -83,9 +83,10 @@ test("the injected clean-up removes foreign extension iframes, not ours, and blu assert.ok(blurred && escaped); }); -test("the tool tells the agent not to call it on its own, and the primer says the same", () => { +test("the tool and the primer let the agent decide: clear it when in the way, leave it when waiting for the user", () => { assert.match(indexSource, /name: "chrome_clear_overlay"/); - assert.match(indexSource, /So never call this on your own: ask the user first/); - assert.match(indexSource, /11\. If a tool fails saying another extension/); + assert.match(indexSource, /Decide for yourself whether to use it/); + assert.match(indexSource, /do not clear it: tell the user what you are waiting for/); + assert.match(indexSource, /11\. If a tool fails saying another extension[^`]*decide whether it is in your way or part of the task/); assert.match(indexSource, /"chrome_clear_overlay",\n\] as const/); }); |
