@zohodesk/testinglibrary 0.4.64-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
- await Promise.race([page.waitForURL(`${domainUrlOrigin}/**`), page.waitForURL('**/announcement/**')]);
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;
@@ -51,7 +51,7 @@ let reporter = [['html', {
51
51
  open: openReportOn
52
52
  }], ['list'], ['json', {
53
53
  outputFile: _path.default.join(process.cwd(), 'uat', 'test-results', 'test-results.json')
54
- }], ['./custom-reporter.js']];
54
+ }], ['./custom-reporter.js'], ['./qc-custom-reporter.js']];
55
55
  if (customReporter) {
56
56
  reporter = [customReporter, ...reporter];
57
57
  }
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _codeFrame = require("@babel/code-frame");
11
+ class CustomJsonReporter {
12
+ constructor({
13
+ outputFile = 'playwright-custom-report.json'
14
+ } = {}) {
15
+ this.outputFile = _path.default.resolve(outputFile);
16
+ this.rootSuite = null;
17
+ this.report = {
18
+ config: {},
19
+ suites: []
20
+ };
21
+ this.testResultsById = new Map();
22
+ }
23
+ onBegin = (config, suite) => {
24
+ this.rootSuite = suite;
25
+ this.report.config = config;
26
+ };
27
+ onTestEnd(test, result) {
28
+ var _result$errors, _result$steps;
29
+ const key = `${test.location.file}:${test.location.line}:${test.title}`;
30
+ const testResult = {
31
+ status: result.status,
32
+ attachments: result.attachments,
33
+ startTime: result.startTime,
34
+ retry: result.retry,
35
+ stderr: result.stderr,
36
+ stdout: result.stdout,
37
+ workerIndex: result.workerIndex,
38
+ duration: result.duration,
39
+ errors: ((_result$errors = result.errors) === null || _result$errors === void 0 ? void 0 : _result$errors.map(({
40
+ message,
41
+ stack,
42
+ snippet
43
+ }) => ({
44
+ message,
45
+ stack,
46
+ snippet
47
+ }))) ?? [],
48
+ steps: ((_result$steps = result.steps) === null || _result$steps === void 0 ? void 0 : _result$steps.map(step => extractMergedSteps(this.report.config.rootDir, step))) ?? []
49
+ };
50
+ const existingResults = this.testResultsById.get(key) ?? [];
51
+ this.testResultsById.set(key, [...existingResults, testResult]);
52
+ }
53
+ onEnd() {
54
+ var _this$rootSuite;
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
+ });
59
+ _fs.default.writeFileSync(this.outputFile, JSON.stringify(this.report, null, 2));
60
+ console.log(`Custom JSON report written to: ${this.outputFile}`);
61
+ }
62
+ }
63
+ exports.default = CustomJsonReporter;
64
+ const extractMergedSuite = (rootDir, suite, testResultsById) => {
65
+ var _suite$suites;
66
+ const specMap = new Map();
67
+ for (const test of suite.tests ?? []) {
68
+ const existingSpec = specMap.get(test.title);
69
+ if (existingSpec) {
70
+ const newTestInfo = extractTestDetails(test, testResultsById);
71
+ existingSpec.tests.push(newTestInfo);
72
+ } else {
73
+ const newSpec = createSpecEntry(rootDir, test, testResultsById);
74
+ specMap.set(test.title, newSpec);
75
+ }
76
+ }
77
+ return {
78
+ title: suite.title,
79
+ ...parseLocation(rootDir, suite.location),
80
+ ...(suite.location && {
81
+ snippet: formSnippet(rootDir, suite.location)
82
+ }),
83
+ ...(((_suite$suites = suite.suites) === null || _suite$suites === void 0 ? void 0 : _suite$suites.length) > 0 && {
84
+ suites: suite.suites.map(child => extractMergedSuite(rootDir, child, testResultsById))
85
+ }),
86
+ ...(specMap.size > 0 && {
87
+ specs: Array.from(specMap.values())
88
+ })
89
+ };
90
+ };
91
+ const createSpecEntry = (rootDir, test, testResultsById) => ({
92
+ title: test.title,
93
+ ...parseLocation(rootDir, test.location),
94
+ ...(test.location && {
95
+ snippet: formSnippet(test.location)
96
+ }),
97
+ tests: [extractTestDetails(test, testResultsById)]
98
+ });
99
+ const extractTestDetails = (test, testResultsById) => {
100
+ var _test$location, _test$location2;
101
+ const key = `${(_test$location = test.location) === null || _test$location === void 0 ? void 0 : _test$location.file}:${(_test$location2 = test.location) === null || _test$location2 === void 0 ? void 0 : _test$location2.line}:${test.title}`;
102
+ return {
103
+ annotations: test.annotations,
104
+ expectedStatus: test.expectedStatus,
105
+ timeout: test.timeout,
106
+ retries: test.retries,
107
+ tags: test.tags,
108
+ results: testResultsById.get(key) ?? [],
109
+ status: test.outcome()
110
+ };
111
+ };
112
+ const extractMergedSteps = (rootDir, step) => ({
113
+ title: step.title,
114
+ duration: step.duration,
115
+ ...(step.error && {
116
+ error: {
117
+ message: step.error.message,
118
+ stack: step.error.stack,
119
+ snippet: step.error.snippet
120
+ }
121
+ }),
122
+ ...parseLocation(rootDir, step.location),
123
+ status: step.status,
124
+ ...(step.location && {
125
+ snippet: formSnippet(rootDir, step.location)
126
+ }),
127
+ ...(step.steps && step.steps.length > 0 && {
128
+ steps: step.steps.map(subStep => extractMergedSteps(rootDir, subStep))
129
+ })
130
+ });
131
+ const formSnippet = (rootDir, location) => {
132
+ if (location && !(location !== null && location !== void 0 && location.file)) return '';
133
+ try {
134
+ const {
135
+ file,
136
+ line,
137
+ column
138
+ } = parseLocation(rootDir, location, false);
139
+ const raw = _fs.default.readFileSync(file, 'utf8');
140
+ return (0, _codeFrame.codeFrameColumns)(raw, {
141
+ start: {
142
+ line,
143
+ column
144
+ }
145
+ }, {
146
+ linesAbove: 2,
147
+ linesBelow: 2,
148
+ highlightCode: true
149
+ });
150
+ } catch {
151
+ return '';
152
+ }
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
+ } : {};
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.64-n18-experimental",
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.64-n18-experimental",
9
+ "version": "0.4.66-n18-experimental",
10
10
  "hasInstallScript": true,
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
+ "@babel/code-frame": "7.27.1",
13
14
  "@babel/preset-react": "7.22.5",
