Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/mosaic-user-profile-step2-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -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' }],
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 })]) });
Expand All @@ -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(
Expand Down Expand Up @@ -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', () => {
Expand Down
Loading