Skip to content

Commit 512b810

Browse files
committed
Update reports pages to display trend reports on candidate page and also display minimum and exact AT version information where applicable
1 parent 54a5375 commit 512b810

File tree

4 files changed

+66
-15
lines changed

4 files changed

+66
-15
lines changed

client/components/Reports/SummarizeTestPlanReport.jsx

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,51 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
4242
);
4343
if (!testPlanReport) return <Navigate to="/404" />;
4444

45-
const { at, browser, recommendedAtVersion } = testPlanReport;
45+
const {
46+
at,
47+
browser,
48+
recommendedAtVersion,
49+
exactAtVersion,
50+
minimumAtVersion
51+
} = testPlanReport;
4652
const overallMetrics = getMetrics({ testPlanReport });
4753

4854
// Construct testPlanTarget
4955
const testPlanTarget = {
5056
id: `${at.id}${browser.id}`,
5157
at,
5258
browser,
53-
atVersion: recommendedAtVersion
59+
atVersion: recommendedAtVersion || exactAtVersion || minimumAtVersion,
60+
isMinimumAtVersion:
61+
!recommendedAtVersion && !exactAtVersion && !!minimumAtVersion
5462
};
5563

5664
const none = None('No Data');
5765

5866
const renderVersionsSummaryTable = () => {
59-
if (testPlanVersion.phase !== 'RECOMMENDED') return null;
67+
if (
68+
!(
69+
testPlanVersion.phase === 'RECOMMENDED' ||
70+
testPlanVersion.phase === 'CANDIDATE'
71+
)
72+
) {
73+
return null;
74+
}
75+
if (!testPlanTarget.atVersion) return null;
6076

6177
const title = `${testPlanTarget.at.name} Versions Summary`;
6278
const testPlanReportsForTarget = testPlanVersion.testPlanReports.filter(
6379
testPlanReport =>
6480
testPlanReport.at.id === at.id &&
6581
testPlanReport.browser.id === browser.id
6682
);
67-
testPlanReportsForTarget.sort(
68-
(a, b) =>
69-
new Date(b.recommendedAtVersion.releasedAt) -
70-
new Date(a.recommendedAtVersion.releasedAt)
71-
);
83+
testPlanReportsForTarget.sort((a, b) => {
84+
const aAtVersion =
85+
a.recommendedAtVersion || a.exactAtVersion || a.minimumAtVersion;
86+
const bAtVersion =
87+
b.recommendedAtVersion || b.exactAtVersion || b.minimumAtVersion;
88+
return new Date(bAtVersion.releasedAt) - new Date(aAtVersion.releasedAt);
89+
});
7290

7391
return (
7492
<>
@@ -88,22 +106,34 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
88106
</thead>
89107
<tbody>
90108
{testPlanReportsForTarget.map(testPlanReport => {
91-
const { recommendedAtVersion, metrics } = testPlanReport;
109+
const {
110+
recommendedAtVersion,
111+
exactAtVersion,
112+
minimumAtVersion,
113+
metrics
114+
} = testPlanReport;
92115
const { mustFormatted, shouldFormatted, mayFormatted } = metrics;
93116

117+
const atVersion =
118+
recommendedAtVersion || exactAtVersion || minimumAtVersion;
119+
const isMinimumAtVersion = atVersion === minimumAtVersion;
120+
const atVersionDisplayName = isMinimumAtVersion
121+
? `${atVersion.name} or later`
122+
: atVersion.name;
123+
94124
return (
95125
<tr key={`VersionsSummaryRow_${testPlanReport.id}`}>
96126
<td>
97127
{testPlanReportId === testPlanReport.id ? (
98-
<>{recommendedAtVersion.name}</>
128+
<>{atVersionDisplayName}</>
99129
) : (
100130
<Link
101131
to={
102132
`/report/${testPlanVersion.id}` +
103133
`/targets/${testPlanReport.id}`
104134
}
105135
>
106-
{recommendedAtVersion.name}
136+
{atVersionDisplayName}
107137
</Link>
108138
)}
109139
</td>

client/components/Reports/SummarizeTestPlanVersion.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,22 @@ const SummarizeTestPlanVersion = ({ testPlanVersion, testPlanReports }) => {
103103
if (testPlanReport.status === 'DRAFT') return null;
104104
const overallMetrics = getMetrics({ testPlanReport });
105105

106-
const { at, browser, recommendedAtVersion } = testPlanReport;
106+
const {
107+
at,
108+
browser,
109+
recommendedAtVersion,
110+
exactAtVersion,
111+
minimumAtVersion
112+
} = testPlanReport;
107113

108114
// Construct testPlanTarget
109115
const testPlanTarget = {
110116
id: `${at.id}${browser.id}`,
111117
at,
112118
browser,
113-
atVersion: recommendedAtVersion
119+
atVersion: recommendedAtVersion || exactAtVersion || minimumAtVersion,
120+
isMinimumAtVersion:
121+
!recommendedAtVersion && !exactAtVersion && !!minimumAtVersion
114122
};
115123

116124
return (

client/components/Reports/getTitles.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ const getTestPlanVersionTitle = (
88
return title;
99
};
1010

11-
const getTestPlanTargetTitle = ({ at, browser, atVersion }) => {
11+
const getTestPlanTargetTitle = ({
12+
at,
13+
browser,
14+
atVersion,
15+
isMinimumAtVersion
16+
}) => {
1217
if (!atVersion) return `${at.name} and ${browser.name}`;
13-
return `${at.name} ${atVersion.name} and ${browser.name}`;
18+
return `${at.name} ${atVersion.name}${
19+
isMinimumAtVersion ? ' or later' : ''
20+
} and ${browser.name}`;
1421
};
1522

1623
export { getTestPlanTargetTitle, getTestPlanVersionTitle };

client/components/Reports/queries.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ export const REPORT_PAGE_QUERY = gql`
145145
recommendedAtVersion {
146146
...AtVersionFields
147147
}
148+
exactAtVersion {
149+
...AtVersionFields
150+
}
151+
minimumAtVersion {
152+
...AtVersionFields
153+
}
148154
runnableTests {
149155
...TestFieldsSimple
150156
}

0 commit comments

Comments
 (0)