Skip to content

Commit

Permalink
Merge pull request #426 from openedx/alangsto/add_platform_verificati…
Browse files Browse the repository at this point in the history
…on_attempt

feat: add platform verification attempt column to verified name history
  • Loading branch information
alangsto authored Sep 25, 2024
2 parents 046a4b1 + a145505 commit f95bcb7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
26 changes: 25 additions & 1 deletion src/users/VerifiedName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ const verifiedNameHistoryColumns = [
accessor: 'status',
},
{
Header: 'IDV Attempt ID',
Header: 'Legacy Attempt ID',
accessor: 'idvAttemptId',
},
{
Header: 'Proctoring Attempt ID',
accessor: 'proctoringAttemptId',
},
{
Header: 'IDV Attempt ID',
accessor: 'platformVerificationAttemptId',
},
{
Header: 'Created At',
accessor: 'createdAt',
Expand Down Expand Up @@ -105,6 +109,26 @@ export default function VerifiedName({ username }) {
</OverlayTrigger>
) : '',
proctoringAttemptId: result.proctoredExamAttemptId,
platformVerificationAttemptId: result.platformVerificationAttemptId ? (
<OverlayTrigger
placement="right"
trigger="hover"
overlay={(
<Popover id={`${result.platformVerificationAttemptId}-details-tooltip`} aria-hidden="true">
<Popover.Title as="h3">
Status
</Popover.Title>
<Popover.Content data-testid="platformVerificationAttemptTooltipTitle">
{result.platformVerificationAttemptStatus ? result.platformVerificationAttemptStatus : 'Error: Missing data'}
</Popover.Content>
</Popover>
)}
>
<Button variant="link" size="inline">
{result.platformVerificationAttemptId}
</Button>
</OverlayTrigger>
) : '',
createdAt: formatDate(result.created),
}),
), [verifiedNameHistoryData]);
Expand Down
29 changes: 28 additions & 1 deletion src/users/VerifiedName.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Verified Name', () => {

// Profile name and denied verified name are visible in history modal
const profileName = await screen.findAllByText(/jon doe/i);
expect(profileName.length).toEqual(2);
expect(profileName.length).toEqual(3);
await screen.findByText(/j doe/i);
});

Expand Down Expand Up @@ -76,4 +76,31 @@ describe('Verified Name', () => {

expect(screen.getByText('must_retry')).toBeTruthy();
});

it('displays hover popup to show Platform Verification Attempt details', async () => {
const verifiedNameData = {
verifiedName: 'Jonathan Doe',
status: 'approved',
verificationType: 'Proctoring',
history: verifiedNameHistory.results,
};
jest.spyOn(api, 'getVerifiedNameHistory').mockResolvedValueOnce(verifiedNameData);
await act(async () => {
render(<VerifiedNameWrapper {...props} />);
});

const historyButton = await screen.findByText('Show');
await act(async () => {
fireEvent.click(historyButton);
});

const hoverLink = await screen.getByText(verifiedNameHistory.results[2].platform_verification_attempt_id);
await act(async () => {
fireEvent.mouseOver(hoverLink);
});

await screen.getByTestId('platformVerificationAttemptTooltipTitle');

expect(screen.getByText('pending')).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/users/data/test/verifiedNameHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const verifiedNameHistory = {
verification_attempt_id: null,
verification_attempt_status: null,
proctored_exam_attempt_id: 123,
platform_verification_attempt_id: null,
platform_verification_attempt_status: null,
status: 'approved',
},
{
Expand All @@ -16,6 +18,19 @@ const verifiedNameHistory = {
verification_attempt_id: 456,
verification_attempt_status: 'must_retry',
proctored_exam_attempt_id: null,
platform_verification_attempt_id: null,
platform_verification_attempt_status: null,
status: 'denied',
},
{
created: '2021-09-07T17:36:55.781077Z',
verified_name: 'Jonathan D. Doe',
profile_name: 'Jon Doe',
verification_attempt_id: null,
verification_attempt_status: null,
proctored_exam_attempt_id: null,
platform_verification_attempt_id: 789,
platform_verification_attempt_status: 'pending',
status: 'denied',
},
],
Expand Down

0 comments on commit f95bcb7

Please sign in to comment.