Skip to content

Commit f3130a9

Browse files
committed
Add support for severity capture and capturing details for all unexpected behaviors
1 parent 442ef65 commit f3130a9

File tree

13 files changed

+426
-325
lines changed

13 files changed

+426
-325
lines changed

client/components/CandidateReview/CandidateTestPlanRun/queries.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ export const CANDIDATE_REPORTS_QUERY = gql`
140140
unexpectedBehaviors {
141141
id
142142
text
143-
otherUnexpectedBehaviorText
143+
severity
144+
unexpectedBehaviorText
144145
}
145146
}
146147
}

client/components/Reports/SummarizeTestPlanReport.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ SummarizeTestPlanReport.propTypes = {
306306
PropTypes.shape({
307307
id: PropTypes.string.isRequired,
308308
text: PropTypes.string.isRequired,
309-
otherUnexpectedBehaviorText:
310-
PropTypes.string
309+
severity: PropTypes.string.isRequired,
310+
unexpectedBehaviorText:
311+
PropTypes.string.isRequired
311312
}).isRequired
312313
).isRequired
313314
}).isRequired

client/components/Reports/SummarizeTestPlanVersion.jsx

+6-14
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ const SummarizeTestPlanVersion = ({ testPlanVersion, testPlanReports }) => {
129129
<thead>
130130
<tr>
131131
<th>Test Name</th>
132-
<th>MUST-DO Behaviors</th>
133-
<th>SHOULD-DO Behaviors</th>
134-
<th>Unexpected Behaviors</th>
132+
<th>MUST HAVE Behaviors</th>
133+
<th>SHOULD HAVE Behaviors</th>
134+
<th>MAY HAVE Behaviors</th>
135135
</tr>
136136
</thead>
137137
<tbody>
@@ -140,7 +140,7 @@ const SummarizeTestPlanVersion = ({ testPlanVersion, testPlanReports }) => {
140140
const {
141141
requiredFormatted,
142142
optionalFormatted,
143-
unexpectedBehaviorsFormatted
143+
mayFormatted
144144
} = getMetrics({
145145
testResult
146146
});
@@ -159,11 +159,7 @@ const SummarizeTestPlanVersion = ({ testPlanVersion, testPlanReports }) => {
159159
</td>
160160
<td>{requiredFormatted}</td>
161161
<td>{optionalFormatted}</td>
162-
<td>
163-
{
164-
unexpectedBehaviorsFormatted
165-
}
166-
</td>
162+
<td>{mayFormatted}</td>
167163
</tr>
168164
);
169165
}
@@ -172,11 +168,7 @@ const SummarizeTestPlanVersion = ({ testPlanVersion, testPlanReports }) => {
172168
<td>All Tests</td>
173169
<td>{overallMetrics.requiredFormatted}</td>
174170
<td>{overallMetrics.optionalFormatted}</td>
175-
<td>
176-
{
177-
overallMetrics.unexpectedBehaviorsFormatted
178-
}
179-
</td>
171+
<td>{overallMetrics.mayFormatted}</td>
180172
</tr>
181173
</tbody>
182174
</Table>

client/components/Reports/queries.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ export const REPORT_PAGE_QUERY = gql`
106106
unexpectedBehaviors {
107107
id
108108
text
109-
otherUnexpectedBehaviorText
109+
severity
110+
unexpectedBehaviorText
110111
}
111112
}
112113
atVersion {

client/components/ReviewConflicts/ReviewConflicts.jsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ const ReviewConflicts = ({
8686
let resultFormatted;
8787
if (scenarioResult.unexpectedBehaviors.length) {
8888
resultFormatted = scenarioResult.unexpectedBehaviors
89-
.map(({ otherUnexpectedBehaviorText, text }) => {
90-
return `"${otherUnexpectedBehaviorText ?? text}"`;
89+
.map(({ text, severity, unexpectedBehaviorText }) => {
90+
return `"${text} (Details: ${unexpectedBehaviorText}, Impact: ${severity})"`;
9191
})
9292
.join(' and ');
9393
} else {
@@ -155,8 +155,9 @@ ReviewConflicts.propTypes = {
155155
unexpectedBehaviors: PropTypes.arrayOf(
156156
PropTypes.shape({
157157
text: PropTypes.string.isRequired,
158-
otherUnexpectedBehaviorText:
159-
PropTypes.string
158+
severity: PropTypes.string.isRequired,
159+
unexpectedBehaviorText:
160+
PropTypes.string.isRequired
160161
})
161162
).isRequired
162163
}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
import React from 'react';
2+
import { Feedback, Fieldset } from '@components/TestRenderer';
3+
import PropTypes from 'prop-types';
4+
5+
const UnexpectedBehaviorsFieldset = ({
6+
commandIndex,
7+
unexpectedBehaviors,
8+
isSubmitted
9+
}) => {
10+
const severityOptions = ['Moderate', 'High'];
11+
12+
return (
13+
<Fieldset id={`cmd-${commandIndex}-problems`}>
14+
<legend>{unexpectedBehaviors.description[0]}</legend>
15+
{isSubmitted && (
16+
<Feedback
17+
className={`${
18+
unexpectedBehaviors.description[1].required &&
19+
'required'
20+
} ${
21+
unexpectedBehaviors.description[1].highlightRequired &&
22+
'highlight-required'
23+
}`}
24+
>
25+
{unexpectedBehaviors.description[1].description}
26+
</Feedback>
27+
)}
28+
<div>
29+
<input
30+
key={`Problem__${commandIndex}__true`}
31+
type="radio"
32+
id={`problem-${commandIndex}-true`}
33+
name={`problem-${commandIndex}`}
34+
autoFocus={
35+
isSubmitted && unexpectedBehaviors.passChoice.focus
36+
}
37+
defaultChecked={unexpectedBehaviors.passChoice.checked}
38+
onClick={unexpectedBehaviors.passChoice.click}
39+
/>
40+
<label
41+
id={`problem-${commandIndex}-true-label`}
42+
htmlFor={`problem-${commandIndex}-true`}
43+
>
44+
{unexpectedBehaviors.passChoice.label}
45+
</label>
46+
</div>
47+
<div>
48+
<input
49+
key={`Problem__${commandIndex}__false`}
50+
type="radio"
51+
id={`problem-${commandIndex}-false`}
52+
name={`problem-${commandIndex}`}
53+
autoFocus={
54+
isSubmitted && unexpectedBehaviors.failChoice.focus
55+
}
56+
defaultChecked={unexpectedBehaviors.failChoice.checked}
57+
onClick={unexpectedBehaviors.failChoice.click}
58+
/>
59+
<label
60+
id={`problem-${commandIndex}-false-label`}
61+
htmlFor={`problem-${commandIndex}-false`}
62+
>
63+
{unexpectedBehaviors.failChoice.label}
64+
</label>
65+
</div>
66+
67+
<Fieldset
68+
className="problem-select"
69+
hidden={!unexpectedBehaviors.failChoice.checked}
70+
>
71+
<legend>{unexpectedBehaviors.failChoice.options.header}</legend>
72+
{unexpectedBehaviors.failChoice.options.options.map(
73+
(option, optionIndex) => {
74+
const {
75+
checked,
76+
focus,
77+
description,
78+
more,
79+
severity,
80+
change,
81+
severitychange
82+
} = option;
83+
84+
return (
85+
<Fieldset
86+
key={`AssertionOptionsKey_${optionIndex}`}
87+
className="undesirable-fieldset"
88+
>
89+
<legend>{description}</legend>
90+
<div>
91+
<input
92+
key={`${description}__${commandIndex}`}
93+
type="checkbox"
94+
value={description}
95+
id={`${description}-${commandIndex}`}
96+
className={`undesirable-${commandIndex}`}
97+
tabIndex={optionIndex === 0 ? 0 : -1}
98+
autoFocus={isSubmitted && focus}
99+
defaultChecked={checked}
100+
onClick={e => change(e.target.checked)}
101+
/>
102+
<label
103+
htmlFor={`${description}-${commandIndex}`}
104+
>
105+
Behavior occurred
106+
</label>
107+
</div>
108+
<div>
109+
<label
110+
htmlFor={`${description}-${commandIndex}-severity`}
111+
>
112+
Impact:
113+
</label>
114+
<select
115+
id={`${description}-${commandIndex}-severity`}
116+
name={`${description}-${commandIndex}-severity`}
117+
onChange={e =>
118+
severitychange(e.target.value)
119+
}
120+
disabled={!checked}
121+
defaultValue={severity}
122+
>
123+
{severityOptions.map(option => (
124+
<option
125+
key={`${description}-${commandIndex}-severity-${option}`}
126+
value={option.toUpperCase()}
127+
>
128+
{option}
129+
</option>
130+
))}
131+
</select>
132+
</div>
133+
{more && (
134+
<div>
135+
<label
136+
htmlFor={`${description}-${commandIndex}-input`}
137+
>
138+
Details:
139+
</label>
140+
<input
141+
key={`${description}__${commandIndex}__input`}
142+
type="text"
143+
id={`${description}-${commandIndex}-input`}
144+
name={`${description}-${commandIndex}-input`}
145+
className={`undesirable-${description.toLowerCase()}-input`}
146+
autoFocus={
147+
isSubmitted && more.focus
148+
}
149+
value={more.value}
150+
onChange={e =>
151+
more.change(e.target.value)
152+
}
153+
disabled={!checked}
154+
/>
155+
{isSubmitted && (
156+
<Feedback
157+
className={`${
158+
more.description[1]
159+
.required && 'required'
160+
} ${
161+
more.description[1]
162+
.highlightRequired &&
163+
'highlight-required'
164+
}`}
165+
>
166+
{
167+
more.description[1]
168+
.description
169+
}
170+
</Feedback>
171+
)}
172+
</div>
173+
)}
174+
</Fieldset>
175+
);
176+
}
177+
)}
178+
</Fieldset>
179+
</Fieldset>
180+
);
181+
};
182+
183+
UnexpectedBehaviorsFieldset.propTypes = {
184+
commandIndex: PropTypes.number.isRequired,
185+
unexpectedBehaviors: PropTypes.object.isRequired,
186+
isSubmitted: PropTypes.bool
187+
};
188+
189+
export default UnexpectedBehaviorsFieldset;

0 commit comments

Comments
 (0)