Skip to content

Commit 7b1d9cc

Browse files
test(player): a Safari perf run that fails says which wait timed out and why (heygen-com#7347)
* test(player): a Safari perf run that fails says which wait timed out * test(player): a Safari run that never starts loading a video says so
1 parent 336abaa commit 7b1d9cc

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎packages/player/tests/perf/browsers/bench-page.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@ export async function bench(cfg) {
116116
const idle = await recordFrames(1000);
117117

118118
host.play();
119-
await until(() => runtime.isPlaying(), 5_000, "isPlaying");
119+
await until(() => runtime.isPlaying(), 5_000, "isPlaying").catch((e) => {
120+
// Safari sometimes reports a source as loading and never requests it; a reload does not help.
121+
const unstarted = videos()
122+
.filter((v) => v.readyState === 0 && v.networkState === 2)
123+
.map((v) => v.currentSrc.split("/").pop());
124+
if (unstarted.length === 0) throw e;
125+
throw new Error(`${e.message}: the browser never started loading ${unstarted.join(", ")}`);
126+
});
120127
countOps = true;
121128
const decodedBefore = decoded();
122129
const droppedTimeline = [];

‎packages/player/tests/perf/browsers/run.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ async function runFilm(base: string, browser: Browser, origin: string, fixture:
262262
window.__bench = null;
263263
window.__hfBench(arguments[0]).then(
264264
(r) => { window.__bench = { ok: r }; },
265-
(e) => { window.__bench = { error: String(e && e.stack || e) }; });`,
265+
(e) => { window.__bench = { error: [String(e), e && e.stack].filter(Boolean).join("\\n") }; });`,
266266
args: [{ playMs: PLAY_MS, seekFractions: SEEK_FRACTIONS }],
267267
});
268268
const deadline = Date.now() + 180_000;

0 commit comments

Comments
 (0)