Skip to content

Commit 92308f4

Browse files
authored
Merge pull request #145 from w3c/use-wpt
WIP: Use wpt.fyi data instead of Igalia servers
2 parents 3c93ffa + 815522c commit 92308f4

File tree

2 files changed

+32
-37
lines changed

2 files changed

+32
-37
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
github: "w3c/mathml-core",
4242
mdn: false,
4343
testSuiteURI: "https://github.com/web-platform-tests/wpt/tree/master/mathml/",
44-
implementationReportURI: "https://w3c.github.io/mathml-core/implementation-report.html",
44+
implementationReportURI: "https://wpt.fyi/results/?label=master&label=experimental&aligned&q=math%20%20not%28path%3A%2Fjs%29",
4545

4646
localBiblio: {
4747
"MATHML4": {

spec-implementation-report.js

+31-36
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,40 @@
22
/* vim: set ts=4 et sw=4 tw=80: */
33

44
/*
5-
Massage each engines data into a nice indexed
5+
Get the latest aligned run data from WPT,
6+
massage it into a nice indexed
67
result set (testPath:result) for quick reference
78
*/
9+
let wptDataPromise = async function () {
10+
let f = await fetch('https://wpt.fyi/api/runs?aligned');
11+
let data = await f.json();
12+
let ids = data.map(rec => rec.id).join();
813

14+
// Note: this may get a bit "too much", but it doesn't matter to results
15+
f = await fetch(`https://wpt.fyi/api/search?label=master&label=experimental&q=math&run_ids=${ids}`);
16+
data = await f.json();
917

10-
async function getBrowserWPTData(browser) {
11-
let ret = {
12-
engine: browser,
13-
results: {}
14-
}
15-
let data = await fetchWebPlatformTestResults(browser);
16-
data.results.forEach(item => {
17-
if (item.status === "OK") {
18-
// Check all the subtests.
19-
item.status = "FAIL";
20-
if (item.subtests && item.subtests.length > 0) {
21-
item.status = "PASS";
22-
for (i in item.subtests) {
23-
if (item.subtests[i].status !== "PASS") {
24-
item.status = "FAIL";
25-
break;
26-
}
27-
}
28-
}
29-
}
30-
ret.results[item.test] = item.status;
31-
})
32-
return ret
33-
}
18+
return data.runs.map((run, i) => {
19+
let retVal = {
20+
engine: run.browser_name,
21+
results: {}
22+
};
3423

35-
/*
36-
We can launch these early and get data
37-
*/
38-
let wptDataPromise = Promise.all([
39-
// getBrowserWPTData('blink'),
40-
getBrowserWPTData('chrome'),
41-
getBrowserWPTData('firefox'),
42-
getBrowserWPTData('safari')
43-
])
24+
data.results.forEach((item) => {
25+
retVal.results[item.test] = (
26+
item.legacy_status[i].passes
27+
==
28+
item.legacy_status[i].total
29+
)
30+
?
31+
"PASS"
32+
:
33+
"FAIL";
34+
35+
})
36+
return retVal;
37+
});
38+
}();
4439

4540
/*
4641
Before we start, re-attach
@@ -83,7 +78,7 @@ async function loadWebPlaformTestsResults() {
8378
let ENGINE_LOGOS = {
8479
'firefox': "https://test.csswg.org/harness/img/gecko.svg",
8580
'safari': "https://test.csswg.org/harness/img/webkit.svg",
86-
// 'blink': "https://pbs.twimg.com/profile_images/1576817016/igalia_400x400.png",
81+
'edge': "https://test.csswg.org/harness/img/edge.svg",
8782
'chrome': "https://test.csswg.org/harness/img/blink.svg",
8883
};
8984

@@ -143,7 +138,7 @@ async function loadWebPlaformTestsResults() {
143138
let frag = document.createRange().createContextualFragment(source);
144139
annotationEl.appendChild(frag);
145140

146-
});
147141

142+
});
148143
document.getElementById("implementation-report").insertAdjacentHTML("beforeend", `<div style="margin-left: 2em; margin-right: 2em"><a href="${respecConfig.implementationReportURI}">Implementation Report</a></div>`);
149144
}

0 commit comments

Comments
 (0)