cypress-qase-reporter 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +6 -0
- package/dist/fileSearcher.d.ts +2 -1
- package/dist/fileSearcher.js +32 -9
- package/dist/hooks.js +6 -1
- package/package.json +2 -2
package/changelog.md
CHANGED
package/dist/fileSearcher.d.ts
CHANGED
|
@@ -24,8 +24,9 @@ export declare class FileSearcher {
|
|
|
24
24
|
*
|
|
25
25
|
* @param videoFolderPath Path to the folder with video files.
|
|
26
26
|
* @param specFileName Name of the spec file (without extension).
|
|
27
|
+
* @param specRelativePath Optional relative path from e2e directory to the spec file.
|
|
27
28
|
* @returns Array of absolute paths to the matching mp4 files.
|
|
28
29
|
*/
|
|
29
|
-
static findVideoFiles(videoFolderPath: string, specFileName: string): string[];
|
|
30
|
+
static findVideoFiles(videoFolderPath: string, specFileName: string, specRelativePath?: string): string[];
|
|
30
31
|
private static findFolderByName;
|
|
31
32
|
}
|
package/dist/fileSearcher.js
CHANGED
|
@@ -114,24 +114,47 @@ class FileSearcher {
|
|
|
114
114
|
*
|
|
115
115
|
* @param videoFolderPath Path to the folder with video files.
|
|
116
116
|
* @param specFileName Name of the spec file (without extension).
|
|
117
|
+
* @param specRelativePath Optional relative path from e2e directory to the spec file.
|
|
117
118
|
* @returns Array of absolute paths to the matching mp4 files.
|
|
118
119
|
*/
|
|
119
|
-
static findVideoFiles(videoFolderPath, specFileName) {
|
|
120
|
+
static findVideoFiles(videoFolderPath, specFileName, specRelativePath) {
|
|
120
121
|
const absolutePath = path.resolve(process.cwd(), videoFolderPath);
|
|
121
122
|
const result = [];
|
|
122
123
|
if (!fs.existsSync(absolutePath)) {
|
|
123
124
|
return result;
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
// Recursively search for video files in all subdirectories
|
|
127
|
+
const findVideoFilesRecursively = (dir) => {
|
|
128
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
129
|
+
for (const entry of entries) {
|
|
130
|
+
if (entry.isFile()) {
|
|
131
|
+
const fileName = entry.name;
|
|
132
|
+
// Check if the file is an mp4 video file with the expected format: {specFileName}.cy.js.mp4
|
|
133
|
+
if (fileName.toLowerCase().endsWith('.mp4') && fileName.startsWith(specFileName)) {
|
|
134
|
+
const entryPath = path.join(dir, fileName);
|
|
135
|
+
result.push(entryPath);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else if (entry.isDirectory()) {
|
|
139
|
+
const subDirPath = path.join(dir, entry.name);
|
|
140
|
+
findVideoFilesRecursively(subDirPath);
|
|
133
141
|
}
|
|
134
142
|
}
|
|
143
|
+
};
|
|
144
|
+
// If we have a relative path, prioritize the corresponding subdirectory
|
|
145
|
+
if (specRelativePath) {
|
|
146
|
+
const specDir = path.dirname(specRelativePath);
|
|
147
|
+
// Only process if specDir is not the current directory ('.')
|
|
148
|
+
if (specDir !== '.') {
|
|
149
|
+
const videoSubDir = path.join(absolutePath, specDir);
|
|
150
|
+
if (fs.existsSync(videoSubDir)) {
|
|
151
|
+
findVideoFilesRecursively(videoSubDir);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// If we didn't find files in the expected subdirectory, search the entire videos directory
|
|
156
|
+
if (result.length === 0) {
|
|
157
|
+
findVideoFilesRecursively(absolutePath);
|
|
135
158
|
}
|
|
136
159
|
return result;
|
|
137
160
|
}
|
package/dist/hooks.js
CHANGED
|
@@ -68,8 +68,13 @@ async function afterSpecHook(spec, options) {
|
|
|
68
68
|
const uploadDelay = composedOptions.framework?.cypress?.uploadDelay ?? 10;
|
|
69
69
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
70
70
|
const specFileName = path_1.default.basename(spec.name, '.cy.js');
|
|
71
|
+
// Get the relative path from the spec.relative field
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
73
|
+
const specRelativePath = spec.relative && spec.relative !== '__all'
|
|
74
|
+
? spec.relative.replace(/^cypress\/(e2e|integration)\//, '') // Remove cypress/e2e/ or cypress/integration/ prefix
|
|
75
|
+
: undefined;
|
|
71
76
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
72
|
-
const videoFiles = videosFolder ? fileSearcher_1.FileSearcher.findVideoFiles(videosFolder, specFileName) : [];
|
|
77
|
+
const videoFiles = videosFolder ? fileSearcher_1.FileSearcher.findVideoFiles(videosFolder, specFileName, specRelativePath) : [];
|
|
73
78
|
if (videoFiles.length > 0 && uploadVideos) {
|
|
74
79
|
const existingVideoFiles = videoFiles.filter(file => fs_1.default.existsSync(file));
|
|
75
80
|
if (existingVideoFiles.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-qase-reporter",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Qase Cypress Reporter",
|
|
5
5
|
"homepage": "https://github.com/qase-tms/qase-javascript",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"author": "Qase Team <support@qase.io>",
|
|
52
52
|
"license": "Apache-2.0",
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"qase-javascript-commons": "~2.4.
|
|
54
|
+
"qase-javascript-commons": "~2.4.1",
|
|
55
55
|
"uuid": "^9.0.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|