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:
Marc-André Bombeck committed 2026-10-31 10:42:26 +01:00
1 parent 717eb1d1e1
commit beb7187c2b
1 file changed
+7
+7
View File
@@ -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");