Skip to content

Commit 7563f6d

Browse files
authored
fix: Include additional "Raise an Issue" links (#1281)
* Include link to Review Page from Test Run * Includes "Raise an Issue" link on Test Review page * Support raising an issue for a specific command from Test Run page * Infer issue creation's isCandidateReview flag where applicable * Show if issue is being created for a published report
1 parent 2108025 commit 7563f6d

File tree

16 files changed

+179
-77
lines changed

16 files changed

+179
-77
lines changed

.eslintrc.json

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
"ignorePatterns": [
3+
"client/dist/*",
4+
"client/dist/bundle.js",
5+
"client/tests/e2e/snapshots/saved"
6+
],
27
"env": {
38
"browser": true,
49
"es6": true,
@@ -19,40 +24,19 @@
1924
"ecmaVersion": 2020,
2025
"sourceType": "module"
2126
},
22-
"plugins": [
23-
"react",
24-
"json",
25-
"prettier",
26-
"jest"
27-
],
27+
"plugins": ["react", "json", "prettier", "jest"],
2828
"rules": {
29-
"linebreak-style": [
30-
"error",
31-
"unix"
32-
],
33-
"semi": [
34-
"error",
35-
"always"
36-
],
37-
"eol-last": [
38-
"error",
39-
"always"
40-
],
29+
"linebreak-style": ["error", "unix"],
30+
"semi": ["error", "always"],
31+
"eol-last": ["error", "always"],
4132
"no-console": [
4233
"error",
4334
{
44-
"allow": [
45-
"warn",
46-
"error"
47-
]
35+
"allow": ["warn", "error"]
4836
}
4937
],
50-
"no-use-before-define": [
51-
"off"
52-
],
53-
"react/display-name": [
54-
"off"
55-
]
38+
"no-use-before-define": ["off"],
39+
"react/display-name": ["off"]
5640
},
5741
"settings": {
5842
"react": {

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
client/dist/*
2+
client/dist/bundle.js
3+
4+
# snaphosts
5+
client/tests/e2e/snapshots/saved

client/.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

client/components/Reports/SummarizeTestPlanReport.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ const SummarizeTestPlanReport = ({ testPlanVersion, testPlanReports }) => {
263263
atVersionName: testResult.atVersion.name,
264264
browserName: testPlanReport.browser.name,
265265
browserVersionName: testResult.browserVersion.name,
266+
versionPhase: testPlanVersion.phase,
266267
reportLink
267268
});
268269

client/components/SortableIssuesTable/index.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const SORT_FIELDS = {
2424
CLOSED_AT: 'closedAt'
2525
};
2626

27-
const SortableIssuesTable = ({ issues }) => {
27+
const SortableIssuesTable = ({ issues, issueLink }) => {
2828
const [activeSort, setActiveSort] = useState(SORT_FIELDS.STATUS);
2929
const [sortOrder, setSortOrder] = useState(TABLE_SORT_ORDERS.ASC);
3030
const [activeFilter, setActiveFilter] = useState('OPEN');
@@ -187,12 +187,20 @@ const SortableIssuesTable = ({ issues }) => {
187187
{renderTableBody()}
188188
</ThemeTable>
189189
)}
190+
{issueLink && (
191+
<div style={{ marginTop: '1rem' }}>
192+
<a href={issueLink} target="_blank" rel="noreferrer">
193+
Raise an Issue
194+
</a>
195+
</div>
196+
)}
190197
</>
191198
);
192199
};
193200

194201
SortableIssuesTable.propTypes = {
195-
issues: PropTypes.arrayOf(IssuePropType).isRequired
202+
issues: PropTypes.arrayOf(IssuePropType).isRequired,
203+
issueLink: PropTypes.string
196204
};
197205

198206
export default SortableIssuesTable;

client/components/TestRenderer/index.jsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import UnexpectedBehaviorsFieldset from './UnexpectedBehaviorsFieldset';
2727
import supportJson from '../../resources/support.json';
2828
import commandsJson from '../../resources/commands.json';
2929
import { AtPropType, TestResultPropType } from '../common/proptypes/index.js';
30+
import createIssueLink from '@client/utils/createIssueLink';
3031

3132
const Container = styled.div`
3233
width: 100%;
@@ -163,7 +164,8 @@ const TestRenderer = ({
163164
isReviewingBot = false,
164165
isReadOnly = false,
165166
isEdit = false,
166-
setIsRendererReady = false
167+
setIsRendererReady = false,
168+
commonIssueContent
167169
}) => {
168170
const { scenarioResults, test = {}, completedAt } = testResult;
169171
const { renderableContent } = test;
@@ -498,7 +500,7 @@ const TestRenderer = ({
498500
{mayAssertionsFailedCount} unsupported)
499501
</SubHeadingText>
500502
<TestPlanResultsTable
501-
test={{ title: header, at }}
503+
test={{ id: test.id, title: header, at }}
502504
testResult={testResult}
503505
/>
504506
</>
@@ -543,6 +545,13 @@ const TestRenderer = ({
543545
unexpectedBehaviors,
544546
assertionsHeader
545547
} = value;
548+
549+
const commandString = header.replace('After ', '');
550+
const issueLink = createIssueLink({
551+
...commonIssueContent,
552+
commandString
553+
});
554+
546555
return (
547556
<Fragment key={`AtOutputKey_${commandIndex}`}>
548557
<InnerSectionHeadingText>{header}</InnerSectionHeadingText>
@@ -564,6 +573,9 @@ const TestRenderer = ({
564573
isSubmitted={isSubmitted}
565574
readOnly={isReadOnly}
566575
/>
576+
<a href={issueLink} target="_blank" rel="noreferrer">
577+
Raise an issue for {commandString}
578+
</a>
567579
</Fragment>
568580
);
569581
})}
@@ -604,7 +616,8 @@ TestRenderer.propTypes = {
604616
isReadOnly: PropTypes.bool,
605617
isEdit: PropTypes.bool,
606618
isReviewingBot: PropTypes.bool,
607-
setIsRendererReady: PropTypes.func
619+
setIsRendererReady: PropTypes.func,
620+
commonIssueContent: PropTypes.object
608621
};
609622

610623
export default TestRenderer;

client/components/TestReview/index.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Fragment, useMemo, useState } from 'react';
22
import { useQuery } from '@apollo/client';
33
import { TEST_REVIEW_PAGE_QUERY } from './queries';
44
import { Container } from 'react-bootstrap';
5-
import { Link, useParams } from 'react-router-dom';
5+
import { Link, useLocation, useParams } from 'react-router-dom';
66
import { Helmet } from 'react-helmet';
77
import PageStatus from '../common/PageStatus';
88
import InstructionsRenderer from '../CandidateReview/CandidateTestPlanRun/InstructionsRenderer';
@@ -12,6 +12,7 @@ import { derivePhaseName } from '../../utils/aria';
1212
import { dates } from 'shared';
1313
import supportJson from '../../resources/support.json';
1414
import SortableIssuesTable from '../SortableIssuesTable';
15+
import createIssueLink from '../../utils/createIssueLink';
1516

1617
const Ul = styled.ul`
1718
li {
@@ -28,6 +29,7 @@ const FilterButtonContainer = styled.div`
2829
`;
2930

3031
const TestReview = () => {
32+
const location = useLocation();
3133
const { testPlanVersionId } = useParams();
3234

3335
const { loading, data, error } = useQuery(TEST_REVIEW_PAGE_QUERY, {
@@ -237,7 +239,16 @@ const TestReview = () => {
237239
}
238240
)}
239241
</ul>
240-
<SortableIssuesTable issues={issues} />
242+
<SortableIssuesTable
243+
issues={issues}
244+
issueLink={createIssueLink({
245+
testPlanTitle: testPlanVersion.title,
246+
testPlanDirectory: testPlanVersion.testPlan.directory,
247+
versionString: testPlanVersion.versionString,
248+
testReviewLink: `https://aria-at-.w3.org${location.pathname}`,
249+
versionPhase: testPlanVersion.versionPhase
250+
})}
251+
/>
241252
<h2>Tests</h2>
242253
<FilterButtonContainer>
243254
<FilterButtons

client/components/TestRun/Heading.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const TestRunHeading = ({
2424
openAsUser,
2525
showEditAtBrowser,
2626
testPlanTitle,
27+
testPlanVersionString,
28+
testPlanVersionReviewLink,
2729
testResults,
2830
testIndex,
2931
testCount,
@@ -137,6 +139,7 @@ const TestRunHeading = ({
137139
);
138140
}
139141

142+
const testPlanName = `${testPlanTitle} ${testPlanVersionString}`;
140143
return (
141144
<>
142145
<div className="test-info-wrapper">
@@ -145,7 +148,8 @@ const TestRunHeading = ({
145148
data-testid="apg-example-name"
146149
>
147150
<div className="info-label">
148-
<b>Test Plan:</b> {testPlanTitle}
151+
<b>Test Plan:</b>&nbsp;
152+
<a href={testPlanVersionReviewLink}>{testPlanName}</a>
149153
</div>
150154
</div>
151155
<div className="test-info-entity at-browser" data-testid="at-browser">
@@ -177,6 +181,8 @@ const TestRunHeading = ({
177181

178182
TestRunHeading.propTypes = {
179183
testPlanTitle: PropTypes.string.isRequired,
184+
testPlanVersionString: PropTypes.string.isRequired,
185+
testPlanVersionReviewLink: PropTypes.string.isRequired,
180186
at: PropTypes.string.isRequired,
181187
browser: PropTypes.string.isRequired,
182188
showEditAtBrowser: PropTypes.bool.isRequired,

client/components/TestRun/index.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import { evaluateAuth } from '../../utils/evaluateAuth';
3939
import './TestRun.css';
4040
import ReviewConflicts from '../ReviewConflicts';
4141
import createIssueLink from '../../utils/createIssueLink';
42-
import { dates } from 'shared';
4342
import { Provider as CollectionJobContextProvider } from './CollectionJobContext';
4443
import { useUrlTestIndex } from '../../hooks/useUrlTestIndex';
4544

@@ -360,16 +359,13 @@ const TestRun = () => {
360359
}
361360
adminReviewerCheckedRef.current = true;
362361

363-
let issueLink;
362+
let issueLink, commonIssueContent;
364363
const hasLoadingCompleted = Object.keys(currentTest).length;
365364
if (hasLoadingCompleted) {
366-
issueLink = createIssueLink({
365+
commonIssueContent = {
367366
testPlanTitle: testPlanVersion.title,
368367
testPlanDirectory: testPlanVersion.testPlan.directory,
369-
versionString: `V${dates.convertDateToString(
370-
testPlanVersion.updatedAt,
371-
'YY.MM.DD'
372-
)}`,
368+
versionString: testPlanVersion.versionString,
373369
testTitle: currentTest.title,
374370
testRowNumber: currentTest.rowNumber,
375371
testSequenceNumber: currentTest.seq,
@@ -379,7 +375,8 @@ const TestRun = () => {
379375
atVersionName: currentAtVersion?.name,
380376
browserVersionName: currentBrowserVersion?.name,
381377
conflictMarkdown: conflictMarkdownRef.current
382-
});
378+
};
379+
issueLink = createIssueLink(commonIssueContent);
383380
}
384381

385382
const remapScenarioResults = (
@@ -969,7 +966,7 @@ const TestRun = () => {
969966
<ul className="options-wrapper" aria-labelledby="test-options-heading">
970967
<li>
971968
<OptionButton
972-
text="Raise An Issue"
969+
text="Raise an Issue"
973970
icon={
974971
<FontAwesomeIcon icon={faExclamationCircle} color="#94979b" />
975972
}
@@ -1051,6 +1048,7 @@ const TestRun = () => {
10511048
isSubmitted={isTestSubmitClicked}
10521049
isEdit={isTestEditClicked}
10531050
setIsRendererReady={setIsRendererReady}
1051+
commonIssueContent={commonIssueContent}
10541052
/>
10551053
</Row>
10561054
{isRendererReady && (
@@ -1143,6 +1141,8 @@ const TestRun = () => {
11431141
testPlanTitle={
11441142
testPlanVersion.title || testPlanVersion.testPlan?.directory || ''
11451143
}
1144+
testPlanVersionString={testPlanVersion.versionString}
1145+
testPlanVersionReviewLink={`/test-review/${testPlanVersion.id}`}
11461146
at={`${testPlanReport.at?.name}${
11471147
isViewingRun ? ` ${currentAtVersion?.name}` : ''
11481148
}`}

client/tests/e2e/TestRun.e2e.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,23 +336,23 @@ describe('Test Run when signed in as tester', () => {
336336
await page.waitForSelector('h1 ::-p-text(Test 1)');
337337
await page.waitForSelector('button ::-p-text(Next Test)');
338338

339-
const radioSelector = 'input[type="radio"]';
339+
const radioSelector = 'input[type="radio"][id^="pass-"]';
340340
const test1NavSelector = 'nav#test-navigator-nav ol li:nth-child(1)';
341341
const test2NavSelector = 'nav#test-navigator-nav ol li:nth-child(2)';
342342
const nextTestButtonSelector = 'button ::-p-text(Next Test)';
343343
const previousTestButtonSelector = 'button ::-p-text(Previous Test)';
344344

345345
// Randomly select radio buttons on first test
346346
const generatedCheckedTest1Count =
347-
await getGeneratedCheckedAssertionCount(page, radioSelector);
347+
await getGeneratedCheckedAssertionCount(page);
348348

349349
// Navigate to test 2 with navigation menu
350350
await page.$eval(test2NavSelector, el => el.querySelector('a').click());
351351
await page.waitForNetworkIdle();
352352
await page.waitForSelector('h1 ::-p-text(Test 2:)');
353353
await page.waitForSelector('button ::-p-text(Next Test)');
354354
const generatedCheckedTest2Count =
355-
await getGeneratedCheckedAssertionCount(page, radioSelector);
355+
await getGeneratedCheckedAssertionCount(page);
356356

357357
// Navigate to test 3 with next button
358358
await page.click(nextTestButtonSelector);

0 commit comments

Comments
 (0)