Skip to content

Commit 39b4afc

Browse files
[triage] Allow the triaging of a test, unrelated to a product
This adds support for triaging a test unrelated to a product (e.g. Chrome). The goal is to allow the triaging of tests that are problematic due to the test itself (e.g. if the test violates the spec or has bugs), rather than problematic due to a browser bug. To achieve this without changing the current data model, we use the current support for an empty product. This is currently unused, but was meant to be for URLs that affect all tests so matches well to the new use-case. Metadata for this case are shown next to the test name rather than in the results boxes, and similarly one triages test issues by selecting the test name cell.
1 parent 4ea14ab commit 39b4afc

File tree

7 files changed

+51
-8
lines changed

7 files changed

+51
-8
lines changed

webapp/components/product-info.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ const ProductInfo = (superClass) => class extends superClass {
142142
return '';
143143
}
144144

145+
displayMetadataLogo(productName) {
146+
// Special case for metadata; an empty product name maps to the WPT logo.
147+
if (productName === '') {
148+
productName = 'wpt';
149+
}
150+
return this.displayLogo(productName);
151+
}
152+
145153
displayLogo(name, labels) {
146154
if (!name) {
147155
return;

webapp/components/test/product-info.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
expect(productInfo.displayLabels(['foo', 'bar'])).to.equal('foo, bar');
4343
});
4444

45+
test('displayMetadataLogo', () => {
46+
expect(productInfo.displayMetadataLogo('')).to.equal('/static/wpt_64x64.png');
47+
expect(productInfo.displayMetadataLogo('chrome')).to.equal('/static/chrome_64x64.png');
48+
});
49+
4550
test('displayLogo', () => {
4651
expect(productInfo.displayLogo(undefined, undefined)).to.equal(undefined);
4752
expect(productInfo.displayLogo('browser', undefined)).to.equal('/static/browser_64x64.png');

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@
8181

8282
assert.deepEqual(appFixture.getTriagedMetadataMap(displayedMetadata), expected);
8383
});
84+
test('getTriagedMetadataMap(displayedMetadata) for a test-level triage', () => {
85+
appFixture.path = '/abc';
86+
const displayedMetadata = [
87+
{ product: '', url: 'foo', tests: ['testA.html'] },
88+
];
89+
// When there is no product, we have to remove the product from the
90+
// metadata map for calling into /api/metadata/triage.
91+
const expected = {
92+
'testA.html': [{ url: 'foo' }],
93+
};
94+
95+
assert.deepEqual(appFixture.getTriagedMetadataMap(displayedMetadata), expected);
96+
});
8497
test('getTriagedMetadataMap(displayedMetadata) with a testfile path', () => {
8598
appFixture.path = '/abc/foo.html';
8699
const displayedMetadata = [
@@ -144,4 +157,4 @@
144157
</script>
145158
</body>
146159

147-
</html>
160+
</html>

webapp/components/wpt-amend-metadata.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class AmendMetadata extends LoadingState(PathInfo(ProductInfo(PolymerElement)))
158158
<paper-dialog-scrollable>
159159
<template is="dom-repeat" items="[[displayedMetadata]]" as="node">
160160
<div class="metadata-entry">
161-
<img class="browser" src="[[displayLogo(node.product)]]">
161+
<img class="browser" src="[[displayMetadataLogo(node.product)]]">
162162
:
163163
<paper-input label="Bug URL" value="{{node.url}}" autofocus></paper-input>
164164
</div>
@@ -252,7 +252,11 @@ class AmendMetadata extends LoadingState(PathInfo(ProductInfo(PolymerElement)))
252252
if (!(test in link)) {
253253
link[test] = [];
254254
}
255-
link[test].push({ 'url': entry.url, 'product': entry.product });
255+
const metadata = { 'url': entry.url };
256+
if (entry.product !== '') {
257+
metadata['product'] = entry.product;
258+
}
259+
link[test].push(metadata);
256260
}
257261
}
258262
}

