tests: usage-ledger checks the export's own request, not whichever came last — the Requests test waited for the export POST to be the last request asked, paused 150 ms and then read the last request again, so a GET the page sent in between (a refresh) was checked instead, and WebKit's zh run failed "every page is exported" about one run in six (seen reviewing PR #211 on plain main). It now takes the last POST and also checks there was just one. 15 WebKit runs in a row pass (one in six failed before), and the file passes in Chromium and WebKit.
This commit is contained in:
1 file changed
+2
-1
@@ -237,8 +237,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
// Export CSV posts the filters shown, no page, and says where it went
|
||||
await page.locator("#ledExport").click();
|
||||
await lastAsked(page, asked, (q) => q.method === "POST");
|
||||
const ex = asked.at(-1);
|
||||
const ex = asked.findLast((q) => q.method === "POST"); // a refresh may ask after it
|
||||
assert.equal(ex.get("period"), "today");
|
||||
assert.equal(asked.filter((q) => q.method === "POST").length, 1, "one export");
|
||||
assert(!ex.has("offset") && !ex.has("limit"), "every page is exported");
|
||||
await page.waitForFunction((s) => document.querySelector("#status").textContent === s, w.saved);
|
||||
assert.deepEqual(errors, []);
|
||||
|
||||
Reference in new issue
Block a user