artes 1.2.8 → 1.2.11
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.
package/README.md
CHANGED
|
@@ -52,7 +52,8 @@ npx artes [options]
|
|
|
52
52
|
| `--reportSuccess` | Add screenshots and video records for also Success test cases | `artes --reportSuccess` |
|
|
53
53
|
| `--trace` | Enable tracing | `artes --trace ` |
|
|
54
54
|
| `-rwt, --reportWithTrace` | Add trace to the report | `artes -rwt` or `artes --reportWithTrace` |
|
|
55
|
-
| `--singleFileReport` | Generate single file allure report | ` artes --singleFileReport` |
|
|
55
|
+
| `--singleFileReport` | Generate single file allure report | ` artes -r --singleFileReport` |
|
|
56
|
+
| `--zip` | Zip the report folder after generation | ` artes -r --zip` |
|
|
56
57
|
| 📁 `--features` | Specify one or more feature files' relative paths to run (comma-separated) | `artes --features "tests/features/Alma,tests/features/Banan.feature"` |
|
|
57
58
|
| 📜 `--stepDef` | Specify one or more step definition files' relative paths to use (comma-separated) | `artes --stepDef "tests/steps/login.js,tests/steps/home.js"` |
|
|
58
59
|
| 🔖 `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke or @wip"` |
|
|
@@ -310,27 +311,27 @@ Undefined hooks are automatically skipped.
|
|
|
310
311
|
// tests/steps/hooks.js
|
|
311
312
|
|
|
312
313
|
export function BeforeStep() {
|
|
313
|
-
|
|
314
|
+
// hook for before each step
|
|
314
315
|
}
|
|
315
316
|
|
|
316
317
|
export function Before() {
|
|
317
|
-
|
|
318
|
+
// hook for before each test
|
|
318
319
|
}
|
|
319
320
|
|
|
320
321
|
export function BeforeAll() {
|
|
321
|
-
|
|
322
|
+
// hook for before all tests
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
export function AfterStep() {
|
|
325
|
-
|
|
326
|
+
// hook for after each step
|
|
326
327
|
}
|
|
327
328
|
|
|
328
329
|
export function After() {
|
|
329
|
-
|
|
330
|
+
// hook for after each test
|
|
330
331
|
}
|
|
331
332
|
|
|
332
333
|
export function AfterAll() {
|
|
333
|
-
|
|
334
|
+
// hook for after all tests
|
|
334
335
|
}
|
|
335
336
|
```
|
|
336
337
|
|
package/cucumber.config.js
CHANGED
|
@@ -132,7 +132,8 @@ module.exports = {
|
|
|
132
132
|
worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
|
|
133
133
|
},
|
|
134
134
|
report:{
|
|
135
|
-
singleFileReport: process.env.SINGLE_FILE_REPORT == "true" ? true : artesConfig.singleFileReport ? true : false
|
|
135
|
+
singleFileReport: process.env.SINGLE_FILE_REPORT == "true" ? true : artesConfig.singleFileReport ? true : false,
|
|
136
|
+
zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false
|
|
136
137
|
},
|
|
137
138
|
env: env,
|
|
138
139
|
baseURL: process.env.BASE_URL
|
package/executer.js
CHANGED
|
@@ -30,6 +30,7 @@ const flags = {
|
|
|
30
30
|
trace: args.includes("-t") || args.includes("--trace"),
|
|
31
31
|
reportWithTrace: args.includes("-rwt") || args.includes("--reportWithTrace"),
|
|
32
32
|
singleFileReport: args.includes("--singleFileReport"),
|
|
33
|
+
zip: args.includes("--zip"),
|
|
33
34
|
features: args.includes("--features"),
|
|
34
35
|
stepDef: args.includes("--stepDef"),
|
|
35
36
|
tags: args.includes("--tags"),
|
|
@@ -94,6 +95,8 @@ flags.reportWithTrace ? (process.env.REPORT_WITH_TRACE = true) : (process.env.RE
|
|
|
94
95
|
|
|
95
96
|
flags.singleFileReport ? (process.env.SINGLE_FILE_REPORT = true) : (process.env.SINGLE_FILE_REPORT=false);
|
|
96
97
|
|
|
98
|
+
flags.zip ? (process.env.ZIP = true) : (process.env.ZIP=false);
|
|
99
|
+
|
|
97
100
|
flags.headless &&
|
|
98
101
|
console.log("Running mode:", flags.headless ? "headless" : "headed");
|
|
99
102
|
flags.headless ? (process.env.MODE = JSON.stringify(true)) : false;
|
package/package.json
CHANGED
|
@@ -35,7 +35,10 @@ function showHelp() {
|
|
|
35
35
|
Usage: artes --reportWithTrace
|
|
36
36
|
|
|
37
37
|
📄 --singleFileReport Generate single file Allure report
|
|
38
|
-
Usage: artes --singleFileReport
|
|
38
|
+
Usage: artes -r --singleFileReport
|
|
39
|
+
|
|
40
|
+
🗜️ --zip Zip the report folder after generation
|
|
41
|
+
Usage: artes -r --zip
|
|
39
42
|
|
|
40
43
|
📁 --features Specify one or more feature files' relative paths to run (comma-separated)
|
|
41
44
|
Usage: artes --features "tests/features/Alma, tests/features/Banan.feature"
|
|
@@ -16,16 +16,21 @@ function createProject(createYes) {
|
|
|
16
16
|
path.join(projectDir, ".vscode"),
|
|
17
17
|
].forEach((dir) => fs.mkdirSync(dir, { recursive: true }));
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
console.log("🚀 Initializing project...");
|
|
20
|
-
execSync(`npm init ${createYes ? "-y" : ""}`, { stdio: "inherit" });
|
|
21
|
-
execSync("npm i artes", { stdio: "inherit" });
|
|
21
|
+
execSync(`npm init ${createYes ? "-y" : ""}`, {cwd: projectDir, stdio: "inherit" });
|
|
22
|
+
execSync("npm i artes", {cwd: projectDir, stdio: "inherit" });
|
|
22
23
|
|
|
23
24
|
console.log("📦 Setting up browsers...");
|
|
24
|
-
execSync("npx playwright install", { stdio: "inherit" });
|
|
25
|
+
execSync("npx playwright install", {cwd: projectDir, stdio: "inherit" });
|
|
25
26
|
|
|
26
27
|
const packageJsonPath = path.join(projectDir, "package.json");
|
|
27
28
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
28
29
|
|
|
30
|
+
if (packageJson.type) {
|
|
31
|
+
delete packageJson.type;
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
packageJson.scripts = {
|
|
30
35
|
test: "npx artes",
|
|
31
36
|
testWithReport: "npx artes -r",
|
|
@@ -125,27 +130,27 @@ await context.page.goto("https://www.saucedemo.com/");
|
|
|
125
130
|
|
|
126
131
|
const hooksContent = `
|
|
127
132
|
export function BeforeStep() {
|
|
128
|
-
|
|
133
|
+
// hook for before each step
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
export function Before() {
|
|
132
|
-
|
|
137
|
+
// hook for before each test
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
export function BeforeAll() {
|
|
136
|
-
|
|
141
|
+
// hook for before all tests
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
export function AfterStep() {
|
|
140
|
-
|
|
145
|
+
// hook for after each step
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
export function After() {
|
|
144
|
-
|
|
149
|
+
// hook for after each test
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
export function AfterAll() {
|
|
148
|
-
|
|
153
|
+
// hook for after all tests
|
|
149
154
|
}
|
|
150
155
|
`;
|
|
151
156
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const { spawnSync } = require("child_process");
|
|
2
2
|
const { moduleConfig } = require("../imports/commons");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
3
5
|
|
|
4
6
|
function generateReport() {
|
|
5
7
|
|
|
@@ -12,7 +14,33 @@ function generateReport() {
|
|
|
12
14
|
shell: true,
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
if (fs.existsSync(moduleConfig.reportPath)) {
|
|
18
|
+
|
|
19
|
+
console.log(`🗜️ Zipping report folder to report.zip...`);
|
|
20
|
+
|
|
21
|
+
const zipResult = spawnSync("zip", ["-r", "report.zip", path.basename(moduleConfig.reportPath)], {
|
|
22
|
+
cwd: path.dirname(moduleConfig.reportPath),
|
|
23
|
+
stdio: "ignore"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (zipResult.status === 0) {
|
|
27
|
+
const trueZipPath = path.join(path.dirname(moduleConfig.reportPath), 'true.zip');
|
|
28
|
+
const reportZipPath = path.join(path.dirname(moduleConfig.reportPath), 'report.zip');
|
|
29
|
+
|
|
30
|
+
if (fs.existsSync(trueZipPath)) {
|
|
31
|
+
fs.renameSync(trueZipPath, reportZipPath);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
console.log(`✅ Report folder zipped successfully in ${moduleConfig.reportPath}/report.zip!`);
|
|
35
|
+
} else {
|
|
36
|
+
console.error("❌ Failed to zip report folder");
|
|
37
|
+
process.env.EXIT_CODE = 1;
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
console.warn(`⚠️ Report folder does not exist: ${moduleConfig.reportPath}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log(`📋 Report generated successfully in ${moduleConfig.reportPath}!`);
|
|
16
44
|
} catch (error) {
|
|
17
45
|
console.error("❌ Report generation failed:", error);
|
|
18
46
|
process.env.EXIT_CODE = 1;
|