Skip to content

Commit 495543d

Browse files
authored
Merge pull request #847 from w3c/pass-fail-test-run
Passed/failed for assertion results in TestRenderer and migrate to pass/fail for report comparison algorithms
2 parents 2264ac5 + e9f4388 commit 495543d

File tree

23 files changed

+146
-624
lines changed

23 files changed

+146
-624
lines changed

client/components/CandidateReview/CandidateTestPlanRun/queries.js

-4
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export const CANDIDATE_REPORTS_QUERY = gql`
114114
text
115115
}
116116
passed
117-
failedReason
118117
}
119118
requiredAssertionResults: assertionResults(
120119
priority: REQUIRED
@@ -123,7 +122,6 @@ export const CANDIDATE_REPORTS_QUERY = gql`
123122
text
124123
}
125124
passed
126-
failedReason
127125
}
128126
optionalAssertionResults: assertionResults(
129127
priority: OPTIONAL
@@ -132,14 +130,12 @@ export const CANDIDATE_REPORTS_QUERY = gql`
132130
text
133131
}
134132
passed
135-
failedReason
136133
}
137134
mayAssertionResults: assertionResults(priority: MAY) {
138135
assertion {
139136
text
140137
}
141138
passed
142-
failedReason
143139
}
144140
unexpectedBehaviors {
145141
id

client/components/Reports/SummarizeTestPlanReport.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ SummarizeTestPlanReport.propTypes = {
298298
PropTypes.shape({
299299
id: PropTypes.string.isRequired,
300300
passed: PropTypes.bool.isRequired,
301-
failedReason: PropTypes.string,
302301
assertion: PropTypes.shape({
303302
text: PropTypes.string.isRequired
304303
}).isRequired

client/components/Reports/queries.js

-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export const REPORT_PAGE_QUERY = gql`
8080
text
8181
}
8282
passed
83-
failedReason
8483
}
8584
requiredAssertionResults: assertionResults(
8685
priority: REQUIRED
@@ -89,7 +88,6 @@ export const REPORT_PAGE_QUERY = gql`
8988
text
9089
}
9190
passed
92-
failedReason
9391
}
9492
optionalAssertionResults: assertionResults(
9593
priority: OPTIONAL
@@ -98,14 +96,12 @@ export const REPORT_PAGE_QUERY = gql`
9896
text
9997
}
10098
passed
101-
failedReason
10299
}
103100
mayAssertionResults: assertionResults(priority: MAY) {
104101
assertion {
105102
text
106103
}
107104
passed
108-
failedReason
109105
}
110106
unexpectedBehaviors {
111107
id

client/components/ReviewConflicts/ReviewConflicts.jsx

+4-11
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,9 @@ const ReviewConflicts = ({
5353
const results = conflictingResults.map(result => {
5454
const { testPlanRun, scenarioResult, assertionResult } = result;
5555
let assertionResultFormatted;
56-
if (assertionResult.passed) {
57-
assertionResultFormatted = 'passing';
58-
} else {
59-
const reasonFormatted =
60-
assertionResult.failedReason === 'INCORRECT_OUTPUT'
61-
? 'incorrect output'
62-
: 'no output';
63-
assertionResultFormatted = `failing with ${reasonFormatted}`;
64-
}
56+
assertionResultFormatted = assertionResult.passed
57+
? 'passing'
58+
: 'failing';
6559
return (
6660
<li key={testPlanRun.id}>
6761
Tester {testPlanRun.tester.username} recorded output &quot;
@@ -167,8 +161,7 @@ ReviewConflicts.propTypes = {
167161
).isRequired
168162
}),
169163
assertionResult: PropTypes.shape({
170-
passed: PropTypes.bool.isRequired,
171-
failedReason: PropTypes.string
164+
passed: PropTypes.bool.isRequired
172165
})
173166
})
174167
).isRequired

client/components/TestPlanUpdater/TestPlanUpdaterModal.jsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ const TestPlanUpdaterModal = ({
181181
];
182182
return {
183183
id: assertionResultSkeleton.id,
184-
passed: assertionResult.passed,
185-
failedReason:
186-
assertionResult.failedReason
184+
passed: assertionResult.passed
187185
};
188186
}
189187
),

client/components/TestPlanUpdater/queries.js

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const VERSION_QUERY = gql`
7979
output
8080
assertionResults {
8181
passed
82-
failedReason
8382
}
8483
unexpectedBehaviors {
8584
id
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, { useMemo } from 'react';
2+
import PropTypes from 'prop-types';
3+
import { Fieldset } from '..';
4+
import styled from '@emotion/styled';
5+
import supportJson from '../../../resources/support.json';
6+
7+
const Label = styled.label`
8+
display: block;
9+
10+
input {
11+
margin-right: 0.25rem;
12+
}
13+
`;
14+
15+
const AssertionsFieldset = ({ assertions, commandIndex, assertionsHeader }) => {
16+
// Handle case where build process didn't include assertionResponseQuestion
17+
const normalizedHeader = useMemo(() => {
18+
return assertionsHeader?.descriptionHeader?.replace(
19+
'undefined',
20+
supportJson.testPlanStrings.assertionResponseQuestion
21+
);
22+
}, [assertionsHeader]);
23+
24+
return (
25+
<Fieldset>
26+
<legend id={`command-${commandIndex}-assertions-heading`}>
27+
{normalizedHeader}
28+
</legend>
29+
{assertions.map((assertion, assertionIndex) => {
30+
const { description, passed, click } = assertion;
31+
32+
return (
33+
<Label key={`AssertionKey_${assertionIndex}`}>
34+
<input
35+
type="checkbox"
36+
id={`pass-${commandIndex}-${assertionIndex}`}
37+
name={`assertion-${commandIndex}-${assertionIndex}`}
38+
defaultChecked={passed}
39+
onClick={click}
40+
/>
41+
{description[0]}
42+
</Label>
43+
);
44+
})}
45+
</Fieldset>
46+
);
47+
};
48+
49+
AssertionsFieldset.propTypes = {
50+
assertions: PropTypes.array.isRequired,
51+
commandIndex: PropTypes.number.isRequired,
52+
assertionsHeader: PropTypes.object.isRequired
53+
};
54+
55+
export default AssertionsFieldset;

0 commit comments

Comments
 (0)