From ef788239481235988613b745462cde18f9f706bb Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Mon, 26 Aug 2024 19:35:57 +0800 Subject: [PATCH] refactor(experience): remove redundant `defaultType` prop for `SmartInputField` (#6517) --- .../IdentifierRegisterForm/index.test.tsx | 22 ++++++------- .../IdentifierRegisterForm/index.tsx | 17 +++++----- .../components/IdentifierSignInForm/index.tsx | 1 - .../InputFields/SmartInputField/index.tsx | 4 +-- .../SmartInputField/use-smart-input-field.ts | 32 ++++--------------- .../InputFields/SmartInputField/utils.ts | 12 ++++--- .../components/PasswordSignInForm/index.tsx | 1 - .../Continue/IdentifierProfileForm/index.tsx | 1 - .../ForgotPasswordForm/index.test.tsx | 7 ++-- .../ForgotPasswordForm/index.tsx | 11 +------ .../src/pages/ForgotPassword/index.tsx | 7 +--- .../src/pages/Register/index.test.tsx | 4 +-- .../src/tests/console/bootstrap.test.ts | 2 +- .../src/tests/experience/bootstrap.test.ts | 2 +- .../experience/identifier-input-cache.test.ts | 2 +- .../experience/mfa/backup-code/index.test.ts | 2 +- .../mfa/totp/passcode-identifier-flow.test.ts | 4 +-- .../mfa/totp/password-identifier-flow.test.ts | 2 +- .../experience/mfa/user-controlled.test.ts | 2 +- .../experience/mfa/webauthn/index.test.ts | 2 +- .../tests/experience/password-policy.test.ts | 4 +-- 21 files changed, 54 insertions(+), 87 deletions(-) diff --git a/packages/experience/src/components/IdentifierRegisterForm/index.test.tsx b/packages/experience/src/components/IdentifierRegisterForm/index.test.tsx index 57ae0b43a..ee893b0f8 100644 --- a/packages/experience/src/components/IdentifierRegisterForm/index.test.tsx +++ b/packages/experience/src/components/IdentifierRegisterForm/index.test.tsx @@ -85,7 +85,7 @@ describe('', () => { ])('%p %p register form', (...signUpMethods) => { test('default render', () => { const { queryByText, container } = renderForm(signUpMethods); - expect(container.querySelector('input[name="id"]')).not.toBeNull(); + expect(container.querySelector('input[name=identifier]')).not.toBeNull(); expect(queryByText('action.create_account')).not.toBeNull(); expect(queryByText('description.terms_of_use')).not.toBeNull(); }); @@ -110,7 +110,7 @@ describe('', () => { test('username with initial numeric char should throw', async () => { const { queryByText, getByText, container } = renderForm(); const submitButton = getByText('action.create_account'); - const usernameInput = container.querySelector('input[name="id"]'); + const usernameInput = container.querySelector('input[name=identifier]'); assert(usernameInput, new Error('username input not found')); @@ -137,7 +137,7 @@ describe('', () => { test('username with special character should throw', async () => { const { queryByText, getByText, container } = renderForm(); const submitButton = getByText('action.create_account'); - const usernameInput = container.querySelector('input[name="id"]'); + const usernameInput = container.querySelector('input[name=identifier]'); assert(usernameInput, new Error('username input not found')); @@ -165,7 +165,7 @@ describe('', () => { const { getByText, queryByText, container } = renderForm(); const submitButton = getByText('action.create_account'); const termsButton = getByText('description.agree_with_terms'); - const usernameInput = container.querySelector('input[name="id"]'); + const usernameInput = container.querySelector('input[name=identifier]'); assert(usernameInput, new Error('username input not found')); @@ -200,7 +200,7 @@ describe('', () => { const { queryByText, getByText, container } = renderForm(signUpMethods); const submitButton = getByText('action.create_account'); - const emailInput = container.querySelector('input[name="id"]'); + const emailInput = container.querySelector('input[name=identifier]'); assert(emailInput, new Error('email input not found')); @@ -230,7 +230,7 @@ describe('', () => { const submitButton = getByText('action.create_account'); const termsButton = getByText('description.agree_with_terms'); - const emailInput = container.querySelector('input[name="id"]'); + const emailInput = container.querySelector('input[name=identifier]'); assert(emailInput, new Error('email input not found')); @@ -260,7 +260,7 @@ describe('', () => { const { queryByText, getByText, container } = renderForm(signUpMethods); const submitButton = getByText('action.create_account'); - const phoneInput = container.querySelector('input[name="id"]'); + const phoneInput = container.querySelector('input[name=identifier]'); assert(phoneInput, new Error('phone input not found')); @@ -289,7 +289,7 @@ describe('', () => { const submitButton = getByText('action.create_account'); const termsButton = getByText('description.agree_with_terms'); - const phoneInput = container.querySelector('input[name="id"]'); + const phoneInput = container.querySelector('input[name=identifier]'); assert(phoneInput, new Error('phone input not found')); @@ -326,7 +326,7 @@ describe('', () => { it('should not call check single sign-on connector when no single sign-on connector is enabled', async () => { const { getByText, container, queryByText } = renderForm([SignInIdentifier.Email]); const submitButton = getByText('action.create_account'); - const emailInput = container.querySelector('input[name="id"]'); + const emailInput = container.querySelector('input[name=identifier]'); const termsButton = getByText('description.agree_with_terms'); assert(emailInput, new Error('username input not found')); @@ -358,7 +358,7 @@ describe('', () => { mockSsoConnectors ); const submitButton = getByText('action.create_account'); - const emailInput = container.querySelector('input[name="id"]'); + const emailInput = container.querySelector('input[name=identifier]'); const termsButton = getByText('description.agree_with_terms'); assert(emailInput, new Error('username input not found')); @@ -393,7 +393,7 @@ describe('', () => { [SignInIdentifier.Email], mockSsoConnectors ); - const emailInput = container.querySelector('input[name="id"]'); + const emailInput = container.querySelector('input[name=identifier]'); const termsButton = getByText('description.agree_with_terms'); assert(emailInput, new Error('username input not found')); diff --git a/packages/experience/src/components/IdentifierRegisterForm/index.tsx b/packages/experience/src/components/IdentifierRegisterForm/index.tsx index 91b80c469..47265c4ac 100644 --- a/packages/experience/src/components/IdentifierRegisterForm/index.tsx +++ b/packages/experience/src/components/IdentifierRegisterForm/index.tsx @@ -27,7 +27,7 @@ type Props = { }; type FormState = { - id: IdentifierInputValue; + identifier: IdentifierInputValue; }; const IdentifierRegisterForm = ({ className, autoFocus, signUpMethods }: Props) => { @@ -46,11 +46,13 @@ const IdentifierRegisterForm = ({ className, autoFocus, signUpMethods }: Props) control, } = useForm({ reValidateMode: 'onBlur', - defaultValues: { id: prefilledIdentifier }, + defaultValues: { identifier: prefilledIdentifier }, }); // Watch identifier field and check single sign on method availability - const { showSingleSignOnForm, navigateToSingleSignOn } = useSingleSignOnWatch(watch('id')); + const { showSingleSignOnForm, navigateToSingleSignOn } = useSingleSignOnWatch( + watch('identifier') + ); useEffect(() => { if (!isValid) { @@ -62,7 +64,7 @@ const IdentifierRegisterForm = ({ className, autoFocus, signUpMethods }: Props) async (event?: React.FormEvent) => { clearErrorMessage(); - void handleSubmit(async ({ id: { type, value } }) => { + void handleSubmit(async ({ identifier: { type, value } }) => { if (!type) { return; } @@ -101,7 +103,7 @@ const IdentifierRegisterForm = ({ className, autoFocus, signUpMethods }: Props)
{ if (!type || !value) { @@ -126,9 +128,8 @@ const IdentifierRegisterForm = ({ className, autoFocus, signUpMethods }: Props) className={styles.inputField} {...field} defaultValue={field.value.value} - defaultType={field.value.type} - isDanger={!!errors.id || !!errorMessage} - errorMessage={errors.id?.message} + isDanger={!!errors.identifier || !!errorMessage} + errorMessage={errors.identifier?.message} enabledTypes={signUpMethods} /> )} diff --git a/packages/experience/src/components/IdentifierSignInForm/index.tsx b/packages/experience/src/components/IdentifierSignInForm/index.tsx index 70b106e42..ac1d3c8bc 100644 --- a/packages/experience/src/components/IdentifierSignInForm/index.tsx +++ b/packages/experience/src/components/IdentifierSignInForm/index.tsx @@ -130,7 +130,6 @@ const IdentifierSignInForm = ({ className, autoFocus, signInMethods }: Props) => isDanger={!!errors.identifier || !!errorMessage} errorMessage={errors.identifier?.message} enabledTypes={enabledSignInMethods} - defaultType={field.value.type} defaultValue={field.value.value} /> )} diff --git a/packages/experience/src/components/InputFields/SmartInputField/index.tsx b/packages/experience/src/components/InputFields/SmartInputField/index.tsx index fa4f062bd..e0e631a28 100644 --- a/packages/experience/src/components/InputFields/SmartInputField/index.tsx +++ b/packages/experience/src/components/InputFields/SmartInputField/index.tsx @@ -23,7 +23,6 @@ type Props = Omit, 'onChange' | 'prefix' | 'value'> readonly isDanger?: boolean; readonly enabledTypes?: IdentifierInputType[]; - readonly defaultType?: IdentifierInputType; readonly defaultValue?: string; readonly onChange?: (data: IdentifierInputValue) => void; @@ -32,7 +31,7 @@ type Props = Omit, 'onChange' | 'prefix' | 'value'> const AnimatedInputField = animated(InputField); const SmartInputField = ( - { defaultValue, defaultType, enabledTypes = [], onChange, ...rest }: Props, + { defaultValue, enabledTypes = [], onChange, ...rest }: Props, ref: Ref> ) => { const innerRef = useRef(null); @@ -46,7 +45,6 @@ const SmartInputField = ( onInputValueClear, identifierType, } = useSmartInputField({ - _defaultType: defaultType, defaultValue, enabledTypes, }); diff --git a/packages/experience/src/components/InputFields/SmartInputField/use-smart-input-field.ts b/packages/experience/src/components/InputFields/SmartInputField/use-smart-input-field.ts index 86cf87881..c24938920 100644 --- a/packages/experience/src/components/InputFields/SmartInputField/use-smart-input-field.ts +++ b/packages/experience/src/components/InputFields/SmartInputField/use-smart-input-field.ts @@ -1,5 +1,4 @@ import { SignInIdentifier } from '@logto/schemas'; -import { assert } from '@silverhand/essentials'; import { useState, useCallback, useMemo } from 'react'; import type { ChangeEventHandler } from 'react'; @@ -27,26 +26,16 @@ export type IdentifierInputValue = { type Props = { defaultValue?: string; - _defaultType?: IdentifierInputType; enabledTypes: IdentifierInputType[]; }; -const useSmartInputField = ({ _defaultType, defaultValue, enabledTypes }: Props) => { +const useSmartInputField = ({ defaultValue, enabledTypes }: Props) => { const enabledTypeSet = useMemo(() => new Set(enabledTypes), [enabledTypes]); - assert( - !_defaultType || enabledTypeSet.has(_defaultType), - new Error( - `Invalid input type. Current inputType ${ - _defaultType ?? '' - } is detected but missing in enabledTypes` - ) - ); - - // Parse default type from enabled types if default type is not provided and only one type is enabled + // Parse default type from enabled types and default value const defaultType = useMemo( - () => _defaultType ?? (enabledTypes.length === 1 ? enabledTypes[0] : undefined), - [_defaultType, enabledTypes] + () => detectIdentifierType({ value: defaultValue ?? '', enabledTypeSet }), + [defaultValue, enabledTypeSet] ); // Parse default value if provided @@ -55,14 +44,7 @@ const useSmartInputField = ({ _defaultType, defaultValue, enabledTypes }: Props) [defaultType, defaultValue] ); - const [currentType, setCurrentType] = useState( - detectIdentifierType({ - value: defaultValue ?? '', - enabledTypeSet, - defaultType, - currentType: defaultType, - }) - ); + const [currentType, setCurrentType] = useState(defaultType); const [countryCode, setCountryCode] = useState( defaultCountryCode ?? getDefaultCountryCallingCode() @@ -71,8 +53,8 @@ const useSmartInputField = ({ _defaultType, defaultValue, enabledTypes }: Props) const [inputValue, setInputValue] = useState(defaultInputValue ?? ''); const detectInputType = useCallback( - (value: string) => detectIdentifierType({ value, enabledTypeSet, defaultType, currentType }), - [defaultType, currentType, enabledTypeSet] + (value: string) => detectIdentifierType({ value, enabledTypeSet, currentType }), + [currentType, enabledTypeSet] ); const onCountryCodeChange = useCallback( diff --git a/packages/experience/src/components/InputFields/SmartInputField/utils.ts b/packages/experience/src/components/InputFields/SmartInputField/utils.ts index 120c2716c..c26b11642 100644 --- a/packages/experience/src/components/InputFields/SmartInputField/utils.ts +++ b/packages/experience/src/components/InputFields/SmartInputField/utils.ts @@ -46,23 +46,27 @@ const digitsRegex = /^\d*$/; type DetectIdentifierTypeParams = { value: string; enabledTypeSet: Set; - defaultType?: IdentifierInputType; currentType?: IdentifierInputType; }; export const detectIdentifierType = ({ value, enabledTypeSet, - defaultType, currentType, }: DetectIdentifierTypeParams) => { - // Reset InputType if (!value && enabledTypeSet.size > 1) { + /** + * Multiple types are enabled, so we cannot detect the type without the value. + * Return `undefined` since the type is not determined. + */ return; } if (enabledTypeSet.size === 1) { - return defaultType; + /** + * Only one type enabled, so we limit the type to the default type. + */ + return Array.from(enabledTypeSet)[0]; } const hasAtSymbol = value.includes('@'); diff --git a/packages/experience/src/components/PasswordSignInForm/index.tsx b/packages/experience/src/components/PasswordSignInForm/index.tsx index 16f4f7dd2..0b6821678 100644 --- a/packages/experience/src/components/PasswordSignInForm/index.tsx +++ b/packages/experience/src/components/PasswordSignInForm/index.tsx @@ -130,7 +130,6 @@ const PasswordSignInForm = ({ className, autoFocus, signInMethods }: Props) => { errorMessage={errors.identifier?.message} enabledTypes={signInMethods} defaultValue={field.value.value} - defaultType={field.value.type} /> )} /> diff --git a/packages/experience/src/pages/Continue/IdentifierProfileForm/index.tsx b/packages/experience/src/pages/Continue/IdentifierProfileForm/index.tsx index 28b965639..39fdfa662 100644 --- a/packages/experience/src/pages/Continue/IdentifierProfileForm/index.tsx +++ b/packages/experience/src/pages/Continue/IdentifierProfileForm/index.tsx @@ -105,7 +105,6 @@ const IdentifierProfileForm = ({ autoFocus={autoFocus} className={styles.inputField} {...field} - defaultType={defaultType} isDanger={!!errors.identifier} errorMessage={errors.identifier?.message} enabledTypes={enabledTypes} diff --git a/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.test.tsx b/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.test.tsx index 0688037fa..95229af50 100644 --- a/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.test.tsx +++ b/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.test.tsx @@ -32,12 +32,11 @@ describe('ForgotPasswordForm', () => { const phone = '13911111111'; const originalLocation = window.location; - const renderForm = (defaultType: VerificationCodeIdentifier, defaultValue?: string) => + const renderForm = (defaultValue?: string) => renderWithPageContext( @@ -57,7 +56,7 @@ describe('ForgotPasswordForm', () => { 'identifier: %s, value: %s', ({ identifier, value }) => { test(`forgot password form render properly with default ${identifier} value ${value}`, async () => { - const { container, queryByText } = renderForm(identifier, value); + const { container, queryByText } = renderForm(value); const identifierInput = container.querySelector(`input[name="identifier"]`); assert(identifierInput, new Error('identifier input should not be null')); @@ -73,7 +72,7 @@ describe('ForgotPasswordForm', () => { }); test(`send ${identifier} verification code properly`, async () => { - const { container, getByText } = renderForm(identifier, value); + const { container, getByText } = renderForm(value); const identifierInput = container.querySelector(`input[name="identifier"]`); assert(identifierInput, new Error('identifier input should not be null')); diff --git a/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.tsx b/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.tsx index 826e396e4..293d2661a 100644 --- a/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.tsx +++ b/packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.tsx @@ -19,7 +19,6 @@ type Props = { // eslint-disable-next-line react/boolean-prop-naming readonly autoFocus?: boolean; readonly defaultValue?: string; - readonly defaultType?: VerificationCodeIdentifier; readonly enabledTypes: VerificationCodeIdentifier[]; }; @@ -30,13 +29,7 @@ type FormState = { }; }; -const ForgotPasswordForm = ({ - className, - autoFocus, - defaultType, - defaultValue = '', - enabledTypes, -}: Props) => { +const ForgotPasswordForm = ({ className, autoFocus, defaultValue = '', enabledTypes }: Props) => { const { t } = useTranslation(); const { errorMessage, clearErrorMessage, onSubmit } = useSendVerificationCode( UserFlow.ForgotPassword @@ -52,7 +45,6 @@ const ForgotPasswordForm = ({ reValidateMode: 'onBlur', defaultValues: { identifier: { - type: defaultType, value: defaultValue, }, }, @@ -111,7 +103,6 @@ const ForgotPasswordForm = ({ autoFocus={autoFocus} className={styles.inputField} {...field} - defaultType={defaultType} defaultValue={defaultValue} isDanger={!!errors.identifier} errorMessage={errors.identifier?.message} diff --git a/packages/experience/src/pages/ForgotPassword/index.tsx b/packages/experience/src/pages/ForgotPassword/index.tsx index 2e82c9349..5ce846223 100644 --- a/packages/experience/src/pages/ForgotPassword/index.tsx +++ b/packages/experience/src/pages/ForgotPassword/index.tsx @@ -54,12 +54,7 @@ const ForgotPassword = () => { types: enabledMethods.map((method) => t(identifierInputDescriptionMap[method])), }} > - + ); }; diff --git a/packages/experience/src/pages/Register/index.test.tsx b/packages/experience/src/pages/Register/index.test.tsx index 53ce3afb7..25120e02e 100644 --- a/packages/experience/src/pages/Register/index.test.tsx +++ b/packages/experience/src/pages/Register/index.test.tsx @@ -35,7 +35,7 @@ describe('', () => { test.each(signUpTestCases)('renders with %o sign up settings', async (...signUp) => { const { queryByText, queryAllByText, container } = renderRegisterPage(); - expect(container.querySelector('input[name="id"]')).not.toBeNull(); + expect(container.querySelector('input[name=identifier]')).not.toBeNull(); expect(queryByText('action.create_account')).not.toBeNull(); // Social @@ -53,7 +53,7 @@ describe('', () => { mockSignInExperienceSettings.socialConnectors.length ); - expect(container.querySelector('input[name="id"]')).toBeNull(); + expect(container.querySelector('input[name=identifier]')).toBeNull(); expect(queryByText('action.create_account')).toBeNull(); }); diff --git a/packages/integration-tests/src/tests/console/bootstrap.test.ts b/packages/integration-tests/src/tests/console/bootstrap.test.ts index 103872cee..881d0c19d 100644 --- a/packages/integration-tests/src/tests/console/bootstrap.test.ts +++ b/packages/integration-tests/src/tests/console/bootstrap.test.ts @@ -67,7 +67,7 @@ describe('smoke testing for console admin account creation and sign-in', () => { expect(page.url()).toBe(new URL('register', logtoConsoleUrl).href); - await expect(page).toFill('input[name=id]', consoleUsername); + await expect(page).toFill('input[name=identifier]', consoleUsername); await expectNavigation(expect(page).toClick('button[name=submit]')); expect(page.url()).toBe(appendPathname('/register/password', logtoConsoleUrl).href); diff --git a/packages/integration-tests/src/tests/experience/bootstrap.test.ts b/packages/integration-tests/src/tests/experience/bootstrap.test.ts index 50e3298b4..2dbec7016 100644 --- a/packages/integration-tests/src/tests/experience/bootstrap.test.ts +++ b/packages/integration-tests/src/tests/experience/bootstrap.test.ts @@ -24,7 +24,7 @@ describe('smoke testing on the demo app', () => { // Open the demo app and navigate to the register page await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', credentials.username, { submit: true }); + await experience.toFillInput('identifier', credentials.username, { submit: true }); // Simple password tests experience.toBeAt('register/password'); diff --git a/packages/integration-tests/src/tests/experience/identifier-input-cache.test.ts b/packages/integration-tests/src/tests/experience/identifier-input-cache.test.ts index f00dc0325..68abb2bc3 100644 --- a/packages/integration-tests/src/tests/experience/identifier-input-cache.test.ts +++ b/packages/integration-tests/src/tests/experience/identifier-input-cache.test.ts @@ -56,6 +56,6 @@ describe('identifier input cache', () => { await experience.toClick('a', 'Create account'); experience.toMatchUrl(appendPath(new URL(logtoUrl), 'register').href); // The input should be empty - await experience.toMatchElement('input[name="id"][value=""]'); + await experience.toMatchElement('input[name=identifier][value=""]'); }); }); diff --git a/packages/integration-tests/src/tests/experience/mfa/backup-code/index.test.ts b/packages/integration-tests/src/tests/experience/mfa/backup-code/index.test.ts index 5c84232f5..55ac63ae7 100644 --- a/packages/integration-tests/src/tests/experience/mfa/backup-code/index.test.ts +++ b/packages/integration-tests/src/tests/experience/mfa/backup-code/index.test.ts @@ -46,7 +46,7 @@ describe('MFA - Backup Code', () => { const experience = new ExpectWebAuthnExperience(await browser.newPage()); await experience.setupVirtualAuthenticator(); await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', username, { submit: true }); + await experience.toFillInput('identifier', username, { submit: true }); experience.toBeAt('register/password'); await experience.toFillNewPasswords(password); experience.toBeAt('mfa-binding/WebAuthn'); diff --git a/packages/integration-tests/src/tests/experience/mfa/totp/passcode-identifier-flow.test.ts b/packages/integration-tests/src/tests/experience/mfa/totp/passcode-identifier-flow.test.ts index 1ae46f522..2cd3dcfcc 100644 --- a/packages/integration-tests/src/tests/experience/mfa/totp/passcode-identifier-flow.test.ts +++ b/packages/integration-tests/src/tests/experience/mfa/totp/passcode-identifier-flow.test.ts @@ -66,7 +66,7 @@ describe('MFA - TOTP', () => { const experience = new ExpectTotpExperience(await browser.newPage()); await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', context.userEmail, { submit: true }); + await experience.toFillInput('identifier', context.userEmail, { submit: true }); await experience.toCompleteVerification('register', 'Email'); context.setUpTotpSecret(await experience.toBindTotp()); await experience.verifyThenEnd(); @@ -146,7 +146,7 @@ describe('MFA - TOTP', () => { const experience = new ExpectTotpExperience(await browser.newPage()); await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', context.userPhone, { submit: true }); + await experience.toFillInput('identifier', context.userPhone, { submit: true }); await experience.toCompleteVerification('register', 'Sms'); context.setUpTotpSecret(await experience.toBindTotp()); diff --git a/packages/integration-tests/src/tests/experience/mfa/totp/password-identifier-flow.test.ts b/packages/integration-tests/src/tests/experience/mfa/totp/password-identifier-flow.test.ts index 6c4b40333..91d98a1b6 100644 --- a/packages/integration-tests/src/tests/experience/mfa/totp/password-identifier-flow.test.ts +++ b/packages/integration-tests/src/tests/experience/mfa/totp/password-identifier-flow.test.ts @@ -58,7 +58,7 @@ describe('MFA - TOTP', () => { const experience = new ExpectTotpExperience(await browser.newPage()); await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', context.username, { submit: true }); + await experience.toFillInput('identifier', context.username, { submit: true }); experience.toBeAt('register/password'); await experience.toFillNewPasswords(context.userPassword); diff --git a/packages/integration-tests/src/tests/experience/mfa/user-controlled.test.ts b/packages/integration-tests/src/tests/experience/mfa/user-controlled.test.ts index a66a0860f..1043413e7 100644 --- a/packages/integration-tests/src/tests/experience/mfa/user-controlled.test.ts +++ b/packages/integration-tests/src/tests/experience/mfa/user-controlled.test.ts @@ -50,7 +50,7 @@ describe('MFA - User controlled', () => { // Register await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', username, { submit: true }); + await experience.toFillInput('identifier', username, { submit: true }); experience.toBeAt('register/password'); await experience.toFillNewPasswords(password); diff --git a/packages/integration-tests/src/tests/experience/mfa/webauthn/index.test.ts b/packages/integration-tests/src/tests/experience/mfa/webauthn/index.test.ts index 81af7bdd0..22ccc4c71 100644 --- a/packages/integration-tests/src/tests/experience/mfa/webauthn/index.test.ts +++ b/packages/integration-tests/src/tests/experience/mfa/webauthn/index.test.ts @@ -47,7 +47,7 @@ describe('MFA - WebAuthn', () => { const experience = new ExpectWebAuthnExperience(await browser.newPage()); await experience.setupVirtualAuthenticator(); await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', username, { submit: true }); + await experience.toFillInput('identifier', username, { submit: true }); experience.toBeAt('register/password'); await experience.toFillNewPasswords(password); await experience.toCreatePasskey(); diff --git a/packages/integration-tests/src/tests/experience/password-policy.test.ts b/packages/integration-tests/src/tests/experience/password-policy.test.ts index b2ea78e89..a34881608 100644 --- a/packages/integration-tests/src/tests/experience/password-policy.test.ts +++ b/packages/integration-tests/src/tests/experience/password-policy.test.ts @@ -41,7 +41,7 @@ describe('password policy', () => { // Open the demo app and navigate to the register page await experience.startWith(demoAppUrl, 'register'); - await experience.toFillInput('id', username, { submit: true }); + await experience.toFillInput('identifier', username, { submit: true }); // Password tests await experience.waitForPathname('register/password'); @@ -69,7 +69,7 @@ describe('password policy', () => { await experience.startWith(demoAppUrl, 'register'); // Complete verification code flow - await experience.toFillInput('id', email, { submit: true }); + await experience.toFillInput('identifier', email, { submit: true }); await experience.toCompleteVerification('register', 'Email'); await experience.waitForPathname('continue/password');