14
15
  "@cucumber/cucumber": "11.2.0",
15
- "@playwright/test": "1.52.0",
16
+ "@playwright/test": "1.51.1",
16
17
  "@reportportal/agent-js-playwright": "5.1.11",
17
18
  "@testing-library/jest-dom": "5.11.9",
18
19
  "@testing-library/react": "11.2.7",
@@ -23,7 +24,7 @@
23
24
  "jest": "29.6.2",
24
25
  "jest-environment-jsdom": "29.6.2",
25
26
  "msw": "1.2.3",
26
- "playwright": "1.52.0",
27
+ "playwright": "1.51.1",
27
28
  "playwright-bdd": "8.2.1",
28
29
  "supports-color": "8.1.1"
29
30
  },
@@ -98,13 +99,14 @@
98
99
  }
99
100
  },
100
101
  "node_modules/@babel/code-frame": {
101
- "version": "7.26.2",
102
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz",
103
- "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
102
+ "version": "7.27.1",
103
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
104
+ "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
105
+ "license": "MIT",
104
106
  "dependencies": {
105
- "@babel/helper-validator-identifier": "^7.25.9",
107
+ "@babel/helper-validator-identifier": "^7.27.1",
106
108
  "js-tokens": "^4.0.0",
107
- "picocolors": "^1.0.0"
109
+ "picocolors": "^1.1.1"
108
110
  },
109
111
  "engines": {
110
112
  "node": ">=6.9.0"
@@ -359,9 +361,10 @@
359
361
  }
360
362
  },
361
363
  "node_modules/@babel/helper-validator-identifier": {
362
- "version": "7.25.9",
363
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
364
- "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
364
+ "version": "7.27.1",
365
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
366
+ "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
367
+ "license": "MIT",
365
368
  "engines": {
366
369
  "node": ">=6.9.0"
367
370
  }
@@ -3092,12 +3095,12 @@
3092
3095
  }
3093
3096
  },
