gui tests: a signed-out account's buttons are measured with the reason in one read, once laid out (#3642)
The test measured the row and its reason line first, then scrolled each
button into view and measured that button later. The editor's account row
is still settling when .aq-none appears: its content moves 2px within a
frame (measured), and at 420 in Chinese Remove wraps under Sign in again,
5px above the reason. A reflow between the two reads put a button against
where the reason had been a moment before. That is the "移除 is under the
reason" red in #3642: chromium zh 420, a different subtest per run, at the
base too.
The row, the reason and both buttons are now read in one evaluate, once
two reads 50ms apart agree (2s at most). The assertions are unchanged:
no overlap, inside the row, above the reason.
Run at this head (origin/main 158888d04):
- Injected a late reflow: a 26px block inserted above the buttons 30ms and
120ms after .aq-none appears. The old test: 5 of 13 red in chromium, with
"移除 is under the reason" and "Remove/Sign in again is under the
reason", the reported failure. The new test: 13 of 13.
- Broken by hand: the reason pulled 20px up over the buttons
(.aq margin-top -20px). The new test goes red with "… is under the
reason" in every language and width.
- plugin-signed-out-account.test.cjs, chromium and webkit: 26 of 26.
- Not reproduced unaided: the red needed load at the time it was seen, and
later runs at load 15 to 75 were green before this change too. The exact
late reflow was not caught. The animations slowed tenfold (CDP
Animation.setPlaybackRate) and a delayed usage reply did not bring the
red back.
Not run: the whole GUI suite.
Fixes #3642
This commit is contained in:
@@ -100,14 +100,31 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
// and nothing covers them or runs out of the row
|
||||
const aq = row.locator(".aq");
|
||||
await aq.locator(".aq-none").waitFor();
|
||||
const box = await row.boundingBox(), line = await aq.boundingBox();
|
||||
for (const b of [again, rm]) {
|
||||
await b.scrollIntoViewIfNeeded();
|
||||
assert.ok(await b.isVisible());
|
||||
const r = await b.boundingBox();
|
||||
assert.ok(!overlap(r, line), `${await b.innerText()} is under the reason`);
|
||||
assert.ok(r.x >= box.x - 1 && r.x + r.width <= box.x + box.width + 1, `${await b.innerText()} runs out of the row`);
|
||||
assert.ok(r.y + r.height <= line.y + 1, `${await b.innerText()} is below the reason`);
|
||||
}
|
||||
// the row, its reason and its buttons read in one go, once they
|
||||
// hold still: read one by one, a row still laying itself out (at
|
||||
// 420 Remove wraps under Sign in again, 5px over the reason) put a
|
||||
// button against where the reason was a moment before (#3642)
|
||||
const at = () => row.evaluate((acc, names) => {
|
||||
const rect = (e) => { const r = e.getBoundingClientRect(); return { x: r.x, y: r.y, width: r.width, height: r.height }; };
|
||||
const btn = (n) => [...acc.querySelectorAll("button")].find((b) => b.textContent.trim() === n);
|
||||
return { box: rect(acc), line: rect(acc.querySelector(".aq")), buttons: names.map((n) => ({ name: n, r: rect(btn(n)) })) };
|
||||
}, [w.again, w.remove]);
|
||||
let laid = await at();
|
||||
for (let i = 0; i < 40; i++) {
|
||||
await page.waitForTimeout(50);
|
||||
const now = await at();
|
||||
if (JSON.stringify(now) === JSON.stringify(laid)) break;
|
||||
laid = now;
|
||||
}
|
||||
const { box, line } = laid;
|
||||
for (const { name, r } of laid.buttons) {
|
||||
assert.ok(!overlap(r, line), `${name} is under the reason`);
|
||||
assert.ok(r.x >= box.x - 1 && r.x + r.width <= box.x + box.width + 1, `${name} runs out of the row`);
|
||||
assert.ok(r.y + r.height <= line.y + 1, `${name} is below the reason`);
|
||||
}
|
||||
// shown as it is, not only while the pointer is on the row
|
||||
await page.mouse.move(1, 1);
|
||||
|
||||
Reference in New Issue
Block a user