MCPcopy Create free account
hub / github.com/BuilderIO/framework-benchmarks / captureTodoReport

Function captureTodoReport

src/scripts/measure-flow.ts:18–58  ·  view source on GitHub ↗
(url: string, framework: string)

Source from the content-addressed store, hash-verified

16const RUNS = Number(process.env.RUNS || 1);
17
18async function captureTodoReport(url: string, framework: string) {
19 const page = await browser.newPage();
20
21 const flow = await startFlow(page, {
22 name: framework,
23 config: {
24 extends: 'lighthouse:default',
25 },
26 });
27
28 await page.goto(url, { waitUntil: 'networkidle0' });
29 await flow.snapshot({ stepName: 'Page loaded' });
30
31 const todoButtonSelector = 'form button';
32 await page.waitForSelector(todoButtonSelector);
33 await page.type('form input', 'new todo!');
34 await flow.startTimespan({ stepName: 'Add Todo' });
35 await page.click(todoButtonSelector);
36 await page.click(todoButtonSelector);
37 await page.click(todoButtonSelector);
38 await page.click(todoButtonSelector);
39 const newItemSelector = 'li[data-index="5"]';
40 await page.waitForSelector(newItemSelector);
41 await flow.endTimespan();
42 await flow.snapshot({ stepName: 'Added Todo Item' });
43
44 page.close();
45
46 const artifact = await flow.createArtifactsJson();
47 const flowResult = await auditFlowArtifacts(artifact);
48 reports.push(flowResult);
49 const report = await flow.generateReport();
50 await fs.writeFile('flow.report.html', report);
51 await fs.writeFile('flow.report.json', JSON.stringify(flowResult, null, 2));
52 console.info(
53 chalk.green(
54 `${framework} flow report generated. INP:`,
55 getInp(flowResult).displayValue
56 )
57 );
58}
59
60const omit = (obj: any, omitKeys: string[]) => {
61 const newObj = { ...obj };

Callers 1

measure-flow.tsFile · 0.70

Calls 1

getInpFunction · 0.70

Tested by

no test coverage detected