Skip to content

Commit c682c48

Browse files
[triage] Add a 'file issue' link for test-level issues (#2439)
The link is only added for test-level issues, and links to the new-issue interface in the wpt-metadata repository. The title is pre-filled based on the test name, and a 'compat2021-test-issue' label is added. Fixes #2420
1 parent ac4fac6 commit c682c48

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

webapp/components/test/wpt-amend-metadata.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@
152152
expect(appFixture.getSearchURL('/a/b.html', 'webkitgtk')).to.equal('https://bugs.webkit.org/buglist.cgi?quicksearch="/a/b"');
153153
expect(appFixture.getSearchURL('/a/b.html', 'servo')).to.equal('https://github.com/servo/servo/issues?q="/a/b"');
154154
});
155+
test('hasFileIssueURL', () => {
156+
expect(appFixture.hasFileIssueURL('')).to.be.true;
157+
expect(appFixture.hasFileIssueURL(null)).to.be.false;
158+
expect(appFixture.hasFileIssueURL(undefined)).to.be.false;
159+
expect(appFixture.hasFileIssueURL('chrome')).to.be.false;
160+
expect(appFixture.hasFileIssueURL('firefox')).to.be.false;
161+
});
162+
test('getFileIssueURL', () => {
163+
const expectedURL = 'https://github.com/web-platform-tests/wpt-metadata' +
164+
'/issues/new?title=%5Bcompat2021%5D+%2Ffoo%2Fbar.html+fails+due+to' +
165+
'+test+issue&labels=compat2021-test-issue';
166+
expect(appFixture.getFileIssueURL('/foo/bar.html')).to.equal(expectedURL);
167+
});
155168
});
156169
});
157170
</script>

webapp/components/wpt-amend-metadata.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ const AmendMetadataMixin = (superClass) => class extends superClass {
106106
}
107107
};
108108

109+
// AmendMetadata is a UI component that allows the user to associate a set of
110+
// tests or test results with a URL (usually a link to a bug-tracker). It is
111+
// commonly referred to as the 'triage UI'.
109112
class AmendMetadata extends LoadingState(PathInfo(ProductInfo(PolymerElement))) {
110113
static get is() {
111114
return 'wpt-amend-metadata';
@@ -168,6 +171,9 @@ class AmendMetadata extends LoadingState(PathInfo(ProductInfo(PolymerElement)))
168171
<template is="dom-if" if="[[hasSearchURL(node.product)]]">
169172
<a href="[[getSearchURL(test, node.product)]]" target="_blank"> [Search for bug] </a>
170173
</template>
174+
<template is="dom-if" if="[[hasFileIssueURL(node.product)]]">
175+
<a href="[[getFileIssueURL(test)]]" target="_blank"> [File test-level issue] </a>
176+
</template>
171177
</li>
172178
</template>
173179
</template>
@@ -293,6 +299,20 @@ class AmendMetadata extends LoadingState(PathInfo(ProductInfo(PolymerElement)))
293299
}
294300
}
295301

302+
hasFileIssueURL(product) {
303+
// We only support filing issues for test-level problems
304+
// (https://github.com/web-platform-tests/wpt.fyi/issues/2420). In this
305+
// class the test-level product is represented by an empty string.
306+
return product === '';
307+
}
308+
309+
getFileIssueURL(testName) {
310+
const params = new URLSearchParams();
311+
params.append('title', `[compat2021] ${testName} fails due to test issue`);
312+
params.append('labels', 'compat2021-test-issue');
313+
return `https://github.com/web-platform-tests/wpt-metadata/issues/new?${params}`;
314+
}
315+
296316
populateDisplayData() {
297317
this.displayedMetadata = [];
298318
const browserMap = {};

0 commit comments

Comments
 (0)