Skip to content

Commit

Permalink
chore: adjust test matrix so it includes both cucumber and regular cy…
Browse files Browse the repository at this point in the history
…press specs
  • Loading branch information
HendrikThePendric committed Jan 31, 2025
1 parent cf4517f commit 0ac529e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cypress/support/generateTestMatrix.js
Original file line number Diff line number Diff line change
@@ -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))
}
})
Expand All @@ -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))

0 comments on commit 0ac529e

Please sign in to comment.