From d95ff4e25225abe4b387a4bf0c750c316514668e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Wed, 14 Jan 2026 12:57:15 +0100 Subject: [PATCH] fix: e2e login test - handle optional Continue with Email button (#17146) ## Summary The e2e login test was failing because it unconditionally tried to click 'Continue with Email' button, but this button doesn't exist when password is the only auth method. ## Root Cause In `SignInUpWorkspaceScopeFormEffect.tsx`, when a workspace only has password authentication (no Google/Microsoft/SSO), the effect automatically calls `continueWithEmail()` which skips the Init step and shows the email field directly. ## Changes 1. **loginPage.ts**: Added `clickLoginWithEmailIfVisible()` method that only clicks the button if it exists 2. **login.setup.ts**: - Replaced `clickLoginWithEmail()` with `clickLoginWithEmailIfVisible()` - Updated regex from `/Welcome to .+/` to `/Welcome, .+/` to match the recent UI change --- packages/twenty-e2e-testing/lib/pom/loginPage.ts | 7 +++++++ packages/twenty-e2e-testing/tests/login.setup.ts | 10 +++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/twenty-e2e-testing/lib/pom/loginPage.ts b/packages/twenty-e2e-testing/lib/pom/loginPage.ts index 754556b296..7e87d79153 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 2dde4c701c..4606fcdc43 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'));