Skip to content

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 50+ tests passed.

test: deflake scroll overshoot off check (JS, Python)

CloakHQ759afca9e2b5
diff --git a/js/tests/humanizeEngine.test.ts b/js/tests/humanizeEngine.test.ts
index 4a8ee00..23b8135 100644
--- a/js/tests/humanizeEngine.test.ts
+++ b/js/tests/humanizeEngine.test.ts
@@ -428,7 +428,10 @@ describe.skipIf(!process.env.CLOAKBROWSER_BINARY_PATH)('humanize engine (real br
expect((await events(p, 'click')).map((e) => e.target)).toEqual(['chk']);
await reset(p);
await p.evaluate(() => scrollTo(0, 0));
- await p.click('#chk', { human_config: { scroll_overshoot_chance: 0 } });
+ // A zone narrower than #chk means "just bring it into view": with a random
+ // in-zone target, whole-notch rounding can land past the zone and the
+ // correction wheels back up even without overshoot.
+ await p.click('#chk', { human_config: { scroll_overshoot_chance: 0, scroll_target_zone: [0.5, 0.5] } });
expect((await events(p, 'wheel')).every((e) => e.dy > 0)).toBe(true);
});
diff --git a/tests/test_humanize_engine.py b/tests/test_humanize_engine.py
index add3fa7..83c56a9 100644
--- a/tests/test_humanize_engine.py
+++ b/tests/test_humanize_engine.py
@@ -613,7 +613,10 @@ def test_scroll_overshoot_wheels_back(page):
assert [e["target"] for e in events(page, "click")] == ["chk"]
reset(page)
page.evaluate("scrollTo(0, 0)")
- page.click("#chk", human_config={"scroll_overshoot_chance": 0.0})
+ # A zone narrower than #chk means "just bring it into view": with a random
+ # in-zone target, whole-notch rounding can land past the zone and the
+ # correction wheels back up even without overshoot.
+ page.click("#chk", human_config={"scroll_overshoot_chance": 0.0, "scroll_target_zone": (0.5, 0.5)})
assert all(e["dy"] > 0 for e in events(page, "wheel"))