fix: resolve flaky team-management E2E test (#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>
This commit is contained in:
co-authored by
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
ecc5e66fd4
commit
e073cbd5ea
@@ -29,8 +29,7 @@ test.describe("Teams", () => {
|
||||
await page.goto("/teams");
|
||||
|
||||
await test.step("Can create team", async () => {
|
||||
// Click the new team button
|
||||
await page.locator("[data-testid=new-team-btn]").click();
|
||||
await page.locator("[data-testid=new-team-btn]").first().click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Fill team name input (new onboarding-v3 style flow)
|
||||
await page.locator('[data-testid="team-name-input"]').fill(`${user.username}'s Team`);
|
||||
@@ -63,7 +62,7 @@ test.describe("Teams", () => {
|
||||
await page.getByTestId("disband-team-button").click();
|
||||
await page.getByTestId("dialog-confirmation").click();
|
||||
await page.waitForURL("/teams");
|
||||
expect(await page.locator(`text=${user.username}'s Team`).count()).toEqual(0);
|
||||
await expect(page.locator(`text=${user.username}'s Team`)).toBeHidden({ timeout: 10000 });
|
||||
|
||||
// Cleanup the invited user since they were created without our fixtures
|
||||
const invitedUser = await prisma.user.findUnique({ where: { email: inviteeEmail } });
|
||||
|
||||
Reference in New Issue
Block a user