@@ -83,6 +83,7 @@ function trackUploadedFile(key: string) {
8383}
8484let context : BrowserContext | undefined
8585let panel : Page | undefined
86+ let acceleratedClock = false
8687let userId : string | undefined
8788let releaseHeldRequest = ( ) => { }
8889const alphaId = generateId ( )
@@ -130,17 +131,23 @@ async function check(name: string, run: () => Promise<void>) {
130131async function screenshot ( name : string ) {
131132 if ( ! panel ) return
132133 for ( const frame of panel . frames ( ) ) {
133- await frame . evaluate ( ( ) =>
134- Promise . all (
135- document
136- . getAnimations ( )
137- . filter (
138- ( animation ) =>
139- animation . playState === 'running' &&
140- animation . effect ?. getComputedTiming ( ) . iterations !== Number . POSITIVE_INFINITY
141- )
142- . map ( ( animation ) => animation . finished . catch ( ( ) => { } ) )
143- )
134+ await frame . evaluate (
135+ ( finishAnimations ) =>
136+ Promise . all (
137+ document
138+ . getAnimations ( )
139+ . filter (
140+ ( animation ) =>
141+ animation . playState === 'running' &&
142+ animation . effect ?. getComputedTiming ( ) . iterations !== Number . POSITIVE_INFINITY
143+ )
144+ . map ( ( animation ) => {
145+ // Mocked performance time can put native Web Animations far ahead of their timeline.
146+ if ( finishAnimations ) animation . finish ( )
147+ return animation . finished . catch ( ( ) => { } )
148+ } )
149+ ) ,
150+ acceleratedClock
144151 )
145152 for ( const element of await frame
146153 . getByRole ( 'menu' )
@@ -1213,6 +1220,7 @@ try {
12131220 panel = await openPanel ( )
12141221 shell = panel
12151222 await shell . clock . install ( )
1223+ acceleratedClock = true
12161224 source = await browserContext . newPage ( )
12171225 await source . goto ( `${ fixtureOrigin } /page?private=QUERY_SECRET#FRAGMENT_SECRET` )
12181226 await shell . goto ( `chrome-extension://${ extensionId } /sidepanel.html` )
0 commit comments