Skip to content

Commit

Permalink
Merge pull request #845 from w3c/v2-test-format-reports
Browse files Browse the repository at this point in the history
Update Reports for V2 Test Format
  • Loading branch information
howard-e authored Nov 29, 2023
2 parents 03c6f39 + 38bec5f commit ab9a597
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
11 changes: 8 additions & 3 deletions client/components/Reports/SummarizeTestPlanReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ResultsContainer = styled.div`
border-left: 1px solid #dee2e6;
border-right: 1px solid #dee2e6;
border-bottom: 1px solid #dee2e6;
margin-bottom: 2em;
margin-bottom: 0.5em;
`;

const getTestersRunHistory = (
Expand Down Expand Up @@ -180,7 +180,7 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
</li>
) : null}
</ul>
{testPlanReport.finalizedTestResults.map(testResult => {
{testPlanReport.finalizedTestResults.map((testResult, index) => {
const test = testResult.test;

const reportLink = `https://aria-at.w3.org${location.pathname}#result-${testResult.id}`;
Expand Down Expand Up @@ -211,7 +211,8 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
<Fragment key={testResult.id}>
<div className="test-result-heading">
<h2 id={`result-${testResult.id}`} tabIndex="-1">
{test.title}&nbsp;({passedAssertionsCount}
Test {index + 1}: {test.title}&nbsp;(
{passedAssertionsCount}
&nbsp;passed, {failedAssertionsCount} failed)
<DisclaimerInfo phase={testPlanVersion.phase} />
</h2>
Expand Down Expand Up @@ -248,6 +249,10 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
key={`TestPlanResultsTable__${testResult.id}`}
test={{ ...test, at }}
testResult={testResult}
optionalHeader={
<h3>Results for each command</h3>
}
commandHeadingLevel={4}
/>
</ResultsContainer>

Expand Down
19 changes: 15 additions & 4 deletions client/components/common/TestPlanResultsTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ const renderAssertionRow = (assertionResult, priorityString) => {
);
};

const TestPlanResultsTable = ({ test, testResult, tableClassName = '' }) => {
const TestPlanResultsTable = ({
test,
testResult,
tableClassName = '',
optionalHeader = null,
commandHeadingLevel = 3
}) => {
const CommandHeading = `h${commandHeadingLevel}`;

return (
<>
{optionalHeader}
{testResult.scenarioResults.map((scenarioResult, index) => {
const passedAssertions = scenarioResult.assertionResults.filter(
assertionResult => assertionResult.passed
Expand Down Expand Up @@ -56,11 +65,11 @@ const TestPlanResultsTable = ({ test, testResult, tableClassName = '' }) => {

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

export default TestPlanResultsTable;

0 comments on commit ab9a597

Please sign in to comment.