diff --git a/.changeset/mosaic-user-profile-step2-tests.md b/.changeset/mosaic-user-profile-step2-tests.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/mosaic-user-profile-step2-tests.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/mosaic/src/features/user-profile/user-profile-enterprise-accounts-section/__tests__/user-profile-enterprise-accounts-projection.test.ts b/packages/mosaic/src/features/user-profile/user-profile-enterprise-accounts-section/__tests__/user-profile-enterprise-accounts-projection.test.ts index 499ebb3db16..f314626e32a 100644 --- a/packages/mosaic/src/features/user-profile/user-profile-enterprise-accounts-section/__tests__/user-profile-enterprise-accounts-projection.test.ts +++ b/packages/mosaic/src/features/user-profile/user-profile-enterprise-accounts-section/__tests__/user-profile-enterprise-accounts-projection.test.ts @@ -31,15 +31,16 @@ describe('projectEnterpriseAccounts', () => { { ...linked, provider, + enterpriseConnection: { ...linked.enterpriseConnection, logoPublicUrl: 'https://img.example/linked.png' }, }, ], - connections: [{ ...connection('available'), provider }], + connections: [{ ...connection('available'), provider, logoPublicUrl: 'https://img.example/available.png' }], }); expect(projection).toMatchObject({ status: 'ready', - accounts: [{ monochromeIcon }], - connections: [{ monochromeIcon }], + accounts: [{ monochromeIcon, iconUrl: 'https://img.example/linked.png' }], + connections: [{ monochromeIcon, iconUrl: 'https://img.example/available.png' }], }); }); diff --git a/packages/mosaic/src/features/user-profile/user-profile-passkeys-section/__tests__/user-profile-passkeys-validation.feature.test.tsx b/packages/mosaic/src/features/user-profile/user-profile-passkeys-section/__tests__/user-profile-passkeys-validation.feature.test.tsx index 92a14621ffa..4b23ef40bd3 100644 --- a/packages/mosaic/src/features/user-profile/user-profile-passkeys-section/__tests__/user-profile-passkeys-validation.feature.test.tsx +++ b/packages/mosaic/src/features/user-profile/user-profile-passkeys-section/__tests__/user-profile-passkeys-validation.feature.test.tsx @@ -93,7 +93,7 @@ describe('Validating a passkey name', () => { const input = within(dialog).getByRole('textbox', { name: 'Passkey name' }); const save = screen.getByRole('button', { name: 'Save' }); await user.clear(input); - await user.type(input, '😀'.repeat(65)); + await user.type(input, `${'😀'.repeat(64)}a`); await user.tab(); expect(input).toHaveAttribute('aria-invalid', 'true'); expect(save).toHaveAttribute('aria-disabled', 'true'); diff --git a/packages/mosaic/src/features/user-profile/user-profile-password-section/__tests__/user-profile-password-section.feature.test.tsx b/packages/mosaic/src/features/user-profile/user-profile-password-section/__tests__/user-profile-password-section.feature.test.tsx index c316d2e4849..ec5f7d4a0cf 100644 --- a/packages/mosaic/src/features/user-profile/user-profile-password-section/__tests__/user-profile-password-section.feature.test.tsx +++ b/packages/mosaic/src/features/user-profile/user-profile-password-section/__tests__/user-profile-password-section.feature.test.tsx @@ -151,7 +151,7 @@ describe('Changing a password', () => { expect(fapi.passwordUpdates).toHaveLength(1); }); - it('shows feedback when the password strength checker cannot load', async () => { + it('keeps showing the length rule when the strength checker cannot load, then reports the failure', async () => { const environment = fapiEnvironment(); environment.user_settings.password_settings.show_zxcvbn = true; serveFapi({ environment, client: fapiClient([fapiSession({ id: 'sess_1', user: alice })]) }); @@ -164,7 +164,13 @@ describe('Changing a password', () => { const user = userEvent.setup(); await user.click(screen.getByRole('button', { name: 'Change password' })); await waitFor(() => expect(screen.getByLabelText('Current password')).toHaveFocus()); - await user.type(screen.getByLabelText('New password'), 'new-password-123'); + await user.type(screen.getByLabelText('New password'), 'new'); + await waitFor(() => + expect(screen.getByLabelText('New password')).toHaveAccessibleDescription( + 'Your password must contain 8 or more characters.', + ), + ); + await user.type(screen.getByLabelText('New password'), '-password-123'); await waitFor(() => expect(screen.getByLabelText('New password')).toHaveAccessibleDescription( @@ -549,6 +555,21 @@ describe('Changing a password', () => { await user.click(screen.getByRole('button', { name: 'Save changes' })); await waitFor(() => expect(fapi.passwordUpdates).toHaveLength(1)); }); + + it('does not judge password strength when the instance turns the checker off', async () => { + const environment = fapiEnvironment(); + environment.user_settings.password_settings.min_zxcvbn_strength = 3; + await renderPassword(alice, environment); + const user = userEvent.setup(); + await user.click(screen.getByRole('button', { name: 'Change password' })); + await user.type(screen.getByLabelText('New password'), 'password123'); + + await waitFor(() => + expect(screen.getByLabelText('New password')).toHaveAccessibleDescription( + 'Your password meets all the necessary requirements.', + ), + ); + }); }); describe('Deferred password behavior', () => {