-
-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added translations for the headings * Added icons besides member names * Added tests for checking if image is displayed for existing user * Added translations in all languages * Added test to check if profile image is displayed for existing user * Added test for avartar image
- Loading branch information
Showing
7 changed files
with
159 additions
and
10 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
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
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
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
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
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
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 |
---|---|---|
|
@@ -423,6 +423,32 @@ const MOCKS: TestMock[] = [ | |
user: { | ||
firstName: 'Vyvyan', | ||
lastName: 'Kerry', | ||
image: 'tempUrl', | ||
_id: '65378abd85008f171cf2990d', | ||
email: '[email protected]', | ||
createdAt: '2023-04-13T04:53:17.742Z', | ||
joinedOrganizations: [ | ||
{ | ||
_id: '6537904485008f171cf29924', | ||
name: 'Unity Foundation', | ||
creator: { | ||
_id: '64378abd85008f171cf2990d', | ||
firstName: 'Wilt', | ||
lastName: 'Shepherd', | ||
image: null, | ||
email: '[email protected]', | ||
createdAt: '2023-04-13T04:53:17.742Z', | ||
}, | ||
__typename: 'Organization', | ||
}, | ||
], | ||
__typename: 'User', | ||
}, | ||
}, | ||
{ | ||
user: { | ||
firstName: 'Nandika', | ||
lastName: 'Agrawal', | ||
image: null, | ||
_id: '65378abd85008f171cf2990d', | ||
email: '[email protected]', | ||
|
@@ -916,10 +942,13 @@ describe('Organization People Page', () => { | |
userEvent.click(screen.getByTestId('existingUser')); | ||
await wait(); | ||
|
||
expect(screen.getByTestId('addExistingUserModal')).toBeInTheDocument(); | ||
expect( | ||
screen.getAllByTestId('addExistingUserModal').length, | ||
).toBeGreaterThan(0); | ||
await wait(); | ||
|
||
userEvent.click(screen.getByTestId('addBtn')); | ||
const addBtn = screen.getAllByTestId('addBtn'); | ||
userEvent.click(addBtn[0]); | ||
}); | ||
|
||
test('Open and search existing user', async () => { | ||
|
@@ -1353,3 +1382,54 @@ describe('Organization People Page', () => { | |
expect(screen.queryByText(/Nothing Found !!/i)).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
test('Open and check if profile image is displayed for existing user', async () => { | ||
window.location.assign('/orgpeople/orgid'); | ||
render( | ||
<MockedProvider | ||
addTypename={true} | ||
link={link} | ||
defaultOptions={{ | ||
watchQuery: { fetchPolicy: 'no-cache' }, | ||
query: { fetchPolicy: 'no-cache' }, | ||
}} | ||
> | ||
<BrowserRouter> | ||
<Provider store={store}> | ||
<I18nextProvider i18n={i18nForTest}> | ||
<OrganizationPeople /> | ||
</I18nextProvider> | ||
</Provider> | ||
</BrowserRouter> | ||
</MockedProvider>, | ||
); | ||
|
||
// Wait for the component to finish rendering | ||
await wait(); | ||
|
||
// Click on the dropdown toggle to open the menu | ||
userEvent.click(screen.getByTestId('addMembers')); | ||
await wait(); | ||
|
||
// Click on the "Admins" option in the dropdown menu | ||
userEvent.click(screen.getByTestId('existingUser')); | ||
await wait(); | ||
|
||
expect(screen.getByTestId('addExistingUserModal')).toBeInTheDocument(); | ||
await wait(); | ||
|
||
expect(screen.getAllByTestId('user').length).toBeGreaterThan(0); | ||
await wait(); | ||
|
||
// Check if the image is rendered | ||
expect(screen.getAllByTestId('profileImage').length).toBeGreaterThan(0); | ||
await wait(); | ||
|
||
const images = await screen.findAllByAltText('avatar'); | ||
expect(images.length).toBeGreaterThan(0); | ||
await wait(); | ||
|
||
const avatarImages = await screen.findAllByAltText('Dummy Avatar'); | ||
expect(avatarImages.length).toBeGreaterThan(0); | ||
await wait(); | ||
}); |