(page, scenario, size)
| 56 | } |
| 57 | |
| 58 | async function prepare(page, scenario, size) { |
| 59 | let {fixture, action, name} = driver(scenario); |
| 60 | let context = {page, size, action}; |
| 61 | await page.evaluate(() => window.__bench.reset()); |
| 62 | // Mount actions measure mounting itself; every other action starts mounted. |
| 63 | if (name !== 'mount') { |
| 64 | await page.locator('#mount').click(); |
| 65 | await page.waitForFunction( |
| 66 | () => document.querySelector('#fixture')?.getAttribute('data-mounted') === 'true' |
| 67 | ); |
| 68 | await fixture.prepare?.(context); |
| 69 | } |
| 70 | await action.prepare?.(context); |
| 71 | await page.evaluate(async () => { |
| 72 | await document.fonts.ready; |
| 73 | await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))); |
| 74 | }); |
| 75 | } |
| 76 | |
| 77 | async function perform({page, session, size}, scenario) { |
| 78 | let {fixture, action} = driver(scenario); |
no test coverage detected