From 9463009b90732455f1e838b60b68d8efacd89b57 Mon Sep 17 00:00:00 2001 From: SimpleTest Date: Mon, 20 Jul 2026 19:04:30 +0300 Subject: [PATCH] test: verify committed staging mutations reliably --- e2e/tests/auth-settings.spec.ts | 16 ++++++++++++---- e2e/tests/mutual-aid.spec.ts | 8 ++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/e2e/tests/auth-settings.spec.ts b/e2e/tests/auth-settings.spec.ts index 0a31d10..d05cc81 100644 --- a/e2e/tests/auth-settings.spec.ts +++ b/e2e/tests/auth-settings.spec.ts @@ -32,10 +32,18 @@ test("registration, email confirmation, password, and email change work end to e const passwordForm = user.page.locator("#update_password"); await passwordForm.getByLabel("New password", { exact: true }).fill(password); await passwordForm.getByLabel("Confirm new password", { exact: true }).fill(password); - await clickUntilVisible( - passwordForm.getByRole("button", { name: "Save Password" }), - user.page.getByText("Password updated successfully."), - ); + const passwordUpdated = user.page.getByText("Password updated successfully."); + await passwordForm.getByRole("button", { name: "Save Password" }).click(); + + try { + await expect(passwordUpdated).toBeVisible({ timeout: 5_000 }); + } catch { + // The password commit rotates the current session. If the following GET + // is interrupted after the 302 response, never submit the mutation again: + // recover through an idempotent page and verify the server-side flash. + await gotoWithTransientRetry(user.page, "/users/settings"); + await expect(passwordUpdated).toBeVisible(); + } const emailForm = user.page.locator("#update_email"); await emailForm.getByLabel("Email").fill(changedEmail); diff --git a/e2e/tests/mutual-aid.spec.ts b/e2e/tests/mutual-aid.spec.ts index 5da994e..2cc2ddb 100644 --- a/e2e/tests/mutual-aid.spec.ts +++ b/e2e/tests/mutual-aid.spec.ts @@ -108,7 +108,9 @@ test("two users complete medicine tracking, handover, realtime chat, and blind r await helper.page.getByLabel("Comment (optional)").fill("Clear and safe coordination."); await helper.page.getByRole("button", { name: "Submit review" }).click(); await expect( - helper.page.getByText("Review saved. It appears after both participants review."), + helper.page + .locator("#main-content") + .getByText("Review saved. It appears after both participants review."), ).toBeVisible(); await waitForMapReady(requester.page); @@ -121,7 +123,9 @@ test("two users complete medicine tracking, handover, realtime chat, and blind r await requester.page.getByLabel("Comment (optional)").fill("Reliable volunteer."); await requester.page.getByRole("button", { name: "Submit review" }).click(); await expect( - requester.page.getByText("Review saved. It appears after both participants review."), + requester.page + .locator("#main-content") + .getByText("Review saved. It appears after both participants review."), ).toBeVisible(); await waitForMapReady(requester.page);