mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
test(e2e): wait for the saved range before reloading the score chart
The range tab saves with a PUT; reloading straight after the click could cancel it, and the reloaded chart opened on thirty days again.
This commit is contained in:
1 parent
717eb1d1e1
commit
beb7187c2b
1 file changed
+7
@@ -261,10 +261,17 @@ test.describe("score histories", () => {
|
||||
await expect(
|
||||
page.locator(`${chart} [data-slot="chart-overlay-controls-trigger"]`),
|
||||
).toHaveCount(0);
|
||||
// The choice is saved by a PUT; reloading before it answers cancels it.
|
||||
const saved = page.waitForResponse(
|
||||
(res) =>
|
||||
res.url().includes("/api/dashboard/chart-overlay-prefs") &&
|
||||
res.request().method() === "PUT",
|
||||
);
|
||||
await page
|
||||
.locator(`${chart} [data-slot="chart-range-tab"][data-value="7"]`)
|
||||
.click();
|
||||
await expectSharedTabs(page, chart, "7");
|
||||
expect((await saved).status()).toBe(200);
|
||||
await page.reload();
|
||||
await expectSharedTabs(page, chart, "7");
|
||||
await resetRange(page, "scoreRecovery");
|
||||
|
||||
Reference in new issue
Block a user