Skip to content

Commit 29dcc64

Browse files
FelixMalfaitlucasbordeau
authored andcommitted
fix: e2e login test - handle optional Continue with Email button (twentyhq#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
1 parent a711e0c commit 29dcc64

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/twenty-e2e-testing/lib/pom/loginPage.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ export class LoginPage {
8585
await this.loginWithEmailButton.click();
8686
}
8787

88+
async clickLoginWithEmailIfVisible() {
89+
const isVisible = await this.loginWithEmailButton.isVisible();
90+
if (isVisible) {
91+
await this.loginWithEmailButton.click();
92+
}
93+
}
94+
8895
async clickContinueButton() {
8996
await this.continueButton.click();
9097
}

packages/twenty-e2e-testing/tests/login.setup.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ test('Login test', async ({ loginPage, page }) => {
1818
'Logging in '.concat(page.url(), ' as ', process.env.DEFAULT_LOGIN),
1919
async () => {
2020
await page.waitForLoadState('networkidle');
21-
if (
22-
page.url().includes('app.twenty-next.com') ||
23-
!page.url().includes('app.localhost:3001')
24-
) {
25-
await loginPage.clickLoginWithEmail();
26-
}
21+
// Click "Continue with Email" if visible (may be skipped if password is the only auth method)
22+
await loginPage.clickLoginWithEmailIfVisible();
2723
await loginPage.typeEmail(process.env.DEFAULT_LOGIN);
2824
await loginPage.clickContinueButton();
2925
await loginPage.typePassword(process.env.DEFAULT_PASSWORD);
3026
await page.waitForLoadState('networkidle');
3127
await loginPage.clickSignInButton();
3228
await page.waitForLoadState('networkidle');
33-
await expect(page.getByText(/Welcome to .+/)).not.toBeVisible();
29+
await expect(page.getByText(/Welcome, .+/)).not.toBeVisible();
3430
await expect(page.getByText('Choose a workspace')).toBeVisible();
3531
await page.getByText('Apple', {exact: true}).click();
3632
await page.waitForFunction(() => window.location.href.includes('verify'));

0 commit comments

Comments
 (0)