From 7079c6efcb3448d54ae72a133728b34ca24daf5a Mon Sep 17 00:00:00 2001 From: Vaggelis Yfantis Date: Fri, 15 Dec 2023 16:44:53 +0200 Subject: [PATCH] test(clerk-js): Fix tests --- .../SignIn/__tests__/ResetPassword.test.tsx | 4 ++-- .../SignIn/__tests__/ResetPasswordSuccess.test.tsx | 2 +- .../SignIn/__tests__/SignInFactorOne.test.tsx | 12 +++++------- .../components/SignIn/__tests__/SignInStart.test.tsx | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPassword.test.tsx b/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPassword.test.tsx index ef75a4142f7..a1962c84e37 100644 --- a/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPassword.test.tsx +++ b/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPassword.test.tsx @@ -13,7 +13,7 @@ describe('ResetPassword', () => { const { wrapper } = await createFixtures(); render(, { 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); @@ -34,7 +34,7 @@ describe('ResetPassword', () => { await runFakeTimers(async () => { render(, { 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); diff --git a/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPasswordSuccess.test.tsx b/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPasswordSuccess.test.tsx index fa848f93d63..1836303ab19 100644 --- a/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPasswordSuccess.test.tsx +++ b/packages/clerk-js/src/ui/components/SignIn/__tests__/ResetPasswordSuccess.test.tsx @@ -18,7 +18,7 @@ describe('ResetPasswordSuccess', () => { const { wrapper } = await createFixtures(); render(, { 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); }); diff --git a/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOne.test.tsx b/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOne.test.tsx index cbc6f243518..f8b923efa8f 100644 --- a/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOne.test.tsx +++ b/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOne.test.tsx @@ -141,7 +141,7 @@ describe('SignInFactorOne', () => { const { userEvent } = render(, { 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(); }); @@ -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 () => { @@ -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 () => { @@ -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 () => { diff --git a/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInStart.test.tsx b/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInStart.test.tsx index 41c7df4682c..e0e978cce4e 100644 --- a/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInStart.test.tsx +++ b/packages/clerk-js/src/ui/components/SignIn/__tests__/SignInStart.test.tsx @@ -14,7 +14,7 @@ describe('SignInStart', () => { f.withSupportEmail(); }); render(, { wrapper }); - screen.getByText('Sign in'); + screen.getAllByText(/sign in to .*/i); }); describe('Login Methods', () => {