playwright-slack-report 1.1.20 → 1.1.21
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.
|
@@ -34,7 +34,7 @@ export default class ResultsParser {
|
|
|
34
34
|
updateResults(data: {
|
|
35
35
|
testSuite: any;
|
|
36
36
|
}): void;
|
|
37
|
-
addTestResult(suiteName: any, testCase: any): void;
|
|
37
|
+
addTestResult(suiteName: any, testCase: any, projectBrowserMapping: any): void;
|
|
38
38
|
safelyDetermineFailure(result: {
|
|
39
39
|
errors: any[];
|
|
40
40
|
error: {
|
|
@@ -43,7 +43,10 @@ export default class ResultsParser {
|
|
|
43
43
|
};
|
|
44
44
|
}): string;
|
|
45
45
|
cleanseReason(rawReaseon: string): string;
|
|
46
|
-
|
|
46
|
+
determineBrowser(projectName: string, browserMappings: {
|
|
47
|
+
projectName: string;
|
|
48
|
+
browser: string;
|
|
49
|
+
}[]): {
|
|
47
50
|
projectName: string;
|
|
48
51
|
browser: string;
|
|
49
52
|
};
|
|
@@ -65,9 +65,9 @@ class ResultsParser {
|
|
|
65
65
|
this.result.push(data);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
addTestResult(suiteName, testCase) {
|
|
68
|
+
addTestResult(suiteName, testCase, projectBrowserMapping) {
|
|
69
69
|
const testResults = [];
|
|
70
|
-
const projectSettings = this.
|
|
70
|
+
const projectSettings = this.determineBrowser(testCase._projectId, projectBrowserMapping);
|
|
71
71
|
for (const result of testCase.results) {
|
|
72
72
|
testResults.push({
|
|
73
73
|
suiteName,
|
|
@@ -109,17 +109,18 @@ class ResultsParser {
|
|
|
109
109
|
.replace(/=========================== logs ===========================\n/g, '');
|
|
110
110
|
return logsStripped;
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
determineBrowser(projectName, browserMappings) {
|
|
113
|
+
const browserMapping = browserMappings.find((mapping) => mapping.projectName === projectName);
|
|
114
|
+
if (browserMapping) {
|
|
114
115
|
return {
|
|
115
|
-
projectName:
|
|
116
|
-
browser:
|
|
116
|
+
projectName: browserMapping.projectName,
|
|
117
|
+
browser: browserMapping.browser,
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
return {
|
|
121
|
+
projectName: '',
|
|
122
|
+
browser: '',
|
|
123
|
+
};
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
exports.default = ResultsParser;
|
|
@@ -17,12 +17,20 @@ class SlackReporter {
|
|
|
17
17
|
slackOAuthToken;
|
|
18
18
|
disableUnfurl;
|
|
19
19
|
proxy;
|
|
20
|
+
browsers = [];
|
|
20
21
|
suite;
|
|
21
22
|
logs = [];
|
|
22
23
|
onBegin(fullConfig, suite) {
|
|
23
24
|
this.suite = suite;
|
|
24
25
|
this.logs = [];
|
|
25
26
|
const slackReporterConfig = fullConfig.reporter.filter((f) => f[0].toLowerCase().includes('slackreporter'))[0][1];
|
|
27
|
+
if (fullConfig.projects.length === 0) {
|
|
28
|
+
this.browsers = [];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// eslint-disable-next-line max-len
|
|
32
|
+
this.browsers = fullConfig.projects.map((obj) => ({ projectName: obj.name, browser: obj.use.browserName ? obj.use.browserName : obj.use.defaultBrowserType }));
|
|
33
|
+
}
|
|
26
34
|
if (slackReporterConfig) {
|
|
27
35
|
this.meta = slackReporterConfig.meta || [];
|
|
28
36
|
this.sendResults = slackReporterConfig.sendResults || 'always';
|
|
@@ -40,7 +48,7 @@ class SlackReporter {
|
|
|
40
48
|
}
|
|
41
49
|
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
42
50
|
onTestEnd(test, result) {
|
|
43
|
-
this.resultsParser.addTestResult(test.parent.title, test);
|
|
51
|
+
this.resultsParser.addTestResult(test.parent.title, test, this.browsers);
|
|
44
52
|
}
|
|
45
53
|
async onEnd() {
|
|
46
54
|
const { okToProceed, message } = this.preChecks();
|
package/package.json
CHANGED