diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d1068879d2e..eed7250c01dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -516,6 +516,7 @@ jobs: test-e2e-chrome: executor: node-browsers + parallelism: 8 steps: - checkout - run: @@ -543,6 +544,7 @@ jobs: test-e2e-chrome-mv3: executor: node-browsers + parallelism: 8 steps: - checkout - run: @@ -570,6 +572,7 @@ jobs: test-e2e-firefox-snaps: executor: node-browsers + parallelism: 2 steps: - checkout - run: @@ -597,6 +600,7 @@ jobs: test-e2e-chrome-snaps: executor: node-browsers + parallelism: 2 steps: - checkout - run: @@ -624,6 +628,7 @@ jobs: test-e2e-firefox: executor: node-browsers-medium-plus + parallelism: 8 steps: - checkout - run: diff --git a/test/e2e/run-all.js b/test/e2e/run-all.js index 2623f9ba9fdc..27b754750297 100644 --- a/test/e2e/run-all.js +++ b/test/e2e/run-all.js @@ -13,6 +13,14 @@ const getTestPathsForTestDir = async (testDir) => { return testPaths; }; +function chunk(array, chunkSize) { + const result = []; + for (let i = 0; i < array.length; i += chunkSize) { + result.push(array.slice(i, i + chunkSize)); + } + return result; +} + async function main() { const { argv } = yargs(hideBin(process.argv)) .usage( @@ -66,7 +74,14 @@ async function main() { args.push('--retries', retries); } - for (const testPath of testPaths) { + // For running E2Es in parallel in CI + const currentChunkIndex = process.env.CIRCLE_NODE_INDEX ?? 0; + const totalChunks = process.env.CIRCLE_NODE_TOTAL ?? 1; + const chunkSize = Math.ceil(testPaths.length / totalChunks); + const chunks = chunk(testPaths, chunkSize); + const currentChunk = chunks[currentChunkIndex]; + + for (const testPath of currentChunk) { await runInShell('node', [...args, testPath]); } }