-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: optimize Cypress recordings with conditional triggers
chore: enhance parallel test execution setup in CI chore: trigger tests chore: split e2e testing into separate workflows for GitHub Actions and Cypress Cloud chore: fix workflow needs typo chore: adjust e2e workflow triggers for accurate routing chore: commit to trigger tests fix
- Loading branch information
Showing
3 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
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) === '.js') { | ||
arrayOfFiles.push(path.join(dirPath, file)) | ||
} | ||
}) | ||
|
||
return arrayOfFiles | ||
} | ||
|
||
const createGroups = (files, numberOfGroups = 3) => { | ||
const groups = [] | ||
for (let i = 0; i < numberOfGroups; i++) { | ||
groups.push([]) | ||
} | ||
|
||
files.forEach((file, index) => { | ||
groups[index % numberOfGroups].push(file) | ||
}) | ||
|
||
return groups.map((group, index) => ({ id: index + 1, tests: group })) | ||
} | ||
|
||
const cypressSpecsPath = './cypress/integration' | ||
const specs = getAllFiles(cypressSpecsPath) | ||
const groupedSpecs = createGroups(specs) | ||
|
||
console.log(JSON.stringify(groupedSpecs)) |