artes 1.2.20 → 1.2.22

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.
@@ -80,19 +80,19 @@ module.exports = {
80
80
  import: artesConfig.import || [], // Support code paths
81
81
 
82
82
  report:
83
- process.env.REPORT_WITH_TRACE ??
84
- artesConfig.reportWithTrace ??
85
- process.env.REPORT ??
86
- artesConfig.report ??
83
+ process.env.REPORT_WITH_TRACE === "true" ??
84
+ artesConfig.reportWithTrace === "true" ??
85
+ process.env.REPORT === "true" ??
86
+ artesConfig.report === "true" ??
87
87
  false, // Generate report
88
88
  // Formatting and output
89
89
  successReport: process.env.REPORT_SUCCESS
90
90
  ? true
91
91
  : artesConfig.reportSuccess || false, // Include successful tests in report
92
92
 
93
- trace: process.env.TRACE ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
93
+ trace: process.env.TRACE === "true" ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
94
94
 
95
- reportWithTrace: process.env.REPORT_WITH_TRACE
95
+ reportWithTrace: process.env.REPORT_WITH_TRACE === "true"
96
96
  ? process.env.REPORT_WITH_TRACE
97
97
  : artesConfig.reportWithTrace || false, // Include trace in report
98
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,6 +40,10 @@ function createProject(createYes, noDeps) {
40
40
  testWithReport: "npx artes -r",
41
41
  };
42
42
 
43
+ packageJson.dependencies = {
44
+ artes: "1.2.21",
45
+ };
46
+
43
47
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
44
48
 
45
49
  const config = `module.exports = {
@@ -29,7 +29,8 @@ function generateReport() {
29
29
  `📋 Report generated successfully in ${moduleConfig.reportPath}!`,
30
30
  );
31
31
 
32
- if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP) {
32
+
33
+ if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP === "true") {
33
34
  console.log(`🗜️ Zipping report folder`);
34
35
 
35
36
  const zipPath = path.join(
@@ -60,11 +61,8 @@ function generateReport() {
60
61
 
61
62
  console.log(`🗜️ Zipped in ${moduleConfig.reportPath}/report.zip!`);
62
63
  if (error) throw error;
63
- } else {
64
- console.warn(
65
- `⚠️ Report folder does not exist: ${moduleConfig.reportPath}`,
66
- );
67
- }
64
+ }
65
+
68
66
  } catch (err) {
69
67
  console.error("❌ Report generation failed:", err);
70
68
  process.env.EXIT_CODE = 1;
@@ -103,10 +103,7 @@ Before(async function () {
103
103
 
104
104
  await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
105
105
 
106
- if (
107
- (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) &&
108
- !context.response
109
- ) {
106
+ if ( cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {
110
107
  await browserContext.tracing.start({
111
108
  sources: true,
112
109
  screenshots: true,
@@ -146,8 +143,7 @@ After(async function ({ pickle, result }) {
146
143
 
147
144
  const shouldReport =
148
145
  (cucumberConfig.default.successReport ||
149
- result?.status !== Status.PASSED) &&
150
- !context.response;
146
+ result?.status !== Status.PASSED)
151
147
 
152
148
  if (shouldReport) {
153
149
  const screenshotPath = path.join(
@@ -168,16 +164,16 @@ After(async function ({ pickle, result }) {
168
164
  }
169
165
 
170
166
  saveTestStatus(result, pickle);
171
-
172
- const tracePath = path.join(
167
+ if((cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace)){
168
+ var tracePath = path.join(
173
169
  moduleConfig.projectPath,
174
- `./${pickle.name.replaceAll(" ", "_")}.zip`,
170
+ `./traces/${pickle.name.replaceAll(" ", "_")}.zip`,
175
171
  );
172
+ }
173
+
176
174
 
177
175
  if (
178
- (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) &&
179
- !context.response &&
180
- shouldReport
176
+ (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) && shouldReport
181
177
  ) {
182
178
  await context.browserContext.tracing.stop({
183
179
  path: tracePath,
@@ -192,10 +188,10 @@ After(async function ({ pickle, result }) {
192
188
  });
193
189
 
194
190
  if (!cucumberConfig.default.trace) {
195
- spawnSync("npx", ["rimraf", tracePath], {
191
+ spawnSync("npx", ["rimraf", "--no-glob", path.join(moduleConfig.projectPath, "./traces")], {
196
192
  cwd: moduleConfig.projectPath,
197
193
  stdio: "inherit",
198
- shell: true,
194
+ shell: false,
199
195
  });
200
196
  }
201
197
  }