forked from PalisadoesFoundation/talawa-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: after successful registration login tab opened on login page (P…
…alisadoesFoundation#1351) * feat: after sucessful registration login tab opened - after the user is sucessfully registered, login tab is opened * Test for login tab after successful registration
- Loading branch information
1 parent
c17562c
commit 31ac00c
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,6 +301,54 @@ describe('Testing Login Page Screen', () => { | |
userEvent.click(screen.getByTestId('registrationBtn')); | ||
}); | ||
|
||
test('switches to login tab on successful registration', async () => { | ||
const formData = { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
email: '[email protected]', | ||
password: 'johndoe', | ||
confirmPassword: 'johndoe', | ||
}; | ||
|
||
render( | ||
<MockedProvider addTypename={false} link={link}> | ||
<BrowserRouter> | ||
<Provider store={store}> | ||
<I18nextProvider i18n={i18nForTest}> | ||
<LoginPage /> | ||
</I18nextProvider> | ||
</Provider> | ||
</BrowserRouter> | ||
</MockedProvider> | ||
); | ||
|
||
await wait(); | ||
|
||
userEvent.click(screen.getByTestId(/goToRegisterPortion/i)); | ||
userEvent.type( | ||
screen.getByPlaceholderText(/First Name/i), | ||
formData.firstName | ||
); | ||
userEvent.type( | ||
screen.getByPlaceholderText(/Last name/i), | ||
formData.lastName | ||
); | ||
userEvent.type(screen.getByTestId(/signInEmail/i), formData.email); | ||
userEvent.type(screen.getByPlaceholderText('Password'), formData.password); | ||
userEvent.type( | ||
screen.getByPlaceholderText('Confirm Password'), | ||
formData.confirmPassword | ||
); | ||
|
||
userEvent.click(screen.getByTestId('registrationBtn')); | ||
|
||
await wait(); | ||
|
||
// Check if the login tab is now active by checking for elements that only appear in the login tab | ||
expect(screen.getByTestId('loginBtn')).toBeInTheDocument(); | ||
expect(screen.getByTestId('goToRegisterPortion')).toBeInTheDocument(); | ||
}); | ||
|
||
test('Testing toggle login register portion', async () => { | ||
render( | ||
<MockedProvider addTypename={false} link={link}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters