Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ import {
drag,
flick,
frames,
freezeTimers,
freezePageOn,
holdAnimations,
installLongTaskLog,
installPageFreeze,
installTimerGate,
markElement,
openStory,
Expand All @@ -50,7 +51,7 @@ import {
releaseVelocity,
sampleCurve,
startScreencast,
thawTimers,
thawPage,
timeline,
timingFunction,
touchDriver,
Expand Down Expand Up @@ -190,10 +191,17 @@ test('a downward flick dismisses the sheet', async ({page}) => {
test('the settle lands on the detent, its curve recorded frame by frame', async ({
page,
}, testInfo) => {
// The page clock that lets the scene stop at the lift, installed before
// the story loads; a freeze also needs the timer gate.
await installPageFreeze(page);
const {driver, sheet, tallTop, halfTop, handle} = await openSheet(page);
await installTimerGate(page);
const dy = Math.round((halfTop - tallTop) * 0.66);
// The scene stops in the lift's own task, before the sheet hears the lift.
// The settle then starts held, however late this process reacts. A hold
// that the test sends after the lift can come after the settle ends.
await freezePageOn(page, 'touchend');
await driver.play(slowDragTo(handle, dy));
const [settle] = await waitForAnimation(sheet);
const held = await holdAnimations(page, sheet);
const transition = held.find(a => a.name === 'transform');
if (transition == null) {
Expand All @@ -214,6 +222,7 @@ test('the settle lands on the detent, its curve recorded frame by frame', async
from + (to - from) * ease(Math.min(1, t / SETTLE_MS));
const result = compareCurve(samples, expectedSettle, 0.5);
await releaseAnimations(page);
await thawPage(page);
testInfo.annotations.push({
type: 'settle-curve',
description: `settle: ${transition.easing}, ${transition.durationMs} ms; frame-by-frame max error ${result.maxError.toFixed(2)} px against ${SETTLE_EASING} over ${SETTLE_MS} ms`,
Expand All @@ -232,7 +241,7 @@ test('the settle lands on the detent, its curve recorded frame by frame', async
'curves/bottomsheet-settle',
{
[`${testInfo.project.name}.json`]: JSON.stringify(
{settle, transition, comparison: result},
{transition, comparison: result},
null,
2,
),
Expand Down Expand Up @@ -354,6 +363,9 @@ test(
'storyboard: drag to the half detent and settle',
{tag: '@storyboard'},
async ({page}, testInfo) => {
// The page clock that lets the scene stop at the lift, installed before
// the story loads.
await installPageFreeze(page);
const {driver, sheet, tallTop, halfTop, handle} = await openSheet(page);
// Gate the page's timers from here on, so the settle's completion timer can
// be held with its animation while the filmstrip is photographed.
Expand All @@ -362,6 +374,10 @@ test(
const clip = {x: 0, y: 0, width: viewport.width, height: viewport.height};
const dy = Math.round((halfTop - tallTop) * 0.66);
const measure = async () => ({top: await sheetTop(sheet)});
// The scene stops in the lift's own task, before the sheet hears the
// lift. The settle then starts held, however late this process reacts. A
// hold that the test sends after the lift can come after the settle ends.
await freezePageOn(page, 'touchend');
const dragBoard = await touchStoryboard(
page,
driver,
Expand All @@ -378,8 +394,6 @@ test(
cellScale: 0.4,
},
);
await waitForAnimation(sheet);
await freezeTimers(page);
const {storyboard: settleBoard} = await animationStoryboard(page, {
name: 'bottomsheet-settle',
clip,
Expand All @@ -389,7 +403,7 @@ test(
cellScale: 0.4,
});
await releaseAnimations(page, {finish: true});
await thawTimers(page);
await thawPage(page);
await dragBoard.write(testInfo);
await settleBoard.write(testInfo);
// The trace is the assertion; the sheets are the evidence.
Expand Down
Loading