gui tests: usage-alert checks the currency click from where its row is in view
usage-alert was red in WebKit zh ("no click moved the page", 206 !== 207)
since e9221e96d (#1518) added the Allowance reads row to Settings > Usage
(bisected). In zh the wheel now stops at the bottom of the settings with
the currency row 0.02px above the view (opt top 49.98, view top 50.00).
Playwright scrolls a click's target into view before clicking, and that
scroll is the 1px. scrollIntoViewIfNeeded alone moves it 207 -> 206; no
app script writes scrollTop, and focus, mouse down and up on the option
move nothing. The app changed on purpose and a reader's click moves
nothing, so the test is fixed: the alert clicks are checked against the
wheel's position as before, then the currency row is brought into view
and its click is checked against that.
Run: usage-alert alone, webkit and chromium, en and zh: 5/5 each.
Broken by hand (served app.js: hold() a no-op, the CNY click scrolls the
settings up 30px 600ms later): the new check goes red in en (90 !== 120)
and zh (176 !== 206), in both engines.
This commit is contained in:
@@ -172,15 +172,24 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.equal((await posted(4)).balanceAlert, 2.5);
|
||||
await settled();
|
||||
|
||||
// another setting saved later keeps both alerts
|
||||
await page.locator("#currencySegs .opt", { hasText: w.cny }).click();
|
||||
// another setting saved later keeps both alerts. The currency row
|
||||
// sits above the alert rows: in zh, since the Allowance reads row
|
||||
// (e9221e96d), the wheel stops at the bottom with it 0.02px above
|
||||
// the view, and Playwright scrolls a target into view before it
|
||||
// clicks. So the alert clicks are checked here, and the currency
|
||||
// click from where its row is in view.
|
||||
assert.equal(await view(page), before, "no alert click moved the page");
|
||||
const cny = page.locator("#currencySegs .opt", { hasText: w.cny });
|
||||
await cny.scrollIntoViewIfNeeded();
|
||||
const atCurrency = await view(page);
|
||||
await cny.click();
|
||||
const c = await posted(5);
|
||||
assert.equal(c.currency, "cny");
|
||||
assert.equal(c.usageAlert, 90, "the usage alert is kept by another save");
|
||||
assert.equal(c.balanceAlert, 2.5, "the balance alert is kept by another save");
|
||||
await settled();
|
||||
assert.equal(await share.inputValue(), "90");
|
||||
assert.equal(await view(page), before, "no click moved the page");
|
||||
assert.equal(await view(page), atCurrency, "the currency click moved nothing");
|
||||
|
||||
// Off saves 0, and the field goes
|
||||
await usageSegs.nth(0).click();
|
||||
|
||||
Reference in New Issue
Block a user