@@ -14,6 +14,10 @@ const expectedDuration = process.env.BENCHMARK_DURATION ?? "30.00";
1414const output = process . env . BENCHMARK_OUTPUT ?? "web" ;
1515const warmupRuns = readCount ( "BENCHMARK_WARMUP_RUNS" , 1 ) ;
1616const measuredRuns = readCount ( "BENCHMARK_MEASURED_RUNS" , 3 ) ;
17+ const runs = warmupRuns + measuredRuns ;
18+ const runTimeout = Math . max ( 15_000 , Number ( expectedDuration ) * 3_000 ) ;
19+
20+ test . setTimeout ( runs * runTimeout + 15_000 ) ;
1721
1822test ( "benchmarks Chromium WASM inference" , async ( { page } ) => {
1923 for ( const path of [ model , dft , fixture ] ) {
@@ -27,15 +31,11 @@ test("benchmarks Chromium WASM inference", async ({ page }) => {
2731 `Decoded: ${ expectedDuration } s` ,
2832 ) ;
2933
30- for ( let index = 0 ; index < warmupRuns + measuredRuns ; index ++ ) {
34+ const runButton = page . locator ( "#run" ) ;
35+ for ( let index = 0 ; index < runs ; index ++ ) {
3136 await page . evaluate ( ( ) => delete window . __demucsBenchmarkResult ) ;
32- await page . click ( "#run" ) ;
33- await page . waitForFunction (
34- ( ) => window . __demucsBenchmarkResult !== undefined ,
35- {
36- timeout : 15 * 60_000 ,
37- } ,
38- ) ;
37+ await runButton . click ( ) ;
38+ await expect ( runButton ) . toBeEnabled ( { timeout : runTimeout } ) ;
3939 const result = await page . evaluate ( ( ) => window . __demucsBenchmarkResult ! ) ;
4040 await writeFile (
4141 resolve ( root , `data/benchmark/${ output } -run-${ index } .json` ) ,
0 commit comments