fix: improve E2E test stability and reduce flakiness (#25897)
* fix: improve E2E test stability and reduce flakiness - Replace hardcoded waits with proper Playwright waitFor assertions in slot selection - Add explicit waits for calendar and time slot elements to be visible before clicking - Replace fixed 2s wait in gotoRoutingLink with networkidle wait - Replace fixed 5s email wait with retry logic (10 retries, 500ms intervals) - Use unique usernames with timestamps to avoid parallel test collisions - Use features fixture instead of direct prisma calls for feature flag mutations - Fix login.e2e.ts to use unique username instead of hardcoded 'pro' - Fix signup.e2e.ts to use unique usernames and proper feature flag handling - Remove unused 'users' parameter from tests that don't need it Co-Authored-By: Volnei Munhoz <[email protected]> * perf: replace waitForTimeout with smart waits for faster E2E tests - Replace 30 waitForTimeout calls with proper Playwright waits - Use waitFor({ state: 'visible' }) for element visibility - Use waitForLoadState('networkidle') for page load completion - Use waitForFunction for localStorage state changes Performance improvements: - limit-tab.e2e.ts: 10s fixed wait -> element visibility wait - booking-duplicate-api-calls.e2e.ts: 5s fixed wait -> networkidle - change-theme.e2e.ts: 3s fixed wait -> localStorage state check - team-invitation.e2e.ts: multiple 500ms-3s waits -> element waits - booking-seats.e2e.ts: 2s waits -> dropdown visibility waits - embed-code-generator.e2e.ts: 1s waits -> iframe visibility waits - organization-privacy.e2e.ts: 500ms waits -> element/networkidle waits - organization-invitation.e2e.ts: 500ms-1s waits -> element waits - analyticsApps.e2e.ts: 1s wait -> networkidle - integrations.e2e.ts: 1s wait -> calendar element wait - fixtures/apps.ts: 1s waits -> element visibility waits Co-Authored-By: Volnei Munhoz <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
14 files changed
+114
-72
No files matched your search
@@ -582,7 +582,8 @@ async function expectUserToBeAMemberOfTeam({
|
||||
// Check newly invited member is not pending anymore
|
||||
await page.goto(`/settings/teams/${teamId}/members`);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await page.waitForTimeout(1000); // Add a small delay to ensure UI is fully loaded
|
||||
// Wait for the member list to be ready instead of fixed 1s wait
|
||||
await page.locator(`[data-testid="member-${username}"]`).waitFor({ state: "visible", timeout: 10000 });
|
||||
expect(
|
||||
(
|
||||
await page
|
||||
@@ -612,7 +613,8 @@ async function copyInviteLink(page: Page, teamPage?: boolean) {
|
||||
if (teamIdMatch && teamIdMatch[1]) {
|
||||
await page.goto(`/settings/teams/${teamIdMatch[1]}/members`);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await page.waitForTimeout(500); // Add a small delay to ensure UI is fully loaded
|
||||
// Wait for the new member button to be visible instead of fixed 500ms wait
|
||||
await page.getByTestId("new-member-button").waitFor({ state: "visible" });
|
||||
}
|
||||
await page.getByTestId("new-member-button").click();
|
||||
} else {
|
||||
|
||||
@@ -128,7 +128,8 @@ test.describe("Organization - Privacy", () => {
|
||||
|
||||
await page.goto(`/settings/teams/${teamId}/members`);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await page.waitForTimeout(500); // Add a small delay to ensure UI is fully loaded
|
||||
// Wait for the page content to be ready instead of fixed 500ms wait
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// As a user we can not see the member list when a team is private
|
||||
const hiddenTableLocator = await page.getByTestId("team-member-list-container");
|
||||
@@ -187,7 +188,8 @@ test.describe("Organization - Privacy", () => {
|
||||
// 1) All team members can see members in team
|
||||
await page.goto(`/settings/teams/${teamId}/members`);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await page.waitForTimeout(500);
|
||||
// Wait for the member list to be ready instead of fixed 500ms wait
|
||||
await page.getByTestId("team-member-list-container").waitFor({ state: "visible", timeout: 5000 }).catch(() => {});
|
||||
const memberTableLocator = await page.getByTestId("team-member-list-container");
|
||||
await expect(memberTableLocator).toBeVisible();
|
||||
|
||||
@@ -201,7 +203,8 @@ test.describe("Organization - Privacy", () => {
|
||||
// 3) Admin/Owner can see members in team
|
||||
await page.goto(`/settings/teams/${teamId}/members`);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await page.waitForTimeout(500);
|
||||
// Wait for the member list to be ready instead of fixed 500ms wait
|
||||
await page.getByTestId("team-member-list-container").waitFor({ state: "visible", timeout: 5000 }).catch(() => {});
|
||||
const adminTableLocator = await page.getByTestId("team-member-list-container");
|
||||
await expect(adminTableLocator).toBeVisible();
|
||||
|
||||
|
||||
Reference in new issue
Block a user