diff --git a/tests/performance/run.mjs b/tests/performance/run.mjs index 666de5c517..3a072cedca 100644 --- a/tests/performance/run.mjs +++ b/tests/performance/run.mjs @@ -27,7 +27,7 @@ const PERF_TESTS_PORT = 8080; * * TODO: GitHub actions fails when running the 128th browser. Find out why. */ -const TEST_ITERATIONS = 50; +const TEST_ITERATIONS = 1; /** * After initialization is done, contains the path allowing to run the Chrome @@ -82,12 +82,6 @@ let currentBrowser; */ const tasks = []; -/** - * Index of the currently ran task in the `tasks` array. - * @see tasks - */ -let nextTaskIndex = 0; - /** * Store results of the performance tests in two arrays: * - "current" contains the test results of the current RxPlayer version @@ -487,8 +481,8 @@ async function linkRxPlayerBranch({ branchName, remoteGitUrl }) { * @returns {Promise} */ async function startAllTestsOnChrome() { - nextTaskIndex = 0; CHROME_CMD = await getChromeCmd(); + tasks.length = 0; for (let i = 0; i < TEST_ITERATIONS; i++) { tasks.push(() => startTestsOnChrome(i % 2 === 0, i + 1, TEST_ITERATIONS)); } @@ -498,8 +492,7 @@ async function startAllTestsOnChrome() { if (tasks.length === 0) { throw new Error("No task scheduled"); } - nextTaskIndex++; - return tasks[nextTaskIndex - 1](); + return tasks.shift()(); } /** @@ -521,11 +514,11 @@ async function shutdown() { * @param {Function} onFinished */ function startNextTaskOrFinish(onFinished) { - if (tasks[nextTaskIndex] === undefined) { + const nextTask = tasks.shift(); + if (nextTask === undefined) { onFinished(); } - nextTaskIndex++; - return tasks[nextTaskIndex - 1](); + return nextTask(); } /**