Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-e committed Nov 21, 2023
1 parent d9d7ff8 commit 9eb5875
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
5 changes: 4 additions & 1 deletion client/components/Reports/SummarizeTestPlanReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
key={`TestPlanResultsTable__${testResult.id}`}
test={{ ...test, at }}
testResult={testResult}
isReportsPage={true}
optionalHeader={
<h3>Results for each command</h3>
}
commandHeadingLevel={4}
/>
</ResultsContainer>

Expand Down
29 changes: 12 additions & 17 deletions client/components/common/TestPlanResultsTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ const TestPlanResultsTable = ({
test,
testResult,
tableClassName = '',
isReportsPage = false
optionalHeader = null,
commandHeadingLevel = 3
}) => {
const Heading = `h${commandHeadingLevel}`;

return (
<>
{isReportsPage ? <h3>Results for each command</h3> : null}

{optionalHeader}
{testResult.scenarioResults.map((scenarioResult, index) => {
const passedAssertions = scenarioResult.assertionResults.filter(
assertionResult => assertionResult.passed
Expand Down Expand Up @@ -63,19 +65,11 @@ const TestPlanResultsTable = ({

return (
<React.Fragment key={scenarioResult.id}>
{isReportsPage ? (
<h4>
{commandsString}&nbsp;Results:&nbsp;
{passedAssertions.length} passed,&nbsp;
{failedAssertions.length} failed
</h4>
) : (
<h3>
{commandsString}&nbsp;Results:&nbsp;
{passedAssertions.length} passed,&nbsp;
{failedAssertions.length} failed
</h3>
)}
<Heading>
{commandsString}&nbsp;Results:&nbsp;
{passedAssertions.length} passed,&nbsp;
{failedAssertions.length} failed
</Heading>
<p className="test-plan-results-response-p">
{test.at?.name} Response:
</p>
Expand Down Expand Up @@ -151,7 +145,8 @@ TestPlanResultsTable.propTypes = {
scenarioResults: PropTypes.array.isRequired
}),
tableClassName: PropTypes.string,
isReportsPage: PropTypes.bool
optionalHeader: PropTypes.node,
commandHeadingLevel: PropTypes.number
};

export default TestPlanResultsTable;

0 comments on commit 9eb5875

Please sign in to comment.