diff --git a/packages/tests-e2e/playwright.config.ui.ts b/packages/tests-e2e/playwright.config.ui.ts index e3ea9f234..5c8032147 100644 --- a/packages/tests-e2e/playwright.config.ui.ts +++ b/packages/tests-e2e/playwright.config.ui.ts @@ -12,35 +12,112 @@ export default defineConfig({ trace: 'on-first-retry', }, projects: [ + //////////////////////////////////////////// + // default configs: + // - doubleOptIn: true + // - signupFlow: PasskeyWithEmailOTPFallback + // - allowUserRegistration: true + // - userFullNameRequired: true { - name: 'chromium', + name: 'default-setup', + testMatch: ['ui/default/setup.ts'], + }, + { + name: 'default-chromium', use: { ...devices['Desktop Chrome'] }, - testMatch: ['ui/**/*.*'], + testMatch: ['ui/default/**/*.*'], + dependencies: ['default-setup'], }, // { // name: 'firefox', // use: { ...devices['Desktop Firefox'] }, - // testMatch: ['ui/all-browsers/**/*.*'], + // testMatch: ['ui/default/all-browsers/**/*.*'], // }, { - name: 'webkit', + name: 'default-webkit', use: { ...devices['Desktop Safari'] }, - testMatch: ['ui/all-browsers/**/*.*'], + testMatch: ['ui/default/all-browsers/**/*.*'], + dependencies: ['default-setup'], }, { - name: 'Mobile Chrome', + name: 'default-mobileChrome', use: { ...devices['Pixel 7'] }, - testMatch: ['ui/**/*.*'], + testMatch: ['ui/default/**/*.*'], + dependencies: ['default-setup'], }, { - name: 'Mobile Safari', + name: 'default-mobileSafari', use: { ...devices['iPhone 14 Pro Max'] }, - testMatch: ['ui/all-browsers/**/*.*'], + testMatch: ['ui/default/all-browsers/**/*.*'], + dependencies: ['default-setup'], }, { - name: 'Microsoft Edge', + name: 'default-msedge', use: { ...devices['Desktop Edge'], channel: 'msedge' }, - testMatch: ['ui/**/*.*'], + testMatch: ['ui/default/**/*.*'], + dependencies: ['default-setup'], + }, + //////////////////////////////////////////// + // changed config: + // - doubleOptIn: false + { + name: 'noVerification-setup', + testMatch: ['ui/noVerification/setup.ts'], + dependencies: [ + 'default-chromium', + 'default-webkit', + 'default-mobileChrome', + 'default-mobileSafari', + 'default-msedge', + ], + }, + { + name: 'noVerification-chromium', + use: { ...devices['Desktop Chrome'] }, + testMatch: ['ui/noVerification/**/*.*'], + dependencies: ['noVerification-setup'], + }, + //////////////////////////////////////////// + // changed config: + // - signupFlow: EmailOTPSignup + { + name: 'verificationAtSignup-setup', + testMatch: ['ui/verificationAtSignup/setup.ts'], + dependencies: ['noVerification-chromium'], + }, + { + name: 'verificationAtSignup-chromium', + use: { ...devices['Desktop Chrome'] }, + testMatch: ['ui/verificationAtSignup/**/*.*'], + dependencies: ['verificationAtSignup-setup'], + }, + //////////////////////////////////////////// + // changed config: + // - allowUserRegistration: false + { + name: 'noSignup-setup', + testMatch: ['ui/noSignup/setup.ts'], + dependencies: ['verificationAtSignup-chromium'], + }, + { + name: 'noSignup-chromium', + use: { ...devices['Desktop Chrome'] }, + testMatch: ['ui/noSignup/**/*.*'], + dependencies: ['noSignup-setup'], + }, + //////////////////////////////////////////// + // changed config: + // - userFullNameRequired: false + { + name: 'noName-setup', + testMatch: ['ui/noName/setup.ts'], + dependencies: ['noSignup-chromium'], + }, + { + name: 'noName-chromium', + use: { ...devices['Desktop Chrome'] }, + testMatch: ['ui/noName/**/*.*'], + dependencies: ['noName-setup'], }, ], }); diff --git a/packages/tests-e2e/src/models/UILoginFlow.ts b/packages/tests-e2e/src/models/UILoginFlow.ts index 09662c977..ba342395a 100644 --- a/packages/tests-e2e/src/models/UILoginFlow.ts +++ b/packages/tests-e2e/src/models/UILoginFlow.ts @@ -135,6 +135,56 @@ export class UILoginFlow { return [name, email]; } + // only for "Verification at sign up" config + async createAccountWithVerificationAtSignup( + passkeySupported: boolean, + registerPasskey = true, + ): Promise<[name: string, email: string]> { + const name = UserManager.getUserForSignup(); + const email = `${name}@corbado.com`; + + await this.page.getByPlaceholder('Name').click(); + await this.page.getByPlaceholder('Name').fill(name); + await expect(this.page.getByPlaceholder('Name')).toHaveValue(name); + + await this.page.getByPlaceholder('Email address').click(); + await this.page.getByPlaceholder('Email address').fill(email); + await expect(this.page.getByPlaceholder('Email address')).toHaveValue(email); + + await this.page.getByRole('button', { name: 'Continue' }).click(); + await this.checkLandedOnScreen(ScreenNames.EnterOtp); + + await this.fillOTP(); + + if (passkeySupported) { + await this.checkLandedOnScreen(ScreenNames.PasskeyAppend); + + if (registerPasskey) { + await this.page.getByRole('button', { name: 'Activate' }).click(); + await this.inputPasskey(async () => { + await this.checkLandedOnScreen(ScreenNames.PasskeySuccess); + }); + + await this.page.getByRole('button', { name: 'Continue' }).click(); + await this.checkLandedOnScreen(ScreenNames.End); + await this.checkPasskeyRegistered(); + } else { + await this.page.getByRole('button', { name: 'Maybe later' }).click(); + await this.checkLandedOnScreen(ScreenNames.End); + await this.checkNoPasskeyRegistered(); + } + + await this.page.getByRole('button', { name: 'Logout' }).click(); + } else { + await this.checkLandedOnScreen(ScreenNames.End); + await this.checkNoPasskeyRegistered(); + } + + await loadAuth(this.page); + + return [name, email]; + } + async checkPasskeyRegistered() { await expect(this.page.locator('.cb-passkey-list-card')).toHaveCount(1); } @@ -151,6 +201,9 @@ export class UILoginFlow { case ScreenNames.EnterOtp: await expect(this.page.getByRole('heading', { level: 1 })).toContainText('Enter one-time passcode to'); break; + case ScreenNames.PasskeyCreate: + await expect(this.page.getByRole('heading', { level: 1 })).toContainText("Let's get you set up with"); + break; case ScreenNames.PasskeyBenefits: await expect(this.page.getByRole('heading', { level: 1 })).toHaveText('Passkeys'); break; diff --git a/packages/tests-e2e/src/ui/all-browsers/login/EmailOTP-functionality.spec.ts b/packages/tests-e2e/src/ui/default/all-browsers/login/EmailOTP-functionality.spec.ts similarity index 77% rename from packages/tests-e2e/src/ui/all-browsers/login/EmailOTP-functionality.spec.ts rename to packages/tests-e2e/src/ui/default/all-browsers/login/EmailOTP-functionality.spec.ts index b8794f6bd..139610e5f 100644 --- a/packages/tests-e2e/src/ui/all-browsers/login/EmailOTP-functionality.spec.ts +++ b/packages/tests-e2e/src/ui/default/all-browsers/login/EmailOTP-functionality.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('Login with email OTP proper user behavior', () => { test('with no passkey support', async ({ loginFlow }) => { diff --git a/packages/tests-e2e/src/ui/all-browsers/login/EnterOtpScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/all-browsers/login/EnterOtpScreen-robustness.spec.ts similarity index 94% rename from packages/tests-e2e/src/ui/all-browsers/login/EnterOtpScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/all-browsers/login/EnterOtpScreen-robustness.spec.ts index 4e3538067..0cf25f0d5 100644 --- a/packages/tests-e2e/src/ui/all-browsers/login/EnterOtpScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/all-browsers/login/EnterOtpScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { expect, test } from '../../../fixtures/UILoginTest'; -import { OtpType, ScreenNames } from '../../../utils/constants'; +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { OtpType, ScreenNames } from '../../../../utils/constants'; test.describe('EnterOtpScreen unproductive user behavior', () => { test('go back to Start', async ({ loginFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/all-browsers/login/StartScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/all-browsers/login/StartScreen-robustness.spec.ts similarity index 87% rename from packages/tests-e2e/src/ui/all-browsers/login/StartScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/all-browsers/login/StartScreen-robustness.spec.ts index d7cbef05d..b9c1e925c 100644 --- a/packages/tests-e2e/src/ui/all-browsers/login/StartScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/all-browsers/login/StartScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { expect, test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('StartScreen unproductive user behavior', () => { // TODO: add when bug is fixed diff --git a/packages/tests-e2e/src/ui/all-browsers/signup/EmailOTP-functionality.spec.ts b/packages/tests-e2e/src/ui/default/all-browsers/signup/EmailOTP-functionality.spec.ts similarity index 76% rename from packages/tests-e2e/src/ui/all-browsers/signup/EmailOTP-functionality.spec.ts rename to packages/tests-e2e/src/ui/default/all-browsers/signup/EmailOTP-functionality.spec.ts index c8d41f3a2..57fbdef38 100644 --- a/packages/tests-e2e/src/ui/all-browsers/signup/EmailOTP-functionality.spec.ts +++ b/packages/tests-e2e/src/ui/default/all-browsers/signup/EmailOTP-functionality.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('Signup with email OTP proper user behavior', () => { test('with no passkey support', async ({ signupFlow }) => { diff --git a/packages/tests-e2e/src/ui/all-browsers/signup/EnterOtpScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/all-browsers/signup/EnterOtpScreen-robustness.spec.ts similarity index 93% rename from packages/tests-e2e/src/ui/all-browsers/signup/EnterOtpScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/all-browsers/signup/EnterOtpScreen-robustness.spec.ts index df102a9c0..ea9659063 100644 --- a/packages/tests-e2e/src/ui/all-browsers/signup/EnterOtpScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/all-browsers/signup/EnterOtpScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { expect, test } from '../../../fixtures/UISignupTest'; -import { OtpType, ScreenNames } from '../../../utils/constants'; +import { expect, test } from '../../../../fixtures/UISignupTest'; +import { OtpType, ScreenNames } from '../../../../utils/constants'; test.describe('EnterOtpScreen unproductive user behavior', () => { test('go back to InitiateSignup', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/all-browsers/signup/StartScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/all-browsers/signup/StartScreen-robustness.spec.ts similarity index 96% rename from packages/tests-e2e/src/ui/all-browsers/signup/StartScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/all-browsers/signup/StartScreen-robustness.spec.ts index 4e05a1470..d677069a1 100644 --- a/packages/tests-e2e/src/ui/all-browsers/signup/StartScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/all-browsers/signup/StartScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { expect, test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { expect, test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('StartScreen unproductive user behavior', () => { test('with empty name', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/login/EmailOTP-functionality.spec.ts b/packages/tests-e2e/src/ui/default/chromium/login/EmailOTP-functionality.spec.ts similarity index 84% rename from packages/tests-e2e/src/ui/chromium/login/EmailOTP-functionality.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/login/EmailOTP-functionality.spec.ts index 0f7eb70c0..818b84dc7 100644 --- a/packages/tests-e2e/src/ui/chromium/login/EmailOTP-functionality.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/login/EmailOTP-functionality.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('Login with email OTP proper user behavior', () => { test('with passkey support', async ({ loginFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/login/Passkey-functionality.spec.ts b/packages/tests-e2e/src/ui/default/chromium/login/Passkey-functionality.spec.ts similarity index 92% rename from packages/tests-e2e/src/ui/chromium/login/Passkey-functionality.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/login/Passkey-functionality.spec.ts index 861c50a43..25f4ad180 100644 --- a/packages/tests-e2e/src/ui/chromium/login/Passkey-functionality.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/login/Passkey-functionality.spec.ts @@ -1,5 +1,5 @@ -import { expect, test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('Login with passkey proper user behavior', () => { test('from Start', async ({ loginFlow, page }) => { @@ -40,6 +40,8 @@ test.describe('Login with passkey proper user behavior', () => { }); }); + // TODO: figure out why there's flakiness where conditional UI does not show up + // (almost always fails when running all tests wtf??? but never fails when running alone) test('from Start with conditional UI', async ({ loginFlow, page, channel }) => { if (channel) { test.skip(channel.includes('msedge'), 'Edge does not support conditional UI'); diff --git a/packages/tests-e2e/src/ui/chromium/login/PasskeyAppendScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/chromium/login/PasskeyAppendScreen-robustness.spec.ts similarity index 93% rename from packages/tests-e2e/src/ui/chromium/login/PasskeyAppendScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/login/PasskeyAppendScreen-robustness.spec.ts index 67e8bd36c..0de98b674 100644 --- a/packages/tests-e2e/src/ui/chromium/login/PasskeyAppendScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/login/PasskeyAppendScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('PasskeyAppendScreen unproductive user behavior', () => { test('go to PasskeyBenefits', async ({ loginFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/login/PasskeyBenefitsScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/chromium/login/PasskeyBenefitsScreen-robustness.spec.ts similarity index 81% rename from packages/tests-e2e/src/ui/chromium/login/PasskeyBenefitsScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/login/PasskeyBenefitsScreen-robustness.spec.ts index 8d8d59d12..e69997ce5 100644 --- a/packages/tests-e2e/src/ui/chromium/login/PasskeyBenefitsScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/login/PasskeyBenefitsScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('PasskeyBenefitsScreen unproductive user behavior', () => { test('declining goes to LoggedIn', async ({ loginFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/login/StartScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/chromium/login/StartScreen-robustness.spec.ts similarity index 68% rename from packages/tests-e2e/src/ui/chromium/login/StartScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/login/StartScreen-robustness.spec.ts index 1809c6de9..c0721dfd1 100644 --- a/packages/tests-e2e/src/ui/chromium/login/StartScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/login/StartScreen-robustness.spec.ts @@ -1,8 +1,9 @@ -import { expect, test } from '../../../fixtures/UILoginTest'; -import { ScreenNames } from '../../../utils/constants'; +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('StartScreen unproductive user behavior', () => { - test('logging in from different device goes to EnterOtp', async ({ loginFlow, page }) => { + // TODO: figure out how to simulate different users (simply adding a different webauthn doesn't work, maybe try adding credentials manually) + test.skip('logging in from different device goes to EnterOtp', async ({ loginFlow, page }) => { await loginFlow.initializeCDPSession(); await loginFlow.addWebAuthn(true); await loginFlow.loadAuth(); diff --git a/packages/tests-e2e/src/ui/chromium/signup/EmailOTP-functionality.spec.ts b/packages/tests-e2e/src/ui/default/chromium/signup/EmailOTP-functionality.spec.ts similarity index 87% rename from packages/tests-e2e/src/ui/chromium/signup/EmailOTP-functionality.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/signup/EmailOTP-functionality.spec.ts index 9793c8c33..cd8c3960c 100644 --- a/packages/tests-e2e/src/ui/chromium/signup/EmailOTP-functionality.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/signup/EmailOTP-functionality.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('Signup with email OTP proper user behavior', () => { test('with passkey support', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/signup/Passkey-functionality.spec.ts b/packages/tests-e2e/src/ui/default/chromium/signup/Passkey-functionality.spec.ts similarity index 95% rename from packages/tests-e2e/src/ui/chromium/signup/Passkey-functionality.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/signup/Passkey-functionality.spec.ts index ff23284b0..cfddaf2c5 100644 --- a/packages/tests-e2e/src/ui/chromium/signup/Passkey-functionality.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/signup/Passkey-functionality.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('Signup with passkey proper user behavior', () => { test('from PasskeySignup', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/signup/PasskeyAppendScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/chromium/signup/PasskeyAppendScreen-robustness.spec.ts similarity index 91% rename from packages/tests-e2e/src/ui/chromium/signup/PasskeyAppendScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/signup/PasskeyAppendScreen-robustness.spec.ts index 6b1766754..04b4ae038 100644 --- a/packages/tests-e2e/src/ui/chromium/signup/PasskeyAppendScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/signup/PasskeyAppendScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('PasskeyAppendScreen unproductive user behavior', () => { test('go to PasskeyBenefits', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/signup/PasskeyBenefitsScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/chromium/signup/PasskeyBenefitsScreen-robustness.spec.ts similarity index 79% rename from packages/tests-e2e/src/ui/chromium/signup/PasskeyBenefitsScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/signup/PasskeyBenefitsScreen-robustness.spec.ts index d15a60541..e0f6814f1 100644 --- a/packages/tests-e2e/src/ui/chromium/signup/PasskeyBenefitsScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/signup/PasskeyBenefitsScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('PasskeyBenefitsScreen unproductive user behavior', () => { test('skip to OTP method', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/chromium/signup/PasskeyCreateScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/default/chromium/signup/PasskeyCreateScreen-robustness.spec.ts similarity index 94% rename from packages/tests-e2e/src/ui/chromium/signup/PasskeyCreateScreen-robustness.spec.ts rename to packages/tests-e2e/src/ui/default/chromium/signup/PasskeyCreateScreen-robustness.spec.ts index 22f79840f..64e8279e0 100644 --- a/packages/tests-e2e/src/ui/chromium/signup/PasskeyCreateScreen-robustness.spec.ts +++ b/packages/tests-e2e/src/ui/default/chromium/signup/PasskeyCreateScreen-robustness.spec.ts @@ -1,5 +1,5 @@ -import { test } from '../../../fixtures/UISignupTest'; -import { ScreenNames } from '../../../utils/constants'; +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; test.describe('PasskeyCreateScreen unproductive user behavior', () => { test('change to OTP method', async ({ signupFlow, page }) => { diff --git a/packages/tests-e2e/src/ui/default/setup.ts b/packages/tests-e2e/src/ui/default/setup.ts new file mode 100644 index 000000000..cf358bc1b --- /dev/null +++ b/packages/tests-e2e/src/ui/default/setup.ts @@ -0,0 +1,7 @@ +import { test as setup } from '@playwright/test'; + +import { setBackendConfigs } from '../../utils/helperFunctions/setBackendConfigs'; + +setup('set default configs', async () => { + await setBackendConfigs(); +}); diff --git a/packages/tests-e2e/src/ui/noName/setup.ts b/packages/tests-e2e/src/ui/noName/setup.ts new file mode 100644 index 000000000..cdc025df4 --- /dev/null +++ b/packages/tests-e2e/src/ui/noName/setup.ts @@ -0,0 +1,7 @@ +import { test as setup } from '@playwright/test'; + +import { setBackendConfigs } from '../../utils/helperFunctions/setBackendConfigs'; + +setup('set default configs', async () => { + await setBackendConfigs({ userFullNameRequired: false }); +}); diff --git a/packages/tests-e2e/src/ui/noSignup/setup.ts b/packages/tests-e2e/src/ui/noSignup/setup.ts new file mode 100644 index 000000000..7c1135371 --- /dev/null +++ b/packages/tests-e2e/src/ui/noSignup/setup.ts @@ -0,0 +1,7 @@ +import { test as setup } from '@playwright/test'; + +import { setBackendConfigs } from '../../utils/helperFunctions/setBackendConfigs'; + +setup('set default configs', async () => { + await setBackendConfigs({ allowUserRegistration: false }); +}); diff --git a/packages/tests-e2e/src/ui/noVerification/chromium/login/Passkey-functionality.spec.ts b/packages/tests-e2e/src/ui/noVerification/chromium/login/Passkey-functionality.spec.ts new file mode 100644 index 000000000..f0ce676b2 --- /dev/null +++ b/packages/tests-e2e/src/ui/noVerification/chromium/login/Passkey-functionality.spec.ts @@ -0,0 +1,46 @@ +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; + +test.describe('Login with passkey proper user behavior', () => { + test('from Start', async ({ loginFlow, page }) => { + await loginFlow.initializeCDPSession(); + await loginFlow.addWebAuthn(true); + await loginFlow.loadAuth(); + + const [, email] = await loginFlow.createAccount(true); + + await loginFlow.navigateToStartScreen(); + + await page.getByPlaceholder('Email address').click(); + await page.getByPlaceholder('Email address').fill(email); + await expect(page.getByPlaceholder('Email address')).toHaveValue(email); + await page.getByRole('button', { name: 'Continue' }).click(); + + // second login prompts for passkey + await loginFlow.inputPasskey(async () => { + await loginFlow.checkLandedOnScreen(ScreenNames.End); + await loginFlow.checkPasskeyRegistered(); + }); + }); + + test('from Start with conditional UI', async ({ loginFlow, page, channel }) => { + if (channel) { + test.skip(channel.includes('msedge'), 'Edge does not support conditional UI'); + } + + await loginFlow.initializeCDPSession(); + await loginFlow.addWebAuthn(true); + await loginFlow.loadAuth(); + + void (await loginFlow.createAccount(true)); + + await loginFlow.navigateToStartScreen(); + + // Conditional UI shows up when email textbox is selected + await page.getByPlaceholder('Email address').click(); + await loginFlow.inputPasskey(async () => { + await loginFlow.checkLandedOnScreen(ScreenNames.End); + await loginFlow.checkPasskeyRegistered(); + }); + }); +}); diff --git a/packages/tests-e2e/src/ui/noVerification/chromium/login/StartScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/noVerification/chromium/login/StartScreen-robustness.spec.ts new file mode 100644 index 000000000..c0721dfd1 --- /dev/null +++ b/packages/tests-e2e/src/ui/noVerification/chromium/login/StartScreen-robustness.spec.ts @@ -0,0 +1,28 @@ +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; + +test.describe('StartScreen unproductive user behavior', () => { + // TODO: figure out how to simulate different users (simply adding a different webauthn doesn't work, maybe try adding credentials manually) + test.skip('logging in from different device goes to EnterOtp', async ({ loginFlow, page }) => { + await loginFlow.initializeCDPSession(); + await loginFlow.addWebAuthn(true); + await loginFlow.loadAuth(); + + const [, email] = await loginFlow.createAccount(true); + + // Remove webauthn used for signup + await loginFlow.removeWebAuthn(); + // add different webauthn + await loginFlow.addWebAuthn(true); + await loginFlow.loadAuth(); + + await loginFlow.navigateToStartScreen(); + + await page.getByPlaceholder('Email address').click(); + await page.getByPlaceholder('Email address').fill(email); + await expect(page.getByPlaceholder('Email address')).toHaveValue(email); + + await page.getByRole('button', { name: 'Continue' }).click(); + await loginFlow.checkLandedOnScreen(ScreenNames.EnterOtp); + }); +}); diff --git a/packages/tests-e2e/src/ui/noVerification/setup.ts b/packages/tests-e2e/src/ui/noVerification/setup.ts new file mode 100644 index 000000000..3d43b0dda --- /dev/null +++ b/packages/tests-e2e/src/ui/noVerification/setup.ts @@ -0,0 +1,7 @@ +import { test as setup } from '@playwright/test'; + +import { setBackendConfigs } from '../../utils/helperFunctions/setBackendConfigs'; + +setup('set default configs', async () => { + await setBackendConfigs({ doubleOptIn: false }); +}); diff --git a/packages/tests-e2e/src/ui/verificationAtSignup/all-browsers/signup/EnterOtpScreen-robustness.spec.ts b/packages/tests-e2e/src/ui/verificationAtSignup/all-browsers/signup/EnterOtpScreen-robustness.spec.ts new file mode 100644 index 000000000..52ec8a91f --- /dev/null +++ b/packages/tests-e2e/src/ui/verificationAtSignup/all-browsers/signup/EnterOtpScreen-robustness.spec.ts @@ -0,0 +1,22 @@ +import { expect, test } from '../../../../fixtures/UISignupTest'; +import { OtpType, ScreenNames } from '../../../../utils/constants'; + +test.describe('EnterOtpScreen unproductive user behavior', () => { + // TODO: unskip when bug is fixed + test.skip('go back to InitiateSignup', async ({ signupFlow, page }) => { + await signupFlow.navigateToEnterOtpScreen(false); + + await page.getByRole('button', { name: 'Cancel' }).click(); + await signupFlow.checkLandedOnScreen(ScreenNames.Start); + }); + + test('try to continue with incorrect OTP', async ({ signupFlow, page }) => { + await signupFlow.navigateToEnterOtpScreen(false); + + await signupFlow.fillOTP(OtpType.Incorrect); + await expect(page.getByText('The provided one-time passcode is not valid')).toBeVisible(); + await signupFlow.checkLandedOnScreen(ScreenNames.EnterOtp); + await page.getByRole('button', { name: 'Continue' }).click(); + await signupFlow.checkLandedOnScreen(ScreenNames.EnterOtp); + }); +}); diff --git a/packages/tests-e2e/src/ui/verificationAtSignup/chromium/login/Passkey-functionality.spec.ts b/packages/tests-e2e/src/ui/verificationAtSignup/chromium/login/Passkey-functionality.spec.ts new file mode 100644 index 000000000..292a1d9db --- /dev/null +++ b/packages/tests-e2e/src/ui/verificationAtSignup/chromium/login/Passkey-functionality.spec.ts @@ -0,0 +1,24 @@ +import { expect, test } from '../../../../fixtures/UILoginTest'; +import { ScreenNames } from '../../../../utils/constants'; + +test.describe('Login with passkey proper user behavior', () => { + test('from Start', async ({ loginFlow, page }) => { + await loginFlow.initializeCDPSession(); + await loginFlow.addWebAuthn(true); + await loginFlow.loadAuth(); + + const [, email] = await loginFlow.createAccountWithVerificationAtSignup(true); + + await loginFlow.navigateToStartScreen(); + + await page.getByPlaceholder('Email address').click(); + await page.getByPlaceholder('Email address').fill(email); + await expect(page.getByPlaceholder('Email address')).toHaveValue(email); + await page.getByRole('button', { name: 'Continue' }).click(); + + await loginFlow.inputPasskey(async () => { + await loginFlow.checkLandedOnScreen(ScreenNames.End); + await loginFlow.checkPasskeyRegistered(); + }); + }); +}); diff --git a/packages/tests-e2e/src/ui/verificationAtSignup/chromium/signup/EmailOTP-functionality.spec.ts b/packages/tests-e2e/src/ui/verificationAtSignup/chromium/signup/EmailOTP-functionality.spec.ts new file mode 100644 index 000000000..621da6c2a --- /dev/null +++ b/packages/tests-e2e/src/ui/verificationAtSignup/chromium/signup/EmailOTP-functionality.spec.ts @@ -0,0 +1,20 @@ +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; + +test.describe('Signup with email OTP proper user behavior', () => { + test('with passkey support', async ({ signupFlow, page }) => { + await signupFlow.initializeCDPSession(); + await signupFlow.addWebAuthn(true); + await signupFlow.loadAuth(); + + await signupFlow.createAccount(); + await signupFlow.checkLandedOnScreen(ScreenNames.EnterOtp); + + await signupFlow.fillOTP(); + await signupFlow.checkLandedOnScreen(ScreenNames.PasskeyAppend); + + await page.getByRole('button', { name: 'Maybe later' }).click(); + await signupFlow.checkLandedOnScreen(ScreenNames.End); + await signupFlow.checkNoPasskeyRegistered(); + }); +}); diff --git a/packages/tests-e2e/src/ui/verificationAtSignup/chromium/signup/Passkey-functionality.spec.ts b/packages/tests-e2e/src/ui/verificationAtSignup/chromium/signup/Passkey-functionality.spec.ts new file mode 100644 index 000000000..2b988389d --- /dev/null +++ b/packages/tests-e2e/src/ui/verificationAtSignup/chromium/signup/Passkey-functionality.spec.ts @@ -0,0 +1,25 @@ +import { test } from '../../../../fixtures/UISignupTest'; +import { ScreenNames } from '../../../../utils/constants'; + +test.describe('Signup with passkey proper user behavior', () => { + test('from PasskeyAppend', async ({ signupFlow, page }) => { + await signupFlow.initializeCDPSession(); + await signupFlow.addWebAuthn(true); + await signupFlow.loadAuth(); + + await signupFlow.createAccount(); + await signupFlow.checkLandedOnScreen(ScreenNames.EnterOtp); + + await signupFlow.fillOTP(); + await signupFlow.checkLandedOnScreen(ScreenNames.PasskeyAppend); + + await page.getByRole('button', { name: 'Activate' }).click(); + await signupFlow.inputPasskey(async () => { + await signupFlow.checkLandedOnScreen(ScreenNames.PasskeySuccess); + }); + + await page.getByRole('button', { name: 'Continue' }).click(); + await signupFlow.checkLandedOnScreen(ScreenNames.End); + await signupFlow.checkPasskeyRegistered(); + }); +}); diff --git a/packages/tests-e2e/src/ui/verificationAtSignup/setup.ts b/packages/tests-e2e/src/ui/verificationAtSignup/setup.ts new file mode 100644 index 000000000..51182bbf0 --- /dev/null +++ b/packages/tests-e2e/src/ui/verificationAtSignup/setup.ts @@ -0,0 +1,7 @@ +import { test as setup } from '@playwright/test'; + +import { SignupFlowConfig, setBackendConfigs } from '../../utils/helperFunctions/setBackendConfigs'; + +setup('set default configs', async () => { + await setBackendConfigs({ signupFlow: SignupFlowConfig.EmailOTPSignup }); +}); diff --git a/packages/tests-e2e/src/utils/helperFunctions/setBackendConfigs.ts b/packages/tests-e2e/src/utils/helperFunctions/setBackendConfigs.ts new file mode 100644 index 000000000..5f9164518 --- /dev/null +++ b/packages/tests-e2e/src/utils/helperFunctions/setBackendConfigs.ts @@ -0,0 +1,34 @@ +import { expect } from '@playwright/test'; + +export enum SignupFlowConfig { + PasskeyWithEmailOTPFallback = 'PasskeyWithEmailOTPFallback', + EmailOTPSignup = 'EmailOTPSignup', +} + +interface BackendConfigs { + doubleOptIn?: boolean; + signupFlow?: SignupFlowConfig; + allowUserRegistration?: boolean; + userFullNameRequired?: boolean; +} + +export async function setBackendConfigs(customConfigs?: BackendConfigs) { + const defaultConfigs = { + doubleOptIn: true, + signupFlow: SignupFlowConfig.PasskeyWithEmailOTPFallback, + allowUserRegistration: true, + userFullNameRequired: true, + }; + const configs = customConfigs ? Object.assign({}, defaultConfigs, customConfigs) : defaultConfigs; + + const response = await fetch('https://backendapi.corbado.io/v1/projectConfig', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic ' + btoa('pro-4561369486782475855:corbado1_rEFwQNKVA8Z4cUushVcgpL7shmSpCB'), + }, + body: JSON.stringify(configs), + }); + + expect(response.ok).toBeTruthy(); +}