mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-10-20 22:41:22 +02:00
perf: end clicks without load
This commit is contained in:
1 parent
a6dfe2b3db
commit
d594fe4bfd
7 files changed
+303
-65
No files matched your search
@@ -691,6 +691,27 @@ test("real Wayfern fingerprinting, terms, API automation, CDP, cookies, and proc
|
||||
assert.ok(echo.userAgent.length > 20);
|
||||
assert.match(await cdp.evaluate("document.cookie"), /donut_e2e=browser-ok/);
|
||||
|
||||
// A click that only changes the page ends a moment after the click, not
|
||||
// at the load timeout; a link click still waits for its load and says so.
|
||||
const agentClick = async (locator) => {
|
||||
const started = Date.now();
|
||||
const answer = await request(
|
||||
`${base}/v1/profiles/${profile.id}/agent/click`,
|
||||
{ method: "POST", token: saved.api_token, body: { locator } },
|
||||
);
|
||||
assert.equal(answer.response.status, 200, JSON.stringify(answer.value));
|
||||
return { ...answer.value, ms: Date.now() - started };
|
||||
};
|
||||
const inPlace = await agentClick({ role: "button", name: "Clicked" });
|
||||
assert.equal(inPlace.navigated, false);
|
||||
assert.ok(inPlace.ms < 5000, `an in-place click took ${inPlace.ms} ms`);
|
||||
const link = await agentClick({ role: "link", name: "Open the linked page" });
|
||||
assert.equal(link.navigated, true);
|
||||
assert.equal(
|
||||
await cdp.evaluate("document.querySelector('#path').textContent"),
|
||||
"/linked",
|
||||
);
|
||||
|
||||
const runningProfile = (await app.invoke("list_browser_profiles")).find(
|
||||
(item) => item.id === profile.id,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user