@zohodesk/testinglibrary 0.4.65-n18-experimental → 0.4.67-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,9 @@ 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
+ await page.goto(domainUrlOrigin);
18
+ }
19
+ await page.waitForURL(`${domainUrlOrigin}/**`);
17
20
  }
18
21
  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
- outputFile = 'playwright-custom-report.json'
13
+ outputFile = 'test-results.json'
13
14
  } = {}) {
14
- this.outputFile = outputFile;
15
+ this.outputFile = _path.default.resolve(process.cwd(), 'uat/playwright-report/', 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
- const testSuites = ((_this$rootSuite = this.rootSuite) === null || _this$rootSuite === void 0 || (_this$rootSuite = _this$rootSuite.suites) === null || _this$rootSuite === void 0 || (_this$rootSuite = _this$rootSuite[0]) === null || _this$rootSuite === void 0 ? void 0 : _this$rootSuite.suites) ?? [];
55
- const extracted = testSuites.map(suite => extractMergedSuite(suite, this.testResultsById));
56
- this.report.suites.push(...extracted);
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
- location: suite.location,
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
- location: test.location,
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
- location: step.location,
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 raw = _fs.default.readFileSync(location.file, 'utf8');
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: location.line,
136
- column: location.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
+ } : {};
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.65-n18-experimental",
3
+ "version": "0.4.67-n18-experimental",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/testinglibrary",
9
- "version": "0.4.65-n18-experimental",
9
+ "version": "0.4.67-n18-experimental",
10
10
  "hasInstallScript": true,
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "@babel/code-frame": "7.27.1",
14
14
  "@babel/preset-react": "7.22.5",
15
15
  "@cucumber/cucumber": "11.2.0",
16
- "@playwright/test": "1.51.1",
16
+ "@playwright/test": "1.52.0",
17
17
  "@reportportal/agent-js-playwright": "5.1.11",
18
18
  "@testing-library/jest-dom": "5.11.9",
19
19
  "@testing-library/react": "11.2.7",
@@ -24,7 +24,7 @@
24
24
  "jest": "29.6.2",
25
25
  "jest-environment-jsdom": "29.6.2",
26
26
  "msw": "1.2.3",
27
- "playwright": "1.51.1",
27
+ "playwright": "1.52.0",
28
28
  "playwright-bdd": "8.2.1",
29
29
  "supports-color": "8.1.1"
30
30
  },
@@ -3095,12 +3095,12 @@
3095
3095
  }
3096
3096
  },
3097
3097
  "node_modules/@playwright/test": {
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
+ "version": "1.52.0",
3099
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.52.0.tgz",
3100
+ "integrity": "sha512-uh6W7sb55hl7D6vsAeA+V2p5JnlAqzhqFyF0VcJkKZXkgnFcVG9PziERRHQfPLfNGx1C292a4JqbWzhR8L4R1g==",
3101
3101
  "license": "Apache-2.0",
3102
3102
  "dependencies": {
3103
- "playwright": "1.51.1"
3103
+ "playwright": "1.52.0"
3104
3104
  },
3105
3105
  "bin": {
3106
3106
  "playwright": "cli.js"
@@ -8661,12 +8661,12 @@
8661
8661
  }
8662
8662
  },
8663
8663
  "node_modules/playwright": {
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
+ "version": "1.52.0",
8665
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz",
8666
+ "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==",
8667
8667
  "license": "Apache-2.0",
8668
8668
  "dependencies": {
8669
- "playwright-core": "1.51.1"
8669
+ "playwright-core": "1.52.0"
8670
8670
  },
8671
8671
  "bin": {
8672
8672
  "playwright": "cli.js"
@@ -8834,9 +8834,9 @@
8834
8834
  }
8835
8835
  },
8836
8836
  "node_modules/playwright-core": {
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
+ "version": "1.52.0",
8838
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz",
8839
+ "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==",
8840
8840
  "license": "Apache-2.0",
8841
8841
  "bin": {
8842
8842
  "playwright-core": "cli.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.65-n18-experimental",
3
+ "version": "0.4.67-n18-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "@babel/code-frame": "7.27.1",
25
25
  "@babel/preset-react": "7.22.5",
26
26
  "@cucumber/cucumber": "11.2.0",
27
- "@playwright/test": "1.51.1",
27
+ "@playwright/test": "1.52.0",
28
28
  "@reportportal/agent-js-playwright": "5.1.11",
29
29
  "@testing-library/jest-dom": "5.11.9",
30
30
  "@testing-library/react": "11.2.7",
@@ -35,9 +35,9 @@
35
35
  "jest": "29.6.2",
36
36
  "jest-environment-jsdom": "29.6.2",
37
37
  "msw": "1.2.3",
38
- "playwright": "1.51.1",
39
- "playwright-bdd": "8.2.1",
40
- "supports-color": "8.1.1"
38
+ "playwright": "1.52.0",
39
+ "supports-color": "8.1.1",
40
+ "playwright-bdd": "8.2.1"
41
41
  },
42
42
  "bin": {
43
43
  "ZDTestingFramework": "./bin/cli.js"
@@ -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/my-custom-reporter.js']
13
+ ['./src/core/playwright/setup/qc-custom-reporter.js']
14
14
  ],
15
15
  timeout: 60 * 1000,
16
16
  expect: {