Validate every pane switch and drain warmup timing batches
This commit is contained in:
@@ -87,6 +87,12 @@ try {
|
||||
await delay(500);
|
||||
}
|
||||
|
||||
// Drain late timing batches from navigation and both warm-up switches.
|
||||
await delay(1200);
|
||||
for (let index = 0; index < 2; index++) {
|
||||
await page.evaluate('window.__perfKick?.();true');
|
||||
await delay(250);
|
||||
}
|
||||
await browser.send('Profiler.enable');
|
||||
await browser.send('Profiler.setSamplingInterval', { interval: 100 });
|
||||
await page.evaluate(`(() => {
|
||||
@@ -113,9 +119,20 @@ try {
|
||||
await browser.send('Profiler.start');
|
||||
|
||||
const start = performance.now();
|
||||
const selections = [];
|
||||
for (let index = 0; index < Number(options.switches); index++) {
|
||||
const expected = await page.evaluate(`(() => {
|
||||
const peek = document.querySelector('[flt-semantics-identifier^="chat-peek-"]');
|
||||
return peek?.getAttribute('flt-semantics-identifier').replace('chat-peek-', 'chat-pane-');
|
||||
})()`);
|
||||
if (!expected) throw new Error('No inactive chat preview to switch');
|
||||
await page.click(peekTarget);
|
||||
await delay(Number(options.cadence));
|
||||
const selected = await page.evaluate(`Boolean(document.querySelector(
|
||||
'[flt-semantics-identifier="' + ${JSON.stringify(expected)} + '"]'
|
||||
))`);
|
||||
selections.push({ expected, selected });
|
||||
if (!selected) throw new Error(`Switch ${index + 1} did not activate ${expected}`);
|
||||
}
|
||||
await delay(300);
|
||||
const elapsed = performance.now() - start;
|
||||
@@ -157,6 +174,7 @@ try {
|
||||
elapsedMs: round(elapsed),
|
||||
switches: Number(options.switches),
|
||||
cadenceMs: Number(options.cadence),
|
||||
confirmedSwitches: selections.filter((item) => item.selected).length,
|
||||
frames: useful.length,
|
||||
buildSumMs: sum(0),
|
||||
buildMaxMs: max(0),
|
||||
@@ -175,7 +193,7 @@ try {
|
||||
runs.push(result);
|
||||
await writeFile(
|
||||
join(options.out, `run-${repetition + 1}-frames.json`),
|
||||
JSON.stringify({ flutter: useful, raf }, null, 2),
|
||||
JSON.stringify({ flutter: useful, raf, selections }, null, 2),
|
||||
);
|
||||
if (repetition === 0) {
|
||||
await writeFile(join(options.out, 'final.png'), await page.shot());
|
||||
|
||||
Reference in New Issue
Block a user