playwright-slack-report 1.1.2 → 1.1.3

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.
@@ -43,4 +43,8 @@ export default class ResultsParser {
43
43
  };
44
44
  }): string;
45
45
  cleanseReason(rawReaseon: string): string;
46
+ getParentConfigInformation(testCase: any): {
47
+ projectName: string;
48
+ browser: string;
49
+ };
46
50
  }
@@ -67,19 +67,14 @@ class ResultsParser {
67
67
  }
68
68
  addTestResult(suiteName, testCase) {
69
69
  const testResults = [];
70
+ const projectSettings = this.getParentConfigInformation(testCase);
70
71
  for (const result of testCase.results) {
71
72
  testResults.push({
72
73
  suiteName,
73
74
  name: testCase.title,
74
75
  status: result.status,
75
- // eslint-disable-next-line no-underscore-dangle
76
- browser: testCase.parent?.parent?._projectConfig?.use?.defaultBrowserType
77
- ? testCase.parent.parent._projectConfig.use.defaultBrowserType
78
- : '',
79
- // eslint-disable-next-line no-underscore-dangle
80
- projectName: testCase.parent?.parent?._projectConfig?.name
81
- ? testCase.parent.parent._projectConfig.name
82
- : '',
76
+ browser: projectSettings.browser,
77
+ projectName: projectSettings.projectName,
83
78
  retry: result.retry,
84
79
  retries: testCase.retries,
85
80
  startedAt: new Date(result.startTime).toISOString(),
@@ -114,5 +109,17 @@ class ResultsParser {
114
109
  .replace(/=========================== logs ===========================\n/g, '');
115
110
  return logsStripped;
116
111
  }
112
+ getParentConfigInformation(testCase) {
113
+ if (testCase._projectConfig !== undefined) {
114
+ return {
115
+ projectName: testCase._projectConfig.name || '',
116
+ browser: testCase._projectConfig.use?.defaultBrowserType || '',
117
+ };
118
+ }
119
+ if (testCase.parent) {
120
+ return this.getParentConfigInformation(testCase.parent);
121
+ }
122
+ return { projectName: '', browser: '' };
123
+ }
117
124
  }
118
125
  exports.default = ResultsParser;
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "lint":"npx eslint . --ext .ts"
29
29
  },
30
30
  "name": "playwright-slack-report",
31
- "version": "1.1.2",
31
+ "version": "1.1.3",
32
32
  "main": "index.js",
33
33
  "types": "dist/index.d.ts",
34
34
  "repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",