Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Reports for V2 Test Format #845

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading