An open source design system that's fully customizable and agent ready
TypeScript
test(core): two busy-block proofs judge against the control (#10314)
Christopher Chedeau3e8137f65c2d
diff --git a/packages/core/src/BottomSheet/__tests__/BottomSheetDetent.interaction.browser.spec.ts b/packages/core/src/BottomSheet/__tests__/BottomSheetDetent.interaction.browser.spec.tsindex a6f17f030f..4945f088d9 100644--- a/packages/core/src/BottomSheet/__tests__/BottomSheetDetent.interaction.browser.spec.ts+++ b/packages/core/src/BottomSheet/__tests__/BottomSheetDetent.interaction.browser.spec.ts@@ -50,6 +50,7 @@ import {releaseAnimations,releaseVelocity,sampleCurve,+ startBusyControl,startScreencast,thawPage,timeline,@@ -58,6 +59,7 @@ import {toTouchEvents,touchStoryboard,traceRendering,+ trackControl,trackMarker,withStorybook,waitForAnimation,@@ -280,6 +282,10 @@ test('the settle keeps advancing every frame while the main thread is blocked',);const {driver, sheet, tallTop, halfTop, handle} = await openSheet(page);await markElement(sheet);+ // The harness's busy-window control: a box the compositor moves along the+ // top edge, in the same screencast. The settle is judged against what the+ // compositor presented, not against a frame rate.+ const control = await startBusyControl(page);const cast = await startScreencast(page);// The settle must be running (and composited) before the block: an// animation cannot start while the main thread is held. Armed before the@@ -306,11 +312,21 @@ test('the settle keeps advancing every frame while the main thread is blocked',return chip.getBoundingClientRect().y;});const castFrames = await cast.stop();+ await control.remove();const tracked = await trackMarker(page, castFrames);+ const controlFrames = await trackControl(+ page,+ castFrames.filter(f => f.t >= block.from - 300 && f.t <= block.to + 100),+ );// Judge the part of the block during which the settle was still moving:// until it is within 2 px of rest (the screencast rounds to whole pixels,- // so the easing tail shows plateaus there).- const proof = busyWindowProof(tracked, block, {settledWithin: 2, settledAt});+ // so the easing tail shows plateaus there). The settle moves on every frame+ // the control moves on, and it stalls no longer than the control.+ const proof = busyWindowProof(tracked, block, {+ settledWithin: 2,+ settledAt,+ control: controlFrames,+ });await writeEvidence('busy-main-thread/bottomsheet-settle',{diff --git a/packages/core/src/TimeInput/__tests__/TimeWheels.interaction.browser.spec.ts b/packages/core/src/TimeInput/__tests__/TimeWheels.interaction.browser.spec.tsindex 5bd655b422..79e3fb7ff2 100644--- a/packages/core/src/TimeInput/__tests__/TimeWheels.interaction.browser.spec.ts+++ b/packages/core/src/TimeInput/__tests__/TimeWheels.interaction.browser.spec.ts@@ -26,6 +26,7 @@ import {drag,installTimerGate,openStory,+ startBusyControl,startScreencast,Storyboard,tap as press,@@ -34,6 +35,7 @@ import {touchDriver,waitForRest,withStorybook,+ trackControl,writeEvidence,type CastFrame,type TouchDriver,@@ -360,21 +362,37 @@ test('the AM/PM turn keeps advancing every frame through a blocked main thread',if (rect == null) {throw new Error('no AM/PM column');}+ // The harness's busy-window control: a box the compositor moves along the+ // top edge, in the same screencast. The turn is judged against what the+ // compositor presented, not against a frame rate.+ const control = await startBusyControl(page);const cast = await startScreencast(page);await page.waitForTimeout(300);- await turnOneRowDown(driver, hour);- // The page blocks itself once the AM/PM column has turned for 32 ms.- const busy = await blockMainThread(page, 600, {+ // Armed before the drag, the page blocks itself once the AM/PM column has+ // turned for 32 ms. Armed after it, the round trip would start the block+ // later the busier the machine is.+ const blocking = blockMainThread(page, 600, {during: stripOf(meridiem),minProgressMs: 32,});+ await turnOneRowDown(driver, hour);+ const busy = await blocking;await page.waitForTimeout(500);- const tracked = await textCentres(page, await cast.stop(), rect);- // Judged until the turn's end (the text centre in tenths of a px).+ const castFrames = await cast.stop();+ await control.remove();+ const tracked = await textCentres(page, castFrames, rect);+ const controlFrames = await trackControl(+ page,+ castFrames.filter(f => f.t >= busy.from - 300 && f.t <= busy.to + 100),+ );+ // Judged until the turn's end (the text centre in tenths of a px). The turn+ // moves on every frame the control moves on, and it stalls no longer than+ // the control.const spanned = {...busy, to: Math.min(busy.to, busy.from + TURN_MS - 32)};const proof = busyWindowProof(tracked, spanned, {axis: 'y',settledWithin: 5,+ control: controlFrames,});await writeEvidence('busy-main-thread/timewheels-meridiem-turn',