webapp/components/wpt-metadata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class WPTMetadataNode extends ProductInfo(PolymerElement) {
4242
<iron-icon class="bug" icon="bug-report"></iron-icon>
4343
<div>
4444
<a href="[[testHref]]" target="_blank">[[metadataNode.test]]</a> >
45-
<img class="browser" src="[[displayLogo(metadataNode.product)]]"> :
45+
<img class="browser" src="[[displayMetadataLogo(metadataNode.product)]]"> :
4646
<a href="[[metadataNode.url]]" target="_blank">[[metadataNode.url]]</a>
4747
<br />
4848
</div>

webapp/static/wpt_64x64.png

5.24 KB
Loading

webapp/views/wpt-results.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@ class WPTResults extends AmendMetadataMixin(Pluralizer(WPTColors(WPTFlags(PathIn
226226
</template>
227227
</template>
228228
</td>
229-
<td>
229+
<td onclick="[[handleTriageSelect(null, node, testRun)]]" onmouseover="[[handleTriageHover(null, node, testRun)]]">
230230
<path-part prefix="/results" path="{{ node.path }}" query="{{ query }}" is-dir="{{ node.isDir }}"></path-part>
231+
<template is="dom-if" if="[[shouldDisplayMetadata(null, node.path, metadataMap)]]">
232+
<a href="[[ getMetadataUrl(null, node.path, metadataMap) ]]" target="_blank">
233+
<iron-icon class="bug" icon="bug-report"></iron-icon>
234+
</a>
235+
</template>
231236
</td>
232237
233238
<template is="dom-repeat" items="{{testRuns}}" as="testRun">
@@ -871,6 +876,12 @@ class WPTResults extends AmendMetadataMixin(Pluralizer(WPTColors(WPTFlags(PathIn
871876
}
872877

873878
canAmendMetadata(node, index, testRun) {
879+
// It is always possible in triage mode to amend metadata for a problem
880+
// with a test file itself.
881+
if (index === undefined) {
882+
return !node.isDir && this.triageMetadataUI && this.isTriageMode;
883+
}
884+
874885
const totalTests = this.getNodeResultDataByPropertyName(node, index, testRun, 'total');
875886
const passedTests = this.getNodeResultDataByPropertyName(node, index, testRun, 'passes');
876887
return (totalTests - passedTests) > 0 && this.triageMetadataUI && this.isTriageMode;
@@ -1044,7 +1055,8 @@ class WPTResults extends AmendMetadataMixin(Pluralizer(WPTColors(WPTFlags(PathIn
10441055
return;
10451056
}
10461057

1047-
this.handleSelect(e.target.closest('td'), this.displayedProducts[index].browser_name, node.path, this.$['selected-toast']);
1058+
const product = index === undefined ? '' : this.displayedProducts[index].browser_name;
1059+
this.handleSelect(e.target.closest('td'), product, node.path, this.$['selected-toast']);
10481060
};
10491061
}
10501062

@@ -1065,13 +1077,14 @@ class WPTResults extends AmendMetadataMixin(Pluralizer(WPTColors(WPTFlags(PathIn
10651077
testname = testname + '/*';
10661078
}
10671079

1068-
const key = testname + this.displayedProducts[index].browser_name;
1080+
const browserName = index === undefined ? '' : this.displayedProducts[index].browser_name;
1081+
const key = testname + browserName;
10691082
if (key in metadataMap) {
10701083
if ('/' in metadataMap[key]) {
10711084
return metadataMap[key]['/'];
10721085
}
10731086

1074-
// If a URL link does not exit on a test level, return the first subtest link.
1087+
// If a URL link does not exist on a test level, return the first subtest link.
10751088
const subtestMap = metadataMap[key];
10761089
return subtestMap[Object.keys(subtestMap)[0]];
10771090
}

0 commit comments

Comments
 (0)