Skip to content

Commit a705888

Browse files
authored
feat: Group required reports in test plan report status dialog (#1337)
1 parent ee7f2a3 commit a705888

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

client/components/TestPlanReportStatusDialog/index.jsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useMemo } from 'react';
22
import PropTypes from 'prop-types';
33
import AddTestToQueueWithConfirmation from '../AddTestToQueueWithConfirmation';
44
import { useQuery } from '@apollo/client';
@@ -26,9 +26,21 @@ const TestPlanReportStatusDialog = ({
2626

2727
const { testPlanReportStatuses } = testPlanVersion;
2828

29-
let requiredReports = 0;
29+
const { requiredReportsCount, sortedStatuses } = useMemo(() => {
30+
let requiredCount = 0;
3031

31-
const tableRows = testPlanReportStatuses.map(status => {
32+
const sorted = [...testPlanReportStatuses].sort(
33+
(a, b) => Number(b.isRequired) - Number(a.isRequired)
34+
);
35+
36+
sorted.forEach(status => {
37+
if (status.isRequired) requiredCount += 1;
38+
});
39+
40+
return { requiredReportsCount: requiredCount, sortedStatuses: sorted };
41+
}, [testPlanReportStatuses]);
42+
43+
const tableRows = sortedStatuses.map(status => {
3244
const {
3345
isRequired,
3446
at,
@@ -38,8 +50,6 @@ const TestPlanReportStatusDialog = ({
3850
testPlanReport
3951
} = status;
4052

41-
if (isRequired) requiredReports += 1;
42-
4353
const key =
4454
`${at.name}-${browser.name}-` +
4555
`${minimumAtVersion?.id ?? exactAtVersion?.id}-` +
@@ -105,7 +115,7 @@ const TestPlanReportStatusDialog = ({
105115
{phase[0] + phase.slice(1).toLowerCase()}
106116
</span>
107117
&nbsp;{reviewDescription}.&nbsp;
108-
<strong>{requiredReports} AT/browser&nbsp;</strong>
118+
<strong>{requiredReportsCount} AT/browser&nbsp;</strong>
109119
pairs {requirementNeedsDescription}.
110120
</p>
111121
)}

client/tests/e2e/snapshots/saved/_account_settings.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ <h2>Admin Actions</h2>
9999
<button type="button" class="btn btn-primary">
100100
Import Latest Test Plan Versions
101101
</button>
102-
<p>
103-
Date of latest test plan version: February 13, 2025 01:40 UTC
104-
</p>
102+
<p>Date of latest test plan version: March 6, 2025 19:25 UTC</p>
105103
</section>
106104
</div>
107105
</main>

client/tests/e2e/snapshots/saved/_data-management.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ <h3>
263263
element)
264264
</option>
265265
<option value="49">Main Landmark</option>
266-
<option value="60">Media Seek Slider</option>
266+
<option value="93">Media Seek Slider</option>
267267
<option value="54">Meter</option>
268268
<option value="90">Modal Dialog Example</option>
269269
<option value="89">Navigation Menu Button</option>
@@ -274,10 +274,10 @@ <h3>
274274
Radio Group Example Using aria-activedescendant
275275
</option>
276276
<option value="59">Rating Slider</option>
277-
<option value="39">Select Only Combobox Example</option>
277+
<option value="7">Select Only Combobox Example</option>
278278
<option value="61">Switch Example</option>
279279
<option value="62">Tabs with Manual Activation</option>
280-
<option value="93">Toggle Button</option>
280+
<option value="94">Toggle Button</option>
281281
<option value="64">Vertical Temperature Slider</option>
282282
</select>
283283
</div>
@@ -1192,7 +1192,7 @@ <h2>Test Plans Status Summary</h2>
11921192
<span
11931193
class="full-width auto-width css-36z7cz"
11941194
role="listitem"
1195-
><a href="/test-review/93"
1195+
><a href="/test-review/94"
11961196
><span
11971197
><svg
11981198
aria-hidden="true"
@@ -1740,7 +1740,7 @@ <h2>Test Plans Status Summary</h2>
17401740
<td>
17411741
<div class="css-bpz90">
17421742
<span class="rd full-width css-be9e2a">R&amp;D</span>
1743-
<p class="review-text">Complete <b>Oct 10, 2024</b></p>
1743+
<p class="review-text">Complete <b>Mar 6, 2025</b></p>
17441744
</div>
17451745
</td>
17461746
<td>
@@ -1763,7 +1763,7 @@ <h2>Test Plans Status Summary</h2>
17631763
<path
17641764
fill="currentColor"
17651765
d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"></path></svg
1766-
><b>V24.10.10</b></span
1766+
><b>V25.03.06</b></span
17671767
></a
17681768
></span
17691769
><button
@@ -2210,15 +2210,15 @@ <h2>Test Plans Status Summary</h2>
22102210
<td>
22112211
<div class="css-bpz90">
22122212
<span class="rd full-width css-be9e2a">R&amp;D</span>
2213-
<p class="review-text">Complete <b>Mar 17, 2022</b></p>
2213+
<p class="review-text">Complete <b>Mar 6, 2025</b></p>
22142214
</div>
22152215
</td>
22162216
<td>
22172217
<div role="list" aria-setsize="2" class="css-1bj5ml9">
22182218
<span
22192219
class="full-width auto-width css-36z7cz"
22202220
role="listitem"
2221-
><a href="/test-review/60"
2221+
><a href="/test-review/93"
22222222
><span
22232223
><svg
22242224
aria-hidden="true"
@@ -2233,7 +2233,7 @@ <h2>Test Plans Status Summary</h2>
22332233
<path
22342234
fill="currentColor"
22352235
d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"></path></svg
2236-
><b>V22.03.17-1</b></span
2236+
><b>V25.03.06</b></span
22372237
></a
22382238
></span
22392239
><button

0 commit comments

Comments
 (0)