Skip to content

fix: few e2e flakes#23926

Merged
anikdhabal merged 1 commit intomainfrom
fix-few-e2e-flakes
Sep 18, 2025
Merged

fix: few e2e flakes#23926
anikdhabal merged 1 commit intomainfrom
fix-few-e2e-flakes

Conversation

@anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Sep 18, 2025

Updates out-of-office.e2e.ts test to create the response wait promise (page.waitForResponse for outOfOfficeEntriesList) before triggering the dateRange filter. The sequence now sets up the response listener prior to calling addFilter(page, "dateRange"), ensuring the intended network response is awaited.

@graphite-app graphite-app bot requested a review from a team September 18, 2025 16:57
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Walkthrough

Updates Playwright E2E tests in apps/web/playwright/out-of-office.e2e.ts to create the response wait promise (page.waitForResponse for outOfOfficeEntriesList) before triggering the dateRange filter. Applied in the "Default filter - 'Last 7 Days'" and "select 'Last 30 Days'" steps, the listener is set up prior to calling addFilter(page, "dateRange"). No exported or public API changes were made.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR has no author-provided description; although the raw_summary documents the change, the absence of a description means reviewers lack explicit intent/context in the PR body, so this check fails. Please add a short PR description summarizing the intent and key changes (e.g., "Attach page.waitForResponse before triggering dateRange filter to fix a race condition in apps/web/playwright/out-of-office.e2e.ts"), note how it was tested, and include any related issue/pr number to help reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title "fix: few e2e flakes" directly signals a fix for end-to-end test flakiness, which matches the changes that attach response listeners earlier to avoid race conditions. It is concise and related to the primary change, though the phrasing is slightly informal and could be clearer (for example "fix: reduce e2e test flakiness"). Because it references the real issue being fixed and is succinct, it meets the expectations for a pull request summary.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4689775 and fc0d6d1.

📒 Files selected for processing (1)
  • apps/web/playwright/out-of-office.e2e.ts (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keithwillcode keithwillcode added the core area: core, team members only label Sep 18, 2025
await addFilter(page, "dateRange");
const entriesListRespPromise = page.waitForResponse(
(response) => response.url().includes("outOfOfficeEntriesList") && response.status() === 200
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect uses od waitforresponses, causing flakiness

@anikdhabal anikdhabal enabled auto-merge (squash) September 18, 2025 17:01
@anikdhabal anikdhabal changed the title fix: fix few e2e flakes fix: fixing few e2e flakes Sep 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/playwright/out-of-office.e2e.ts (1)

304-312: Don’t reuse resolved waitForResponse promises; create a fresh one before each triggering action.

Re‑awaiting an already‑resolved promise is a no‑op and can reintroduce flakes when opening the modal again or after user switches. Create new waiters each time, before click/navigate.

Example fixes:

@@
-  // add another entry
-  await entriesListRespPromise;
-  await page.getByTestId("add_entry_ooo").click();
-  await reasonListRespPromise;
+  // add another entry
+  const reasonListRespPromise2 = page.waitForResponse(
+    (response) => response.url().includes("outOfOfficeReasonList?batch=1") && response.status() === 200
+  );
+  await page.getByTestId("add_entry_ooo").click();
+  await reasonListRespPromise2;
   await page.locator('[data-testid="date-range"]').click();
   await selectToAndFromDates(page, "11", "24");
@@
-  await member1User?.apiLogin();
-  await page.goto("/settings/my-account/out-of-office");
-  await page.waitForLoadState("domcontentloaded");
-  await entriesListRespPromise;
-  await addOOOButton.click();
-  await reasonListRespPromise;
+  await member1User?.apiLogin();
+  const entriesListRespPromise2 = page.waitForResponse(
+    (response) => response.url().includes("outOfOfficeEntriesList") && response.status() === 200
+  );
+  await page.goto("/settings/my-account/out-of-office");
+  await entriesListRespPromise2;
+  const reasonListRespPromise2 = page.waitForResponse(
+    (response) => response.url().includes("outOfOfficeReasonList?batch=1") && response.status() === 200
+  );
+  await addOOOButton.click();
+  await reasonListRespPromise2;

Also applies to: 346-355, 384-387, 429-437, 481-486

🧹 Nitpick comments (4)
apps/web/playwright/out-of-office.e2e.ts (4)

526-527: Duplicate await on the same promise.

Consecutive awaits on the same resolved promise add no value and obscure intent. Remove the duplicates (or create distinct waiters if two fetches are expected).

-      await legacyListMembersRespPromise;
-      await legacyListMembersRespPromise;
+      await legacyListMembersRespPromise;
-        await legacyListMembersRespPromise;
-        await legacyListMembersRespPromise;
+        await legacyListMembersRespPromise;
-        await legacyListMembersRespPromise;
-        await legacyListMembersRespPromise;
+        await legacyListMembersRespPromise;

Also applies to: 544-545, 557-558


226-227: Use visibility assertions, not toBeTruthy, on locators.

toBeTruthy() on a Locator always passes; it doesn’t assert DOM state. Use toBeVisible().

-    await expect(page.getByTestId("away-emoji")).toBeTruthy();
+    await expect(page.getByTestId("away-emoji")).toBeVisible();
-      await expect(page.locator(`text=${t("booking_redirect_infinite_not_allowed")}`)).toBeTruthy();
+      await expect(page.locator(`text=${t("booking_redirect_infinite_not_allowed")}`)).toBeVisible();
-        expect(page.locator(`text=${t("success_deleted_entry_out_of_office")}`)).toBeTruthy();
+        await expect(page.locator(`text=${t("success_deleted_entry_out_of_office")}`)).toBeVisible();

Also applies to: 486-487, 569-570


59-60: Stray ‘}’ in team slug template.

The extra brace likely leaks into slug; trim it.

-        slug: `test-insights-${Date.now()}-${randomString(5)}}`,
+        slug: `test-insights-${Date.now()}-${randomString(5)}`,

Also applies to: 122-123


837-861: Optional: factor a small helper to DRY out “entries list” waits.

You repeatedly wait for outOfOfficeEntriesList. Consider a tiny helper (e.g., awaitEntriesList(page)) to reduce duplication and mistakes.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4689775 and fc0d6d1.

📒 Files selected for processing (1)
  • apps/web/playwright/out-of-office.e2e.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • apps/web/playwright/out-of-office.e2e.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • apps/web/playwright/out-of-office.e2e.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • apps/web/playwright/out-of-office.e2e.ts
🧬 Code graph analysis (1)
apps/web/playwright/out-of-office.e2e.ts (1)
apps/web/playwright/filter-helpers.ts (1)
  • addFilter (11-14)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Type check / check-types
  • GitHub Check: Linters / lint
  • GitHub Check: Tests / Unit
🔇 Additional comments (2)
apps/web/playwright/out-of-office.e2e.ts (2)

781-783: Good fix: set waiter before firing the request.

Creating the response waiter before calling addFilter removes the race. LGTM.


842-849: Good fix: pre-arm waiters for both filter open and preset click.

Both waits are now created before their triggering actions. LGTM.

@anikdhabal anikdhabal changed the title fix: fixing few e2e flakes fix: few e2e flakes Sep 18, 2025
@github-actions
Copy link
Contributor

E2E results are ready!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

✅ Actions performed

Summary regeneration triggered.

@anikdhabal anikdhabal merged commit 5cf0553 into main Sep 18, 2025
110 of 115 checks passed
@anikdhabal anikdhabal deleted the fix-few-e2e-flakes branch September 18, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only ready-for-e2e size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants