MCPcopy Create free account
hub / github.com/adobe/react-spectrum / measureTrials

Function measureTrials

perf/runner.mjs:210–236  ·  view source on GitHub ↗
(pages, scenario, arms, block, options, samples, onTrial)

Source from the content-addressed store, hash-verified

208// ABBA order so drift within a launch affects both arms alike. `onTrial` reports the
209// page being measured, for failure screenshots.
210async function measureTrials(pages, scenario, arms, block, options, samples, onTrial) {
211 for (let trial = -options.warmup; trial < options.samples; trial++) {
212 let order = (trial + options.warmup) % 2 ? [...arms].reverse() : arms;
213 for (let [position, arm] of order.entries()) {
214 let current = pages[arm];
215 onTrial(current);
216 // Keep the measured page frontmost so headed windows are never occluded.
217 await current.page.bringToFront();
218 await prepare(current.page, scenario, current.size);
219 let sample = await perform(current, scenario);
220 if (current.errors.length) {
221 throw new Error(current.errors.join('\n'));
222 }
223 if (trial >= 0) {
224 samples.push({
225 scenario: scenario.id,
226 arm,
227 block,
228 trial,
229 position,
230 ...sample,
231 metrics: metrics(sample)
232 });
233 }
234 }
235 }
236}
237
238async function diagnose(browser, server, result, dir, isInterrupted) {
239 for (let scenario of result.scenarios) {

Callers 1

runFunction · 0.85

Calls 4

metricsFunction · 0.90
prepareFunction · 0.85
pushMethod · 0.80
performFunction · 0.70

Tested by

no test coverage detected