cypress-qase-reporter 2.2.5 → 2.2.7
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 +12 -0
- package/dist/fileSearcher.d.ts +4 -2
- package/dist/fileSearcher.js +33 -4
- package/dist/reporter.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# cypress-qase-reporter@2.2.7
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Fixed an issue where the reporter got error if screenshot folder was not exist.
|
|
6
|
+
|
|
7
|
+
# cypress-qase-reporter@2.2.6
|
|
8
|
+
|
|
9
|
+
## What's new
|
|
10
|
+
|
|
11
|
+
Fixed an issue where screenshots for failed tests were not attached if the tests were located in subdirectories.
|
|
12
|
+
|
|
1
13
|
# cypress-qase-reporter@2.2.5
|
|
2
14
|
|
|
3
15
|
## What's new
|
package/dist/fileSearcher.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ export declare class FileSearcher {
|
|
|
3
3
|
* Finds all files in the given directory and its subdirectories
|
|
4
4
|
* that were created after the specified time.
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
6
|
+
* @param screenshotFolderPath Path to the folder with screenshots.
|
|
7
|
+
* @param specFileName Name of the spec file.
|
|
7
8
|
* @param time Time threshold as a Date object.
|
|
8
9
|
* @returns Array of absolute paths to the matching files.
|
|
9
10
|
*/
|
|
10
|
-
static findFilesBeforeTime(
|
|
11
|
+
static findFilesBeforeTime(screenshotFolderPath: string, specFileName: string, time: Date): string[];
|
|
12
|
+
private static findFolderByName;
|
|
11
13
|
}
|
package/dist/fileSearcher.js
CHANGED
|
@@ -31,13 +31,18 @@ class FileSearcher {
|
|
|
31
31
|
* Finds all files in the given directory and its subdirectories
|
|
32
32
|
* that were created after the specified time.
|
|
33
33
|
*
|
|
34
|
-
* @param
|
|
34
|
+
* @param screenshotFolderPath Path to the folder with screenshots.
|
|
35
|
+
* @param specFileName Name of the spec file.
|
|
35
36
|
* @param time Time threshold as a Date object.
|
|
36
37
|
* @returns Array of absolute paths to the matching files.
|
|
37
38
|
*/
|
|
38
|
-
static findFilesBeforeTime(
|
|
39
|
-
const absolutePath = path.resolve(process.cwd(),
|
|
39
|
+
static findFilesBeforeTime(screenshotFolderPath, specFileName, time) {
|
|
40
|
+
const absolutePath = path.resolve(process.cwd(), screenshotFolderPath);
|
|
40
41
|
const result = [];
|
|
42
|
+
const paths = this.findFolderByName(absolutePath, specFileName);
|
|
43
|
+
if (paths.length === 0) {
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
41
46
|
const searchFiles = (dir) => {
|
|
42
47
|
if (!fs.existsSync(dir)) {
|
|
43
48
|
return;
|
|
@@ -56,7 +61,31 @@ class FileSearcher {
|
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
};
|
|
59
|
-
|
|
64
|
+
for (const path of paths) {
|
|
65
|
+
searchFiles(path);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
static findFolderByName(startPath, folderName) {
|
|
70
|
+
const result = [];
|
|
71
|
+
function searchDirectory(currentPath) {
|
|
72
|
+
if (!fs.existsSync(currentPath)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const items = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
76
|
+
for (const item of items) {
|
|
77
|
+
const itemPath = path.join(currentPath, item.name);
|
|
78
|
+
if (item.isDirectory()) {
|
|
79
|
+
if (item.name === folderName) {
|
|
80
|
+
result.push(itemPath);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
searchDirectory(itemPath);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
searchDirectory(startPath);
|
|
60
89
|
return result;
|
|
61
90
|
}
|
|
62
91
|
}
|
package/dist/reporter.js
CHANGED
|
@@ -109,7 +109,7 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
|
|
|
109
109
|
const ids = CypressQaseReporter.getCaseId(test.title);
|
|
110
110
|
const testFileName = this.getTestFileName(test);
|
|
111
111
|
const files = this.screenshotsFolder ?
|
|
112
|
-
fileSearcher_1.FileSearcher.findFilesBeforeTime(
|
|
112
|
+
fileSearcher_1.FileSearcher.findFilesBeforeTime(this.screenshotsFolder, testFileName, new Date(this.testBeginTime))
|
|
113
113
|
: [];
|
|
114
114
|
const attachments = files.map((file) => ({
|
|
115
115
|
content: '',
|