Skip to content

The open alternative to Salesforce, designed for AI.

fix: e2e login test - handle optional Continue with Email button (#17146)

Félix Malfaitd95ff4e25225
diff --git a/packages/twenty-e2e-testing/lib/pom/loginPage.ts b/packages/twenty-e2e-testing/lib/pom/loginPage.ts
index 754556b2969..7e87d79153e 100644
--- a/packages/twenty-e2e-testing/lib/pom/loginPage.ts
+++ b/packages/twenty-e2e-testing/lib/pom/loginPage.ts
@@ -85,6 +85,13 @@ export class LoginPage {
await this.loginWithEmailButton.click();
}
+ async clickLoginWithEmailIfVisible() {
+ const isVisible = await this.loginWithEmailButton.isVisible();
+ if (isVisible) {
+ await this.loginWithEmailButton.click();
+ }
+ }
+
async clickContinueButton() {
await this.continueButton.click();
}
diff --git a/packages/twenty-e2e-testing/tests/login.setup.ts b/packages/twenty-e2e-testing/tests/login.setup.ts
index 2dde4c701c2..4606fcdc43d 100644
--- a/packages/twenty-e2e-testing/tests/login.setup.ts
+++ b/packages/twenty-e2e-testing/tests/login.setup.ts
@@ -18,19 +18,15 @@ test('Login test', async ({ loginPage, page }) => {
'Logging in '.concat(page.url(), ' as ', process.env.DEFAULT_LOGIN),
async () => {
await page.waitForLoadState('networkidle');
- if (
- page.url().includes('app.twenty-next.com') ||
- !page.url().includes('app.localhost:3001')
- ) {
- await loginPage.clickLoginWithEmail();
- }
+ // Click "Continue with Email" if visible (may be skipped if password is the only auth method)
+ await loginPage.clickLoginWithEmailIfVisible();
await loginPage.typeEmail(process.env.DEFAULT_LOGIN);
await loginPage.clickContinueButton();
await loginPage.typePassword(process.env.DEFAULT_PASSWORD);
await page.waitForLoadState('networkidle');
await loginPage.clickSignInButton();
await page.waitForLoadState('networkidle');
- await expect(page.getByText(/Welcome to .+/)).not.toBeVisible();
+ await expect(page.getByText(/Welcome, .+/)).not.toBeVisible();
await expect(page.getByText('Choose a workspace')).toBeVisible();
await page.getByText('Apple', {exact: true}).click();
await page.waitForFunction(() => window.location.href.includes('verify'));