diff --git a/assets/js/load-chart.js b/assets/js/load-chart.js index 2cfe72fd5..55a176a28 100644 --- a/assets/js/load-chart.js +++ b/assets/js/load-chart.js @@ -38,7 +38,8 @@ function parseDateString (date) { function toolTip (date, wpt_sha, servo_version, score, engine) { return ` ${formatDate(date)}
- Score: ${score / 10}
+ Score: ${Math.floor(1000 * score.total_score / score.total_tests) / 10}%
+ Subtests: ${Math.floor(1000 * score.total_subtests_passed / score.total_subtests) / 10}%
WPT: ${wpt_sha}
Servo (${engine}): ${servo_version} ` @@ -129,7 +130,9 @@ function setupChart () { table.addColumn('date', 'runOn') options.series.push({ color: dark_mode ? '#CC9933' : '#3366CC' }) - table.addColumn('number', 'Servo') + table.addColumn('number', 'Score') + table.addColumn({ type: 'string', role: 'tooltip', p: { html: true } }) + table.addColumn('number', 'Subtests') table.addColumn({ type: 'string', role: 'tooltip', p: { html: true } }) for (const scores_for_run of all_scores.scores) { @@ -141,7 +144,9 @@ function setupChart () { } const row = [ date, - area_score / 1000, + area_score.total_score / area_score.total_tests, + toolTip(date, wpt_sha, browser_version, area_score, 'Servo'), + area_score.total_subtests_passed / area_score.total_subtests, toolTip(date, wpt_sha, browser_version, area_score, 'Servo') ] table.addRow(row) @@ -149,29 +154,6 @@ function setupChart () { chart.draw(table, options) } - function removeChildren (parent) { - while (parent.firstChild) { - parent.removeChild(parent.firstChild) - } - return parent - } - - function update_table (scores) { - const score_table = document.getElementById('score-table-body') - removeChildren(score_table) - - for (const [idx, area] of scores.area_keys.entries()) { - const recent_score = scores.scores[scores.scores.length - 1] - score_table.insertAdjacentHTML( - 'beforeend', - ` - ${scores.focus_areas[area]} - ${String(recent_score[idx + AREA_SCORE_OFFSET] / 10).padEnd(4, '.0')}% - ` - ) - } - } - fetchData .then(resp => resp.json()) .then(scores => { @@ -213,7 +195,6 @@ function setupChart () { } area_dropdown.value = scores.area_keys[0] period_dropdown.value = Object.keys(periodRanges)[4] - update_table(scores) update_chart() }) } diff --git a/assets/js/load-table.js b/assets/js/load-table.js new file mode 100644 index 000000000..588f00f54 --- /dev/null +++ b/assets/js/load-table.js @@ -0,0 +1,36 @@ +const fetchData = fetch('https://wpt.servo.org/scores-last-run.json') + +const AREA_SCORE_OFFSET = 3 + +function removeChildren (parent) { + while (parent.firstChild) { + parent.removeChild(parent.firstChild) + } + return parent +} + +function update_table (scores) { + const score_table = document.getElementById('score-table-body') + removeChildren(score_table) + + for (const [idx, area] of scores.area_keys.entries()) { + const area_score = scores.scores_last_run[idx + AREA_SCORE_OFFSET] + const score = Math.floor(1000 * area_score.total_score / area_score.total_tests) / 10 + const subtests = Math.floor(1000 * area_score.total_subtests_passed / area_score.total_subtests) / 10 + score_table.insertAdjacentHTML( + 'beforeend', + ` + ${scores.focus_areas[area]} + ${String(score).padEnd(4, '.0')}% + (${area_score.total_subtests_passed}/${area_score.total_subtests}) ${String(subtests).padEnd(4, '.0')}% + ` + ) + } +} + +fetchData + .then(resp => resp.json()) + .then(scores => { + update_table(scores) + }) + diff --git a/wpt.md b/wpt.md index 7448e48b4..9073c05e7 100644 --- a/wpt.md +++ b/wpt.md @@ -15,6 +15,10 @@ title: WPT Pass Rates padding: 10px; } + #score-table-container { + overflow-x: auto; + } + #score-table { width: 100%; } @@ -28,12 +32,16 @@ title: WPT Pass Rates padding: 5px 10px; } + #score-table th { + text-align: right; + } #score-table th:nth-child(1) { text-align: left; } #score-table-body .score { text-align: right; + font-family: "Fira Mono", monospace; } #score-explanation { @@ -80,19 +88,19 @@ The chart below tracks our pass rates in several *focus areas* of the [Web Platf
- - - -
Test SuiteScore
+
+ + + +
Test SuiteScoreSubtests
+

- Scores are calculated as percentages of total enabled - tests within the suite that pass. A passing test with no - subtests gets a score of 1 while a test with subtests gets a - score between 0 and 1 representing the fraction of passing - subtests within that test. This is different from the - percentages on wpt.fyi which is calculated by giving equal - weight to both top-level tests and subtests. + The results are calculated as percentages of total enabled tests within the suite that pass.
+ Scores are computed as follows: a passing test with no subtests gets a score of 1 + while a test with subtests gets a score between 0 and 1 representing the fraction of passing subtests within that test.
+ Subtests are calculated by giving equal weight to both top-level tests and subtests.

- \ No newline at end of file + + \ No newline at end of file