Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✅ Harden registration test against dev-server races in full-suite runs (#2828)

Luke Vellad984ccc926fa
diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts
index 2ef9d106e..ca56a568d 100644
--- a/apps/web/playwright.config.ts
+++ b/apps/web/playwright.config.ts
@@ -13,6 +13,10 @@ const baseURL = `http://localhost:${port}`;
export default defineConfig({
// Artifacts folder where screenshots, videos, and traces are stored.
outputDir: "test-results/",
+ // Local runs use `next dev`, where on-demand route compilation during a
+ // full-suite run can eat most of the default 30s budget before a test's
+ // final assertion. CI runs a production build and keeps the default.
+ timeout: ci ? 30_000 : 60_000,
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
use: {
viewport: { width: 1280, height: 720 },
@@ -22,7 +26,15 @@ export default defineConfig({
},
testDir: "./tests",
webServer: {
- command: ci ? `next start --port ${port}` : `next dev --port ${port}`,
+ // Local runs clear .next first: Turbopack's persistent dev cache
+ // (default on since Next 16.1) is shared across dev sessions, and a
+ // server killed mid-write — which is how every Playwright run ends —
+ // can leave it in a state that deadlocks on-demand route compiles in
+ // the next run. That surfaces as tests timing out on pages no earlier
+ // test has visited, while already-compiled routes keep working.
+ command: ci
+ ? `next start --port ${port}`
+ : `rm -rf .next && next dev --port ${port}`,
url: baseURL,
reuseExistingServer: !ci,
env: {
diff --git a/apps/web/tests/create-delete-poll.spec.ts b/apps/web/tests/create-delete-poll.spec.ts
index 5c04adfd7..f3172bf03 100644
--- a/apps/web/tests/create-delete-poll.spec.ts
+++ b/apps/web/tests/create-delete-poll.spec.ts
@@ -33,6 +33,10 @@ test.describe.serial(() => {
await deletePollDialog.getByRole("button", { name: "delete" }).click();
- await expect(page).toHaveURL("/login?redirectTo=%2Fpolls");
+ // Delete → invalidate → navigate to /polls → bounce to /login is a
+ // long chain for the dev server; give it more than the 5s default.
+ await expect(page).toHaveURL("/login?redirectTo=%2Fpolls", {
+ timeout: 15_000,
+ });
});
});
diff --git a/apps/web/tests/register-page.ts b/apps/web/tests/register-page.ts
index 6dcaf66ed..23ad7dd3c 100644
--- a/apps/web/tests/register-page.ts
+++ b/apps/web/tests/register-page.ts
@@ -47,10 +47,24 @@ export class RegisterPage {
await this.page
.getByRole("heading", { name: "Set Up Your Account" })
.waitFor();
- await this.page.getByPlaceholder("Jessie Smith").fill(name);
- await this.page
- .getByRole("button", { name: "Continue", exact: true })
- .click();
+
+ // The setup page is reached via a full page load, so like the login
+ // form it is visible before React hydrates it: a fill can be wiped when
+ // the controlled input hydrates and a click can land before the submit
+ // handler is attached. Retry until we navigate away. The setup action
+ // is idempotent, so re-submitting is safe.
+ await expect(async () => {
+ if (!new URL(this.page.url()).pathname.includes("/setup")) {
+ return;
+ }
+ await this.page.getByPlaceholder("Jessie Smith").fill(name);
+ await this.page
+ .getByRole("button", { name: "Continue", exact: true })
+ .click();
+ await this.page.waitForURL((url) => !url.pathname.includes("/setup"), {
+ timeout: 5000,
+ });
+ }).toPass();
// Verify successful registration
await expect(this.page.getByText(name)).toBeVisible();