3094
3097
  "node_modules/@playwright/test": {
3095
- "version": "1.52.0",
3096
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.52.0.tgz",
3097
- "integrity": "sha512-uh6W7sb55hl7D6vsAeA+V2p5JnlAqzhqFyF0VcJkKZXkgnFcVG9PziERRHQfPLfNGx1C292a4JqbWzhR8L4R1g==",
3098
+ "version": "1.51.1",
3099
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.51.1.tgz",
3100
+ "integrity": "sha512-nM+kEaTSAoVlXmMPH10017vn3FSiFqr/bh4fKg9vmAdMfd9SDqRZNvPSiAHADc/itWak+qPvMPZQOPwCBW7k7Q==",
3098
3101
  "license": "Apache-2.0",
3099
3102
  "dependencies": {
3100
- "playwright": "1.52.0"
3103
+ "playwright": "1.51.1"
3101
3104
  },
3102
3105
  "bin": {
3103
3106
  "playwright": "cli.js"
@@ -8658,12 +8661,12 @@
8658
8661
  }
8659
8662
  },
8660
8663
  "node_modules/playwright": {
8661
- "version": "1.52.0",
8662
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz",
8663
- "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==",
8664
+ "version": "1.51.1",
8665
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.51.1.tgz",
8666
+ "integrity": "sha512-kkx+MB2KQRkyxjYPc3a0wLZZoDczmppyGJIvQ43l+aZihkaVvmu/21kiyaHeHjiFxjxNNFnUncKmcGIyOojsaw==",
8664
8667
  "license": "Apache-2.0",
8665
8668
  "dependencies": {
8666
- "playwright-core": "1.52.0"
8669
+ "playwright-core": "1.51.1"
8667
8670
  },
8668
8671
  "bin": {
8669
8672
  "playwright": "cli.js"
@@ -8831,9 +8834,9 @@
8831
8834
  }
8832
8835
  },
8833
8836
  "node_modules/playwright-core": {
8834
- "version": "1.52.0",
8835
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz",
8836
- "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==",
8837
+ "version": "1.51.1",
8838
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.51.1.tgz",
8839
+ "integrity": "sha512-/crRMj8+j/Nq5s8QcvegseuyeZPxpQCZb6HNk3Sos3BlZyAknRjoyJPFWkpNn8v0+P3WiwqFF8P+zQo4eqiNuw==",
8837
8840
  "license": "Apache-2.0",
8838
8841
  "bin": {
8839
8842
  "playwright-core": "cli.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.64-n18-experimental",
3
+ "version": "0.4.66-n18-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -21,9 +21,10 @@
21
21
  "author": "",
22
22
  "license": "ISC",
23
23
  "dependencies": {
24
+ "@babel/code-frame": "7.27.1",
24
25
  "@babel/preset-react": "7.22.5",
25
26
  "@cucumber/cucumber": "11.2.0",
26
- "@playwright/test": "1.52.0",
27
+ "@playwright/test": "1.51.1",
27
28
  "@reportportal/agent-js-playwright": "5.1.11",
28
29
  "@testing-library/jest-dom": "5.11.9",
29
30
  "@testing-library/react": "11.2.7",
@@ -34,9 +35,9 @@
34
35
  "jest": "29.6.2",
35
36
  "jest-environment-jsdom": "29.6.2",
36
37
  "msw": "1.2.3",
37
- "playwright": "1.52.0",
38
- "supports-color": "8.1.1",
39
- "playwright-bdd": "8.2.1"
38
+ "playwright": "1.51.1",
39
+ "playwright-bdd": "8.2.1",
40
+ "supports-color": "8.1.1"
40
41
  },
41
42
  "bin": {
42
43
  "ZDTestingFramework": "./bin/cli.js"
@@ -8,13 +8,13 @@ export default defineConfig({
8
8
  outputDir: path.join(process.cwd(), 'uat', 'test-results'),
9
9
  fullyParallel: true,
10
10
  retries: process.env.CI ? 2 : 0,
11
- reporter: [['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }]],
11
+ reporter: [
12
+ ['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }],
13
+ ['./src/core/playwright/setup/qc-custom-reporter.js']
14
+ ],
12
15
  timeout: 60 * 1000,
13
16
  expect: {
14
17
  timeout: 5 * 1000,
15
- toMatchAriaSnapshot: {
16
- pathTemplate: 'uat/snapshot/custom-snapshots/{testFilePath}/{arg}{ext}',
17
- },
18
18
  },
19
19
  use: {
20
20
  trace: 'on',