-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Content updates to Candidate Review page (#1186)
* Add version string to candidate test plan run * Link to 'test-review' for test plan version on CandidateTestPlanRun * Update snapshot * Add At Version name to Candidate Review heading * Add Run History to /candidate-test-plan/ * Update snapshots * Update snapshots * Revert incorrect snapshot update * Component for Run History * Update snapshot * Use dates object * Use proptypes * Update snapshots
- Loading branch information
Showing
5 changed files
with
156 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, { useMemo } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import styled from '@emotion/styled'; | ||
import { dates } from 'shared'; | ||
import { TestPlanReportPropType } from '../proptypes'; | ||
|
||
const RunListItem = styled.li` | ||
margin-bottom: 0.5rem; | ||
`; | ||
|
||
const RunHistory = ({ testPlanReports, testId }) => { | ||
if (!testPlanReports || testPlanReports.length === 0) { | ||
return null; | ||
} | ||
|
||
const lines = useMemo(() => { | ||
const l = []; | ||
for (const testPlanReport of testPlanReports) { | ||
const { draftTestPlanRuns, at, browser } = testPlanReport; | ||
for (const draftTestPlanRun of draftTestPlanRuns) { | ||
const { testResults, tester } = draftTestPlanRun; | ||
const testResult = testResults.find(item => item.test.id === testId); | ||
if (testResult?.completedAt) { | ||
l.push( | ||
<RunListItem | ||
key={`${testResult.atVersion.id}-${testResult.browserVersion.id}-${testResult.test.id}-${tester.username}`} | ||
> | ||
Tested with{' '} | ||
<b> | ||
{at.name} {testResult.atVersion.name} | ||
</b>{' '} | ||
and{' '} | ||
<b> | ||
{browser.name} {testResult.browserVersion.name} | ||
</b>{' '} | ||
by{' '} | ||
<b> | ||
<a href={`https://github.com/${tester.username}`}> | ||
{tester.username} | ||
</a> | ||
</b>{' '} | ||
on{' '} | ||
{dates.convertDateToString( | ||
testResult.completedAt, | ||
'MMMM DD, YYYY' | ||
)} | ||
. | ||
</RunListItem> | ||
); | ||
} | ||
} | ||
} | ||
return l; | ||
}, [testPlanReports, testId]); | ||
|
||
if (lines.length === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ul | ||
style={{ | ||
marginBottom: '0' | ||
}} | ||
> | ||
{lines} | ||
</ul> | ||
); | ||
}; | ||
|
||
RunHistory.propTypes = { | ||
testPlanReports: PropTypes.arrayOf(TestPlanReportPropType), | ||
testId: PropTypes.string | ||
}; | ||
|
||
export default RunHistory; |
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