Skip to content

Commit e073cbd

Browse files
fix: resolve flaky team-management E2E test (calcom#28575)
* fix: resolve flaky team-management E2E test Fix two failure modes in the 'Can create teams via Wizard' test: 1. Strict mode violation: locator('[data-testid=new-team-btn]') resolves to 2 elements during Next.js streaming/hydration. Fixed by using .first(). 2. Race condition in disband assertion: raw .count() check doesn't wait for UI to update after team deletion. Replaced with Playwright's auto-retrying toBeHidden() assertion with a 10s timeout. Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com> * chore: remove explanatory comments per review feedback Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent ecc5e66 commit e073cbd

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

apps/web/playwright/organization/team-management.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ test.describe("Teams", () => {
2929
await page.goto("/teams");
3030

3131
await test.step("Can create team", async () => {
32-
// Click the new team button
33-
await page.locator("[data-testid=new-team-btn]").click();
32+
await page.locator("[data-testid=new-team-btn]").first().click();
3433
await page.waitForLoadState("networkidle");
3534
// Fill team name input (new onboarding-v3 style flow)
3635
await page.locator('[data-testid="team-name-input"]').fill(`${user.username}'s Team`);
@@ -63,7 +62,7 @@ test.describe("Teams", () => {
6362
await page.getByTestId("disband-team-button").click();
6463
await page.getByTestId("dialog-confirmation").click();
6564
await page.waitForURL("/teams");
66-
expect(await page.locator(`text=${user.username}'s Team`).count()).toEqual(0);
65+
await expect(page.locator(`text=${user.username}'s Team`)).toBeHidden({ timeout: 10000 });
6766

6867
// Cleanup the invited user since they were created without our fixtures
6968
const invitedUser = await prisma.user.findUnique({ where: { email: inviteeEmail } });

0 commit comments

Comments
 (0)