Skip to content

Commit 75b023f

Browse files
committed
This modifies the WPT page to show information about subtests
This is a companion of servo/internal-wpt-dashboard#56 Signed-off-by: Manuel Rego Casasnovas <[email protected]>
1 parent 0a34f95 commit 75b023f

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

assets/js/load-chart.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
google.charts.load('current', { packages: ['corechart', 'line'] })
44
google.charts.setOnLoadCallback(setupChart)
55

6-
const fetchData = fetch('https://wpt.servo.org/scores.json')
6+
const fetchData = fetch('/js/scores.json')
77
const embed = location.search === '?embed'
88
let dark_mode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
99

@@ -38,7 +38,8 @@ function parseDateString (date) {
3838
function toolTip (date, wpt_sha, servo_version, score, engine) {
3939
return `
4040
<b>${formatDate(date)}</b></br>
41-
Score: <b>${score / 10}</b></br>
41+
Score: <b>${Math.floor(100 * score.total_score / score.total_tests)}%</b></br>
42+
Subtests: <b>${Math.floor(100 * score.total_subtests_passed / score.total_subtests )}%</b></br>
4243
WPT: ${wpt_sha}</br>
4344
Servo (${engine}): ${servo_version}
4445
`
@@ -129,7 +130,9 @@ function setupChart () {
129130
table.addColumn('date', 'runOn')
130131

131132
options.series.push({ color: dark_mode ? '#CC9933' : '#3366CC' })
132-
table.addColumn('number', 'Servo')
133+
table.addColumn('number', 'Score')
134+
table.addColumn({ type: 'string', role: 'tooltip', p: { html: true } })
135+
table.addColumn('number', 'Subtests')
133136
table.addColumn({ type: 'string', role: 'tooltip', p: { html: true } })
134137

135138
for (const scores_for_run of all_scores.scores) {
@@ -141,7 +144,9 @@ function setupChart () {
141144
}
142145
const row = [
143146
date,
144-
area_score / 1000,
147+
area_score.total_score / area_score.total_tests,
148+
toolTip(date, wpt_sha, browser_version, area_score, 'Servo'),
149+
area_score.total_subtests_passed / area_score.total_subtests,
145150
toolTip(date, wpt_sha, browser_version, area_score, 'Servo')
146151
]
147152
table.addRow(row)
@@ -161,12 +166,15 @@ function setupChart () {
161166
removeChildren(score_table)
162167

163168
for (const [idx, area] of scores.area_keys.entries()) {
164-
const recent_score = scores.scores[scores.scores.length - 1]
169+
const area_score = scores.scores[scores.scores.length - 1][idx + AREA_SCORE_OFFSET]
170+
const score = Math.floor(100 * area_score.total_score / area_score.total_tests)
171+
const subtests = Math.floor(100 * area_score.total_subtests_passed / area_score.total_subtests)
165172
score_table.insertAdjacentHTML(
166173
'beforeend',
167174
`<tr class="${idx % 2 ? 'odd' : 'even'}">
168175
<td>${scores.focus_areas[area]}</td>
169-
<td class="score">${String(recent_score[idx + AREA_SCORE_OFFSET] / 10).padEnd(4, '.0')}%</td>
176+
<td class="score">${String(score).padEnd(4, '.0')}%</td>
177+
<td class="score">(${area_score.total_subtests_passed}/${area_score.total_subtests}) ${String(subtests).padEnd(4, '.0')}%</td>
170178
</tr>`
171179
)
172180
}

wpt.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ title: WPT Pass Rates
2828
padding: 5px 10px;
2929
}
3030

31+
#score-table th {
32+
text-align: right;
33+
}
3134
#score-table th:nth-child(1) {
3235
text-align: left;
3336
}
3437

3538
#score-table-body .score {
3639
text-align: right;
40+
font-family: "Fira Mono", monospace;
3741
}
3842

3943
#score-explanation {
@@ -81,17 +85,14 @@ The chart below tracks our pass rates in several *focus areas* of the [Web Platf
8185
</div>
8286
<div id="servo-chart"></div>
8387
<table id="score-table">
84-
<thead id="score-table-header"><tr><th>Test Suite</th><th>Score</th></tr></thead>
88+
<thead id="score-table-header"><tr><th>Test Suite</th><th>Score</th><th>Subtests</th></tr></thead>
8589
<tbody id="score-table-body"></tbody>
8690
</table>
8791
<p id="score-explanation">
88-
Scores are calculated as percentages of total <b>enabled</b>
89-
tests within the suite that pass. A passing test with no
90-
subtests gets a score of 1 while a test with subtests gets a
91-
score between 0 and 1 representing the fraction of passing
92-
subtests within that test. This is different from the
93-
percentages on wpt.fyi which is calculated by giving equal
94-
weight to both top-level tests and subtests.
92+
There results are calculated as percentages of total <b>enabled</b> tests within the suite that pass.<br>
93+
<b>Scores</b> are computed as follows, a passing test with no subtests gets a score of 1
94+
while a test with subtests gets a score between 0 and 1 representing the fraction of passing subtests within that test.<br>
95+
<b>Subtests</b> are calculated by given equal weight to both top-level tests and subtests.
9596
</p>
9697
</div>
9798
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

0 commit comments

Comments
 (0)