|
| 1 | +const utils = require('./utils.js') |
| 2 | + |
1 | 3 | async function perfTest(context, commands) {
|
2 |
| - await commands.measure.start( |
3 |
| - 'https://browserbench.org/Speedometer2.0/?iterationCount=10'); |
| 4 | + const URL = 'https://www.browserbench.org/Speedometer2.1' |
| 5 | + const getResults = 'document.getElementById("result-number")?.textContent'; |
| 6 | + |
| 7 | + // One warm up iteration: |
| 8 | + await commands.navigate(`${URL}?iterationCount=1`); |
| 9 | + await commands.js.run('startTest()'); |
| 10 | + await utils.waitForThrottled(commands, getResults); |
| 11 | + |
| 12 | + await commands.measure.start(`${URL}?iterationCount=100'`); |
4 | 13 | await commands.js.run('startTest()');
|
5 | 14 |
|
6 |
| - while (true) { |
7 |
| - await commands.wait.byTime(3000) |
8 |
| - value = await commands.js.run( |
9 |
| - "return window.document.getElementById('result-number').innerHTML") |
10 |
| - if (value && value != '') { |
11 |
| - console.log('got result', value) |
12 |
| - commands.measure.addObject({ 'speedometer2_score': parseFloat(value) }); |
13 |
| - break; |
14 |
| - } |
15 |
| - } |
| 15 | + const value = await utils.waitForThrottled(commands, getResults); |
| 16 | + const error = await commands.js.run( |
| 17 | + 'return document.getElementById("confidence-number").textContent.substr(2)') |
| 18 | + console.log('got result = ', value, 'std =', error) |
| 19 | + commands.measure.addObject( |
| 20 | + { |
| 21 | + 'speedometer2.1': parseFloat(value), |
| 22 | + 'speedometer2.1_error': parseFloat(error) |
| 23 | + }); |
16 | 24 | await commands.screenshot.take('result')
|
17 | 25 | };
|
18 | 26 |
|
|
0 commit comments