Skip to content

Commit 2442a73

Browse files
committed
fix(ci): finish finite animations in clock-controlled extension checks
1 parent edbcc6e commit 2442a73

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎apps/sim/scripts/test-browser-extension-e2e.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,24 @@ try {
12211221
shell = panel
12221222
await shell.clock.install()
12231223
acceleratedClock = true
1224+
await browserContext.addInitScript(() => {
1225+
const animate = Element.prototype.animate
1226+
Element.prototype.animate = function (
1227+
this: Element,
1228+
...args: Parameters<Element['animate']>
1229+
) {
1230+
const animation = animate.apply(this, args)
1231+
// Callers set startTime synchronously from the advanced clock, ahead of the native timeline.
1232+
queueMicrotask(() => {
1233+
if (
1234+
animation.playState === 'running' &&
1235+
Number.isFinite(animation.effect?.getComputedTiming().endTime)
1236+
)
1237+
animation.finish()
1238+
})
1239+
return animation
1240+
}
1241+
})
12241242
source = await browserContext.newPage()
12251243
await source.goto(`${fixtureOrigin}/page?private=QUERY_SECRET#FRAGMENT_SECRET`)
12261244
await shell.goto(`chrome-extension://${extensionId}/sidepanel.html`)

0 commit comments

Comments
 (0)