From 0ac529e1f43940ddfbe66a3b3f012eebaadc5ea0 Mon Sep 17 00:00:00 2001 From: HendrikThePendric Date: Fri, 31 Jan 2025 12:24:22 +0100 Subject: [PATCH] chore: adjust test matrix so it includes both cucumber and regular cypress specs --- cypress/support/generateTestMatrix.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cypress/support/generateTestMatrix.js b/cypress/support/generateTestMatrix.js index 7ee849354..784ab5cdd 100644 --- a/cypress/support/generateTestMatrix.js +++ b/cypress/support/generateTestMatrix.js @@ -1,13 +1,21 @@ const fs = require('fs') const path = require('path') +const CUCUMBER_FILE_PATH = './cypress/e2e_cucumber' +const VANILLA_FILE_PATH = './cypress/e2e' + const getAllFiles = (dirPath, arrayOfFiles = []) => { const files = fs.readdirSync(dirPath) files.forEach((file) => { if (fs.statSync(path.join(dirPath, file)).isDirectory()) { arrayOfFiles = getAllFiles(path.join(dirPath, file), arrayOfFiles) - } else if (path.extname(file) === '.feature') { + } else if ( + dirPath === CUCUMBER_FILE_PATH && + path.extname(file) === '.feature' + ) { + arrayOfFiles.push(path.join(dirPath, file)) + } else if (dirPath === VANILLA_FILE_PATH && file.endsWith('.cy.js')) { arrayOfFiles.push(path.join(dirPath, file)) } }) @@ -28,8 +36,10 @@ const createGroups = (files, numberOfGroups = 8) => { return groups.map((group, index) => ({ id: index + 1, tests: group })) } -const cypressSpecsPath = './cypress/e2e_cucumber' -const specs = getAllFiles(cypressSpecsPath) +const specs = [ + ...getAllFiles(CUCUMBER_FILE_PATH), + ...getAllFiles(VANILLA_FILE_PATH), +] const groupedSpecs = createGroups(specs) console.log(JSON.stringify(groupedSpecs))