tests: routing-burst-speed scrolls to a row with a wheel over a point in sight, not hover()
The row pick was red on a loaded machine ("picking the request moved the
page", zh in Chromium, 2 of 4 on origin/main 331c27703 at load ~250).
hover() on .rt-reqs scrolled the list's bottom into view by script; the
day's click still held the view at its top and put that scroll back, and
only a wheel made within 50 ms of the put-back gives it back (givesBack).
When the wheel came ~150 ms later the view stayed 18px short, and the
click then scrolled the row into view itself. Traced with a scroll-write
probe: the put-back at hold(), and givesBack's SET18 only on the green
runs.
The test now wheels over the part of the list in sight while the row is
below the list's end, and over the view's head while the list ends below
the window, so every scroll is the reader's.
Run: routing-burst-speed, both engines, en and zh, 3 of 3 green at load
~300. Broken by hand (hold() returning at once, and a pick scrolling the
view 30px) it goes red in en and zh; with only the pick's scroll it stays
green, as the hold puts that back.
This commit is contained in:
@@ -81,12 +81,23 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
|
||||
const story = async (i) => {
|
||||
const row = page.locator(".rt-req").nth(i);
|
||||
// Taller metric rows need the list scrolled first, with real input
|
||||
// so the page's script-scroll protection keeps the same position.
|
||||
const rb = await row.boundingBox(), lb = await page.locator(".rt-reqs").boundingBox();
|
||||
if (rb.y + rb.height > lb.y + lb.height) {
|
||||
await page.locator(".rt-reqs").hover();
|
||||
await page.mouse.wheel(0, rb.y + rb.height - lb.y - lb.height + 6);
|
||||
// Taller metric rows need the list, and the view under it, scrolled
|
||||
// first, with real input so the page's script-scroll protection
|
||||
// keeps the same position. The wheel turns over a point already in
|
||||
// sight: hover() would scroll the list into view by script, which
|
||||
// the day's click holds back, and only a wheel within 50 ms of that
|
||||
// gives it back, so on a loaded machine the click then scrolled the
|
||||
// row into view and moved the page.
|
||||
for (let n = 0; n < 4; n++) {
|
||||
const [rb, lb, vb, high] = await row.evaluate((e) => [...[e, e.closest(".rt-reqs"), e.closest(".view")].map((x) => x.getBoundingClientRect().toJSON()), innerHeight]);
|
||||
const bottom = Math.min(lb.bottom, vb.bottom, high);
|
||||
if (rb.bottom <= bottom) break;
|
||||
// a row below the list's end scrolls the list, over its part in
|
||||
// sight; a list ending below the window scrolls the view, over
|
||||
// its head
|
||||
if (rb.bottom > lb.bottom) await page.mouse.move(lb.x + lb.width / 2, (Math.max(lb.top, vb.top) + bottom) / 2);
|
||||
else await page.mouse.move(vb.x + vb.width / 2, vb.top + 8);
|
||||
await page.mouse.wheel(0, rb.bottom - bottom + 6);
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
// measure once the page holds still: the day's rows arriving grow the
|
||||
|
||||
Reference in New Issue
Block a user