@zohodesk/testinglibrary 0.4.65-n18-experimental → 0.4.66-n18-experimental
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.
|
@@ -13,6 +13,10 @@ async function accountLogin(page, useremail, password) {
|
|
|
13
13
|
await page.locator('#nextbtn').click();
|
|
14
14
|
const domainUrlOrigin = (0, _getUrlOrigin.default)(process.env.domain);
|
|
15
15
|
await page.waitForNavigation();
|
|
16
|
-
|
|
16
|
+
if (page.url().includes('announcement')) {
|
|
17
|
+
console.log("Detected 'sessions-reminder' or 'announcement' page. Redirecting to domain origin:", domainUrlOrigin);
|
|
18
|
+
await page.goto(domainUrlOrigin);
|
|
19
|
+
}
|
|
20
|
+
await page.waitForURL(`${domainUrlOrigin}/**`);
|
|
17
21
|
}
|
|
18
22
|
var _default = exports.default = accountLogin;
|
|
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
10
|
var _codeFrame = require("@babel/code-frame");
|
|
10
11
|
class CustomJsonReporter {
|
|
11
12
|
constructor({
|
|
12
13
|
outputFile = 'playwright-custom-report.json'
|
|
13
14
|
} = {}) {
|
|
14
|
-
this.outputFile = outputFile;
|
|
15
|
+
this.outputFile = _path.default.resolve(outputFile);
|
|
15
16
|
this.rootSuite = null;
|
|
16
17
|
this.report = {
|
|
17
18
|
config: {},
|
|
@@ -44,22 +45,23 @@ class CustomJsonReporter {
|
|
|
44
45
|
stack,
|
|
45
46
|
snippet
|
|
46
47
|
}))) ?? [],
|
|
47
|
-
steps: ((_result$steps = result.steps) === null || _result$steps === void 0 ? void 0 : _result$steps.map(extractMergedSteps)) ?? []
|
|
48
|
+
steps: ((_result$steps = result.steps) === null || _result$steps === void 0 ? void 0 : _result$steps.map(step => extractMergedSteps(this.report.config.rootDir, step))) ?? []
|
|
48
49
|
};
|
|
49
50
|
const existingResults = this.testResultsById.get(key) ?? [];
|
|
50
51
|
this.testResultsById.set(key, [...existingResults, testResult]);
|
|
51
52
|
}
|
|
52
53
|
onEnd() {
|
|
53
54
|
var _this$rootSuite;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
(_this$rootSuite = this.rootSuite) === null || _this$rootSuite === void 0 || (_this$rootSuite = _this$rootSuite.suites) === null || _this$rootSuite === void 0 || _this$rootSuite.map(suite => {
|
|
56
|
+
const extracted = suite.suites.map(suite => extractMergedSuite(this.report.config.rootDir, suite, this.testResultsById));
|
|
57
|
+
this.report.suites.push(...extracted);
|
|
58
|
+
});
|
|
57
59
|
_fs.default.writeFileSync(this.outputFile, JSON.stringify(this.report, null, 2));
|
|
58
60
|
console.log(`Custom JSON report written to: ${this.outputFile}`);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
exports.default = CustomJsonReporter;
|
|
62
|
-
const extractMergedSuite = (suite, testResultsById) => {
|
|
64
|
+
const extractMergedSuite = (rootDir, suite, testResultsById) => {
|
|
63
65
|
var _suite$suites;
|
|
64
66
|
const specMap = new Map();
|
|
65
67
|
for (const test of suite.tests ?? []) {
|
|
@@ -68,27 +70,27 @@ const extractMergedSuite = (suite, testResultsById) => {
|
|
|
68
70
|
const newTestInfo = extractTestDetails(test, testResultsById);
|
|
69
71
|
existingSpec.tests.push(newTestInfo);
|
|
70
72
|
} else {
|
|
71
|
-
const newSpec = createSpecEntry(test, testResultsById);
|
|
73
|
+
const newSpec = createSpecEntry(rootDir, test, testResultsById);
|
|
72
74
|
specMap.set(test.title, newSpec);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
return {
|
|
76
78
|
title: suite.title,
|
|
77
|
-
|
|
79
|
+
...parseLocation(rootDir, suite.location),
|
|
78
80
|
...(suite.location && {
|
|
79
|
-
snippet: formSnippet(suite.location)
|
|
81
|
+
snippet: formSnippet(rootDir, suite.location)
|
|
80
82
|
}),
|
|
81
83
|
...(((_suite$suites = suite.suites) === null || _suite$suites === void 0 ? void 0 : _suite$suites.length) > 0 && {
|
|
82
|
-
suites: suite.suites.map(child => extractMergedSuite(child, testResultsById))
|
|
84
|
+
suites: suite.suites.map(child => extractMergedSuite(rootDir, child, testResultsById))
|
|
83
85
|
}),
|
|
84
86
|
...(specMap.size > 0 && {
|
|
85
87
|
specs: Array.from(specMap.values())
|
|
86
88
|
})
|
|
87
89
|
};
|
|
88
90
|
};
|
|
89
|
-
const createSpecEntry = (test, testResultsById) => ({
|
|
91
|
+
const createSpecEntry = (rootDir, test, testResultsById) => ({
|
|
90
92
|
title: test.title,
|
|
91
|
-
|
|
93
|
+
...parseLocation(rootDir, test.location),
|
|
92
94
|
...(test.location && {
|
|
93
95
|
snippet: formSnippet(test.location)
|
|
94
96
|
}),
|
|
@@ -107,7 +109,7 @@ const extractTestDetails = (test, testResultsById) => {
|
|
|
107
109
|
status: test.outcome()
|
|
108
110
|
};
|
|
109
111
|
};
|
|
110
|
-
const extractMergedSteps = step => ({
|
|
112
|
+
const extractMergedSteps = (rootDir, step) => ({
|
|
111
113
|
title: step.title,
|
|
112
114
|
duration: step.duration,
|
|
113
115
|
...(step.error && {
|
|
@@ -117,23 +119,28 @@ const extractMergedSteps = step => ({
|
|
|
117
119
|
snippet: step.error.snippet
|
|
118
120
|
}
|
|
119
121
|
}),
|
|
120
|
-
|
|
122
|
+
...parseLocation(rootDir, step.location),
|
|
121
123
|
status: step.status,
|
|
122
124
|
...(step.location && {
|
|
123
|
-
snippet: formSnippet(step.location)
|
|
125
|
+
snippet: formSnippet(rootDir, step.location)
|
|
124
126
|
}),
|
|
125
127
|
...(step.steps && step.steps.length > 0 && {
|
|
126
|
-
steps: step.steps.map(subStep => extractMergedSteps(subStep))
|
|
128
|
+
steps: step.steps.map(subStep => extractMergedSteps(rootDir, subStep))
|
|
127
129
|
})
|
|
128
130
|
});
|
|
129
|
-
const formSnippet = location => {
|
|
130
|
-
if (!(location !== null && location !== void 0 && location.file)) return '';
|
|
131
|
+
const formSnippet = (rootDir, location) => {
|
|
132
|
+
if (location && !(location !== null && location !== void 0 && location.file)) return '';
|
|
131
133
|
try {
|
|
132
|
-
const
|
|
134
|
+
const {
|
|
135
|
+
file,
|
|
136
|
+
line,
|
|
137
|
+
column
|
|
138
|
+
} = parseLocation(rootDir, location, false);
|
|
139
|
+
const raw = _fs.default.readFileSync(file, 'utf8');
|
|
133
140
|
return (0, _codeFrame.codeFrameColumns)(raw, {
|
|
134
141
|
start: {
|
|
135
|
-
line
|
|
136
|
-
column
|
|
142
|
+
line,
|
|
143
|
+
column
|
|
137
144
|
}
|
|
138
145
|
}, {
|
|
139
146
|
linesAbove: 2,
|
|
@@ -143,4 +150,13 @@ const formSnippet = location => {
|
|
|
143
150
|
} catch {
|
|
144
151
|
return '';
|
|
145
152
|
}
|
|
146
|
-
};
|
|
153
|
+
};
|
|
154
|
+
const parseLocation = (rootDir, {
|
|
155
|
+
file,
|
|
156
|
+
line,
|
|
157
|
+
column
|
|
158
|
+
} = {}, isRelative = true) => file ? {
|
|
159
|
+
file: isRelative ? _path.default.relative(rootDir, file) : file,
|
|
160
|
+
line,
|
|
161
|
+
column
|
|
162
|
+
} : {};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.66-n18-experimental",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@zohodesk/testinglibrary",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.66-n18-experimental",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED
package/playwright.config.js
CHANGED
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
retries: process.env.CI ? 2 : 0,
|
|
11
11
|
reporter: [
|
|
12
12
|
['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }],
|
|
13
|
-
['./src/core/playwright/setup/
|
|
13
|
+
['./src/core/playwright/setup/qc-custom-reporter.js']
|
|
14
14
|
],
|
|
15
15
|
timeout: 60 * 1000,
|
|
16
16
|
expect: {
|