Skip to content

The open alternative to Salesforce, designed for AI.

Wait for the auth UI before choosing email login in e2e tests (#28426)

Charles Bochetf4288276e564
diff --git a/packages/twenty-e2e-testing/lib/pom/loginPage.ts b/packages/twenty-e2e-testing/lib/pom/loginPage.ts
index 336baa09dc5..65809e6f93d 100644
--- a/packages/twenty-e2e-testing/lib/pom/loginPage.ts
+++ b/packages/twenty-e2e-testing/lib/pom/loginPage.ts
@@ -1,4 +1,4 @@
-import { type Locator, type Page } from '@playwright/test';
+import { expect, type Locator, type Page } from '@playwright/test';
export class LoginPage {
private readonly loginWithGoogleButton: Locator;
@@ -100,10 +100,12 @@ export class LoginPage {
}
async clickLoginWithEmailIfVisible() {
- try {
- await this.loginWithEmailButton.click({ timeout: 3000 });
- } catch {
- // Button not found - email field might already be visible (SSO-only or different auth flow)
+ await expect(
+ this.loginWithEmailButton.or(this.emailField).first(),
+ ).toBeVisible({ timeout: 30000 });
+
+ if (await this.loginWithEmailButton.isVisible()) {
+ await this.loginWithEmailButton.click();
}
}