Skip to content

Commit

Permalink
test(clerk-js): Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
octoper committed Dec 15, 2023
1 parent e61ecce commit 7079c6e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('ResetPassword', () => {
const { wrapper } = await createFixtures();

render(<ResetPassword />, { wrapper });
screen.getByRole('heading', { name: /Reset password/i });
screen.getByRole('heading', { name: /Set new password/i });

screen.getByLabelText(/New password/i);
screen.getByLabelText(/Confirm password/i);
Expand All @@ -34,7 +34,7 @@ describe('ResetPassword', () => {

await runFakeTimers(async () => {
render(<ResetPassword />, { wrapper });
screen.getByRole('heading', { name: /Reset password/i });
screen.getByRole('heading', { name: /Set new password/i });

const passwordField = screen.getByLabelText(/New password/i);
fireEvent.focus(passwordField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('ResetPasswordSuccess', () => {
const { wrapper } = await createFixtures();

render(<ResetPasswordSuccess />, { wrapper });
screen.getByRole('heading', { name: /Reset password/i });
screen.getByRole('heading', { name: /Set new password/i });
screen.getByText(/Your password was successfully changed. Signing you in, please wait a moment/i);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('SignInFactorOne', () => {
const { userEvent } = render(<SignInFactorOne />, { wrapper });
await userEvent.click(screen.getByText(/Forgot password/i));
screen.getByText('Use another method');
expect(screen.queryByText('Or, sign in with another method.')).not.toBeInTheDocument();
expect(screen.queryByText('Or, sign in with another method')).not.toBeInTheDocument();
screen.getByText(`Email code to ${email}`);
expect(screen.queryByText('Sign in with your password')).not.toBeInTheDocument();
});
Expand All @@ -162,10 +162,9 @@ describe('SignInFactorOne', () => {
fixtures.signIn.prepareFirstFactor.mockReturnValueOnce(Promise.resolve({} as SignInResource));
await userEvent.click(screen.getByText(/Forgot password/i));
screen.getByText('Forgot Password?');
screen.getByText('Or, sign in with another method.');
screen.getByText('Or, sign in with another method');
await userEvent.click(screen.getByText('Reset your password'));
screen.getByText('Check your email');
screen.getByText('to reset your password');
screen.getByText('First, enter the code sent to your email ID');
});

it('shows a UI error when submission fails', async () => {
Expand Down Expand Up @@ -247,8 +246,7 @@ describe('SignInFactorOne', () => {
screen.getByText('Forgot Password?');

await userEvent.click(screen.getByText('Reset your password'));
screen.getByText('Check your phone');
screen.getByText('to reset your password');
screen.getByText('First, enter the code sent to your phone');
});

it('redirects to `reset-password` on successful code verification', async () => {
Expand Down Expand Up @@ -701,7 +699,7 @@ describe('SignInFactorOne', () => {
screen.getByText(`Email link to ${email}`);
await userEvent.click(screen.getByText(`Email link to ${email}`));
screen.getByText('Check your email');
screen.getByText('Verification link');
screen.getByText('Use the verification link sent to your email');
});

it('clicking the email code method should show the email code input', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('SignInStart', () => {
f.withSupportEmail();
});
render(<SignInStart />, { wrapper });
screen.getByText('Sign in');
screen.getAllByText(/sign in to .*/i);
});

describe('Login Methods', () => {
Expand Down

0 comments on commit 7079c6e

Please sign in to comment.