k6-cucumber-steps 1.1.4 → 1.1.5
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 +17 -18
- package/bin/k6-cucumber-steps.js +48 -138
- package/package.json +10 -2
- package/scripts/linkReports.js +43 -50
- package/step_definitions/load_test_steps.js +15 -11
- package/.env +0 -38
- package/.github/workflows/k6-load-test.yml +0 -42
- package/.vscode/extensions.json +0 -3
- package/.vscode/settings.json +0 -14
- package/assets/k6-cucumber-report.png +0 -0
- package/assets/k6-cucumber-report2.png +0 -0
- package/assets/paschal logo (2).png +0 -0
- package/cucumber.js +0 -17
- package/reports/cucumber-report.html +0 -50
- package/reports/load-report.json +0 -294
- package/temp/load_script_6ae38e6d-f93e-443a-a516-587047b1f46b.js +0 -65
package/README.md
CHANGED
|
@@ -57,11 +57,13 @@ The `run` command accepts the following options:
|
|
|
57
57
|
- `-t, --tags <string>`: Cucumber tags to filter scenarios (e.g., `@smoke and not @regression`).
|
|
58
58
|
- `-r, --reporter`: Generate HTML and JSON reports in the `reports` directory. This is a boolean flag, so just include `-r, --reporter` to enable it.
|
|
59
59
|
- `-o, --overwrite`: Overwrite existing reports instead of appending them.
|
|
60
|
+
- `--cleanReports`, `--clean`: **Clean the `reports` directory before running.**
|
|
61
|
+
You can also set this via the `cleanReports` property in your `cucumber.js` config or with the `CLEAN_REPORTS=true` environment variable.
|
|
60
62
|
|
|
61
63
|
### Example Usage with Options
|
|
62
64
|
|
|
63
65
|
```bash
|
|
64
|
-
npx k6-cucumber-steps run --feature ./features/my_feature.feature --tags "@load and not @wip" --reporter
|
|
66
|
+
npx k6-cucumber-steps run --feature ./features/my_feature.feature --tags "@load and not @wip" --reporter --cleanReports
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
---
|
|
@@ -116,7 +118,7 @@ Here's a step-by-step guide to using `k6-cucumber-steps` in your project:
|
|
|
116
118
|
require: [
|
|
117
119
|
// You can add paths to your local step definitions here if needed
|
|
118
120
|
],
|
|
119
|
-
reporter:true // To provide HTML and JSON report
|
|
121
|
+
reporter: true, // To provide HTML and JSON report
|
|
120
122
|
format: [
|
|
121
123
|
"summary",
|
|
122
124
|
"json:reports/load-report.json", // For JSON report
|
|
@@ -125,25 +127,27 @@ Here's a step-by-step guide to using `k6-cucumber-steps` in your project:
|
|
|
125
127
|
paths: ["./features/*.feature"],
|
|
126
128
|
tags: process.env.TAGS,
|
|
127
129
|
worldParameters: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
payloadPath: "apps/qa/performance/payloads"
|
|
131
|
+
},
|
|
130
132
|
overwrite: false, // Default to not overwrite the report file
|
|
133
|
+
cleanReports: true, // <--- Clean the reports directory before running
|
|
131
134
|
};
|
|
132
135
|
```
|
|
133
136
|
|
|
134
|
-
**
|
|
137
|
+
**Controlling Report Directory Clean-up**
|
|
135
138
|
|
|
136
|
-
|
|
139
|
+
You can control whether the `reports` directory is cleaned before each run using any of these methods:
|
|
137
140
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
+
- **Command-line:**
|
|
142
|
+
Add `--cleanReports` or `--clean` to your CLI command.
|
|
141
143
|
|
|
142
|
-
|
|
144
|
+
- **Environment variable:**
|
|
145
|
+
Add `CLEAN_REPORTS=true` to your `.env` file.
|
|
143
146
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
- **Config file:**
|
|
148
|
+
Set `cleanReports: true` in your `cucumber.js` config.
|
|
149
|
+
|
|
150
|
+
Priority order: **CLI > Environment variable > Config file**
|
|
147
151
|
|
|
148
152
|
---
|
|
149
153
|
|
|
@@ -272,12 +276,7 @@ If you find this package useful, consider [sponsoring me on GitHub](https://gith
|
|
|
272
276
|
|
|
273
277
|
MIT License - [@qaPaschalE](https://github.com/qaPaschalE)
|
|
274
278
|
|
|
275
|
-
```
|
|
276
|
-
|
|
277
279
|
|
|
278
280
|
## License
|
|
279
281
|
|
|
280
282
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
```
|
package/bin/k6-cucumber-steps.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//bin/k6-cucumber-steps.js
|
|
3
2
|
const path = require("path");
|
|
4
3
|
const fs = require("fs");
|
|
5
4
|
const { spawn } = require("child_process");
|
|
@@ -7,225 +6,136 @@ const yargs = require("yargs/yargs");
|
|
|
7
6
|
const { hideBin } = require("yargs/helpers");
|
|
8
7
|
require("dotenv").config();
|
|
9
8
|
|
|
9
|
+
const { linkReports } = require("../scripts/linkReports");
|
|
10
|
+
|
|
10
11
|
console.log(`
|
|
11
12
|
-----------------------------------------
|
|
12
13
|
🚀 Starting k6-cucumber-steps execution...
|
|
13
14
|
-----------------------------------------
|
|
14
15
|
`);
|
|
15
16
|
|
|
16
|
-
// Parse CLI arguments
|
|
17
17
|
const argv = yargs(hideBin(process.argv))
|
|
18
|
-
.usage("Usage: $0 run [options]")
|
|
19
18
|
.option("feature", {
|
|
20
19
|
alias: "f",
|
|
21
|
-
describe: "Path to the feature file",
|
|
22
20
|
type: "string",
|
|
21
|
+
describe: "Feature file path",
|
|
23
22
|
})
|
|
24
|
-
.option("tags", {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
.option("tags", { alias: "t", type: "string", describe: "Cucumber tags" })
|
|
24
|
+
.option("configFile", {
|
|
25
|
+
alias: "c",
|
|
27
26
|
type: "string",
|
|
27
|
+
describe: "Custom config file",
|
|
28
28
|
})
|
|
29
29
|
.option("reporter", {
|
|
30
30
|
alias: "r",
|
|
31
|
-
describe: "Enable HTML and JSON reports",
|
|
32
31
|
type: "boolean",
|
|
33
32
|
default: false,
|
|
33
|
+
describe: "Enable report generation",
|
|
34
34
|
})
|
|
35
35
|
.option("overwrite", {
|
|
36
36
|
alias: "o",
|
|
37
|
-
describe: "Overwrite existing reports",
|
|
38
37
|
type: "boolean",
|
|
39
38
|
default: false,
|
|
39
|
+
describe: "Overwrite report files",
|
|
40
40
|
})
|
|
41
|
-
.option("
|
|
42
|
-
alias: "
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
.option("cleanReports", {
|
|
42
|
+
alias: "clean",
|
|
43
|
+
type: "boolean",
|
|
44
|
+
describe: "Clean the reports folder before running",
|
|
45
45
|
})
|
|
46
46
|
.help().argv;
|
|
47
47
|
|
|
48
|
-
// Base Cucumber arguments
|
|
49
48
|
const cucumberArgs = ["cucumber-js"];
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
const configFileName =
|
|
50
|
+
const configFileInput =
|
|
53
51
|
argv.configFile || process.env.CUCUMBER_CONFIG_FILE || "cucumber.js";
|
|
54
|
-
const configFilePath = path.
|
|
52
|
+
const configFilePath = path.isAbsolute(configFileInput)
|
|
53
|
+
? configFileInput
|
|
54
|
+
: path.resolve(process.cwd(), configFileInput);
|
|
55
55
|
|
|
56
56
|
let configOptions = {};
|
|
57
|
+
|
|
57
58
|
if (fs.existsSync(configFilePath)) {
|
|
58
|
-
cucumberArgs.push("--config",
|
|
59
|
+
cucumberArgs.push("--config", configFileInput);
|
|
59
60
|
try {
|
|
60
61
|
const loadedConfig = require(configFilePath);
|
|
61
62
|
configOptions = loadedConfig.default || loadedConfig;
|
|
62
63
|
} catch (err) {
|
|
63
64
|
console.warn("⚠️ Could not load config file:", err.message);
|
|
64
65
|
}
|
|
66
|
+
} else {
|
|
67
|
+
console.warn(`⚠️ Config file not found at ${configFilePath}`);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
//
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
// Resolve cleanReports: CLI > ENV > config file
|
|
71
|
+
const cleanReports =
|
|
72
|
+
typeof argv.cleanReports === "boolean"
|
|
73
|
+
? argv.cleanReports
|
|
74
|
+
: process.env.CLEAN_REPORTS
|
|
75
|
+
? process.env.CLEAN_REPORTS === "true"
|
|
76
|
+
: configOptions.cleanReports;
|
|
77
|
+
|
|
78
|
+
// Clean reports directory if needed
|
|
79
|
+
const reportsDir = path.resolve("reports");
|
|
80
|
+
if (cleanReports) {
|
|
81
|
+
if (fs.existsSync(reportsDir)) {
|
|
82
|
+
fs.rmSync(reportsDir, { recursive: true, force: true });
|
|
83
|
+
console.log("🧹 Cleaned reports directory.");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!fs.existsSync(reportsDir)) {
|
|
87
|
+
fs.mkdirSync(reportsDir, { recursive: true });
|
|
71
88
|
}
|
|
72
89
|
|
|
73
|
-
//
|
|
90
|
+
// Build featureFiles array before using it
|
|
74
91
|
let featureFiles = [];
|
|
75
92
|
if (argv.feature) {
|
|
76
93
|
featureFiles.push(path.resolve(argv.feature));
|
|
77
|
-
} else if (
|
|
78
|
-
featureFiles
|
|
79
|
-
}
|
|
80
|
-
if (featureFiles.length > 0) {
|
|
81
|
-
cucumberArgs.push(...featureFiles);
|
|
94
|
+
} else if (Array.isArray(configOptions.paths)) {
|
|
95
|
+
featureFiles = configOptions.paths.map((f) => path.resolve(f));
|
|
82
96
|
}
|
|
83
97
|
|
|
84
|
-
// Require step definitions
|
|
85
|
-
const defaultStepsPath = path.resolve(
|
|
86
|
-
process.cwd(),
|
|
87
|
-
"node_modules",
|
|
88
|
-
"k6-cucumber-steps",
|
|
89
|
-
"step_definitions"
|
|
90
|
-
);
|
|
91
|
-
cucumberArgs.push("--require", defaultStepsPath);
|
|
92
|
-
|
|
93
|
-
// Include additional custom step definitions from config
|
|
94
|
-
if (configOptions.require && Array.isArray(configOptions.require)) {
|
|
95
|
-
for (const reqPath of configOptions.require) {
|
|
96
|
-
cucumberArgs.push("--require", path.resolve(reqPath));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Reports directory setup
|
|
101
|
-
const reportsDir = path.join(process.cwd(), "reports");
|
|
102
|
-
|
|
103
|
-
// Clean and prepare reports directory
|
|
104
|
-
const cleanReportsDir = () => {
|
|
105
|
-
if (fs.existsSync(reportsDir)) {
|
|
106
|
-
try {
|
|
107
|
-
fs.rmSync(reportsDir, { recursive: true, force: true });
|
|
108
|
-
console.log("🧹 Cleaned existing reports directory.");
|
|
109
|
-
} catch (err) {
|
|
110
|
-
console.error("❌ Failed to clean reports directory:", err.message);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
fs.mkdirSync(reportsDir, { recursive: true });
|
|
117
|
-
console.log("📁 Created fresh reports directory.");
|
|
118
|
-
} catch (err) {
|
|
119
|
-
console.error("❌ Failed to create reports directory:", err.message);
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
cleanReportsDir();
|
|
125
|
-
|
|
126
|
-
// Determine base report name
|
|
127
|
-
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
128
|
-
|
|
129
98
|
let baseReportName = "load-report";
|
|
130
99
|
if (featureFiles.length === 1) {
|
|
131
|
-
|
|
132
|
-
baseReportName = nameFromFeature || baseReportName;
|
|
100
|
+
baseReportName = path.basename(featureFiles[0], ".feature");
|
|
133
101
|
} else if (featureFiles.length > 1) {
|
|
134
102
|
baseReportName = "multi-feature";
|
|
135
103
|
}
|
|
104
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
105
|
+
let reportHtmlPath = path.join(reportsDir, `cucumber-report.html`);
|
|
136
106
|
|
|
137
|
-
|
|
138
|
-
const shouldOverwrite =
|
|
139
|
-
argv.overwrite ||
|
|
140
|
-
process.env.K6_CUCUMBER_OVERWRITE === "true" ||
|
|
141
|
-
configOptions.overwrite === true;
|
|
142
|
-
|
|
143
|
-
let reportJsonPath = path.join(reportsDir, `${baseReportName}.json`);
|
|
144
|
-
let reportHtmlPath = path.join(reportsDir, `${baseReportName}.html`);
|
|
145
|
-
|
|
146
|
-
if (!shouldOverwrite) {
|
|
147
|
-
reportJsonPath = path.join(reportsDir, `${baseReportName}-${timestamp}.json`);
|
|
148
|
-
reportHtmlPath = path.join(reportsDir, `${baseReportName}-${timestamp}.html`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Respect config format path if defined
|
|
152
|
-
if (Array.isArray(configOptions.format)) {
|
|
153
|
-
const jsonFmt = configOptions.format.find((f) => f.startsWith("json:"));
|
|
154
|
-
if (jsonFmt) {
|
|
155
|
-
reportJsonPath = jsonFmt.split("json:")[1];
|
|
156
|
-
console.log(`📝 Using report path from config: ${reportJsonPath}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const formatInConfig =
|
|
161
|
-
Array.isArray(configOptions.format) && configOptions.format.length > 0;
|
|
162
|
-
|
|
163
|
-
if (shouldGenerateReports && !formatInConfig) {
|
|
107
|
+
if (argv.reporter && !Array.isArray(configOptions.format)) {
|
|
164
108
|
cucumberArgs.push("--format", "summary");
|
|
165
|
-
cucumberArgs.push("--format", `json:${reportJsonPath}`);
|
|
166
109
|
cucumberArgs.push("--format", `html:${reportHtmlPath}`);
|
|
167
110
|
}
|
|
168
111
|
|
|
169
112
|
console.log("\n▶️ Final arguments passed to cucumber-js:");
|
|
170
113
|
console.log(["npx", ...cucumberArgs].join(" ") + "\n");
|
|
171
114
|
|
|
172
|
-
// Execute Cucumber process
|
|
173
115
|
const cucumberProcess = spawn("npx", cucumberArgs, {
|
|
174
116
|
stdio: "inherit",
|
|
175
117
|
env: {
|
|
176
118
|
...process.env,
|
|
177
|
-
K6_CUCUMBER_OVERWRITE: shouldOverwrite ? "true" : "false",
|
|
178
|
-
TAGS: tags,
|
|
179
|
-
FEATURE_PATH: featureFiles.join(","),
|
|
180
|
-
REPORT_JSON_PATH: reportJsonPath,
|
|
181
119
|
REPORT_HTML_PATH: reportHtmlPath,
|
|
120
|
+
K6_CUCUMBER_OVERWRITE: argv.overwrite ? "true" : "false",
|
|
182
121
|
},
|
|
183
122
|
});
|
|
184
123
|
|
|
185
|
-
function detectMostRecentK6Report() {
|
|
186
|
-
const files = fs
|
|
187
|
-
.readdirSync(reportsDir)
|
|
188
|
-
.filter((file) => /^k6-report.*\.html$/.test(file))
|
|
189
|
-
.map((file) => ({
|
|
190
|
-
name: file,
|
|
191
|
-
time: fs.statSync(path.join(reportsDir, file)).mtime.getTime(),
|
|
192
|
-
}))
|
|
193
|
-
.sort((a, b) => b.time - a.time);
|
|
194
|
-
|
|
195
|
-
return files.length > 0 ? path.join(reportsDir, files[0].name) : null;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
124
|
cucumberProcess.on("close", async (code) => {
|
|
199
125
|
if (code === 0) {
|
|
200
126
|
console.log("-----------------------------------------");
|
|
201
127
|
console.log("✅ k6-cucumber-steps execution completed successfully.");
|
|
202
|
-
|
|
203
|
-
// Generate Cucumber HTML report
|
|
204
|
-
try {
|
|
205
|
-
await generateHtmlReports();
|
|
206
|
-
console.log(
|
|
207
|
-
`🚀 Cucumber HTML report generated successfully at: ${reportHtmlPath}`
|
|
208
|
-
);
|
|
209
|
-
} catch (err) {
|
|
210
|
-
console.error("⚠️ Failed to generate Cucumber HTML report:", err.message);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Link reports
|
|
214
128
|
try {
|
|
215
129
|
await linkReports();
|
|
216
|
-
console.log(
|
|
217
|
-
"🔗 Combined and minified HTML report available at: reports/combined-report.html"
|
|
218
|
-
);
|
|
130
|
+
console.log("🔗 Reports linked successfully with embedded Cucumber tab.");
|
|
219
131
|
} catch (err) {
|
|
220
132
|
console.error("⚠️ Failed to link reports:", err.message);
|
|
221
133
|
}
|
|
222
|
-
|
|
223
134
|
console.log("-----------------------------------------");
|
|
224
135
|
} else {
|
|
225
136
|
console.error("-----------------------------------------");
|
|
226
137
|
console.error("❌ k6-cucumber-steps execution failed.");
|
|
227
138
|
console.error("-----------------------------------------");
|
|
228
139
|
}
|
|
229
|
-
|
|
230
140
|
process.exit(code);
|
|
231
141
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "k6-cucumber-steps",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,15 @@
|
|
|
33
33
|
"bin": {
|
|
34
34
|
"k6-cucumber-steps": "./bin/k6-cucumber-steps.js"
|
|
35
35
|
},
|
|
36
|
+
"files": [
|
|
37
|
+
"bin/",
|
|
38
|
+
"lib/",
|
|
39
|
+
"step_definitions/",
|
|
40
|
+
"scripts/",
|
|
41
|
+
"package.json",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
36
45
|
"keywords": [
|
|
37
46
|
"k6",
|
|
38
47
|
"cucumber",
|
|
@@ -59,7 +68,6 @@
|
|
|
59
68
|
"@babel/preset-env": "^7.27.2",
|
|
60
69
|
"@faker-js/faker": "^9.8.0",
|
|
61
70
|
"@types/k6": "^1.0.2",
|
|
62
|
-
"axios": "^1.10.0",
|
|
63
71
|
"dotenv": "^16.5.0",
|
|
64
72
|
"html-minifier-terser": "^7.2.0",
|
|
65
73
|
"yargs": "^18.0.0"
|
package/scripts/linkReports.js
CHANGED
|
@@ -1,69 +1,62 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
+
const { minify } = require("html-minifier-terser");
|
|
3
4
|
|
|
4
5
|
const reportsDir = path.resolve("reports");
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
* Finds the first file that looks like a Cucumber HTML report.
|
|
8
|
-
*/
|
|
9
|
-
function findCucumberReportFile() {
|
|
10
|
-
const files = fs.readdirSync(reportsDir);
|
|
11
|
-
return files.find((f) => f.includes("cucumber") && f.endsWith(".html"));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Adds a Cucumber report tab as an iframe.
|
|
16
|
-
*/
|
|
17
|
-
function addLinksToReport(targetFile, cucumberFileName) {
|
|
18
|
-
const content = fs.readFileSync(targetFile, "utf-8");
|
|
19
|
-
|
|
20
|
-
const cucumberTab = `
|
|
21
|
-
<input type="radio" name="tabs" id="tabcucumber">
|
|
22
|
-
<label for="tabcucumber"><i class="fas fa-file-alt"></i> Cucumber Report</label>
|
|
23
|
-
<div class="tab">
|
|
24
|
-
${
|
|
25
|
-
cucumberFileName
|
|
26
|
-
? `<iframe src="${cucumberFileName}" style="width:100%; min-height:600px; border:none;"></iframe>`
|
|
27
|
-
: `<p style="color:red; padding:1rem;">⚠️ Cucumber HTML report not found in <code>reports/</code> directory.</p>`
|
|
28
|
-
}
|
|
29
|
-
</div>
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const modifiedContent = content
|
|
33
|
-
.replace(
|
|
34
|
-
/<input type="radio" name="tabs" id="tabone"/,
|
|
35
|
-
`${cucumberTab}\n<input type="radio" name="tabs" id="tabone"`
|
|
36
|
-
)
|
|
37
|
-
.replace(/<div style="[^>]*margin-top:20px;[^>]*">[\s\S]*?<\/div>/g, "");
|
|
38
|
-
|
|
39
|
-
fs.writeFileSync(targetFile, modifiedContent, "utf-8");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Adds a Cucumber tab to every K6 HTML report found in /reports.
|
|
44
|
-
*/
|
|
45
|
-
function linkReports() {
|
|
7
|
+
async function linkReports() {
|
|
46
8
|
if (!fs.existsSync(reportsDir)) {
|
|
47
9
|
console.warn("⚠️ No reports directory found.");
|
|
48
10
|
return;
|
|
49
11
|
}
|
|
50
12
|
|
|
51
|
-
const cucumberFile = findCucumberReportFile();
|
|
52
|
-
|
|
53
13
|
const htmlFiles = fs
|
|
54
14
|
.readdirSync(reportsDir)
|
|
55
|
-
.filter((f) =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
15
|
+
.filter((f) => f.endsWith(".html"));
|
|
16
|
+
const k6ReportFile = htmlFiles.find(
|
|
17
|
+
(f) => f.startsWith("k6-report") && f.endsWith(".html")
|
|
18
|
+
);
|
|
19
|
+
const cucumberReportFile = htmlFiles.find((f) =>
|
|
20
|
+
f.includes("cucumber-report")
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (!k6ReportFile || !cucumberReportFile) {
|
|
24
|
+
console.warn("⚠️ K6 or Cucumber HTML report not found.");
|
|
59
25
|
return;
|
|
60
26
|
}
|
|
61
27
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
28
|
+
const k6Path = path.join(reportsDir, k6ReportFile);
|
|
29
|
+
const cucumberPath = path.basename(cucumberReportFile);
|
|
30
|
+
let content = fs.readFileSync(k6Path, "utf8");
|
|
31
|
+
|
|
32
|
+
const cucumberTab = `
|
|
33
|
+
<input type="radio" name="tabs" id="tabcucumber">
|
|
34
|
+
<label for="tabcucumber"><i class="fas fa-file-alt"></i> Cucumber Report</label>
|
|
35
|
+
<div class="tab">
|
|
36
|
+
<iframe src="${cucumberPath}" style="width:100%; height:600px; border:none;"></iframe>
|
|
37
|
+
</div>
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
content = content.replace(
|
|
41
|
+
/<input type="radio" name="tabs" id="tabone"/,
|
|
42
|
+
`${cucumberTab}\n<input type="radio" name="tabs" id="tabone"`
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
content = content.replace(
|
|
46
|
+
/<div style="padding:10px;margin-top:20px;text-align:center">[\s\S]*?<\/div>/,
|
|
47
|
+
""
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const minified = await minify(content, {
|
|
51
|
+
collapseWhitespace: true,
|
|
52
|
+
removeComments: true,
|
|
53
|
+
minifyCSS: true,
|
|
66
54
|
});
|
|
55
|
+
|
|
56
|
+
const combinedPath = path.join(reportsDir, "combined-report.html");
|
|
57
|
+
fs.writeFileSync(combinedPath, minified, "utf8");
|
|
58
|
+
|
|
59
|
+
console.log(`📄 Combined report generated at: ${combinedPath}`);
|
|
67
60
|
}
|
|
68
61
|
|
|
69
62
|
module.exports = { linkReports };
|
|
@@ -9,7 +9,6 @@ const buildK6Script = require("../lib/helpers/buildK6Script.js");
|
|
|
9
9
|
const generateHeaders = require("../lib/helpers/generateHeaders.js");
|
|
10
10
|
const { generateK6Script, runK6Script } = require("../lib/utils/k6Runner.js");
|
|
11
11
|
require("dotenv").config();
|
|
12
|
-
const axios = require("axios");
|
|
13
12
|
|
|
14
13
|
// Validate thresholds (e.g., "rate<0.01")
|
|
15
14
|
const validateThreshold = (threshold) => {
|
|
@@ -278,17 +277,22 @@ When(
|
|
|
278
277
|
});
|
|
279
278
|
|
|
280
279
|
try {
|
|
281
|
-
const response = await
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
);
|
|
280
|
+
const response = await fetch(`${process.env.BASE_URL}${endpoint}`, {
|
|
281
|
+
method: "POST",
|
|
282
|
+
headers: {
|
|
283
|
+
"Content-Type": "application/json",
|
|
284
|
+
},
|
|
285
|
+
body: JSON.stringify(resolved),
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const data = await response.json();
|
|
289
|
+
|
|
290
|
+
if (!response.ok) {
|
|
291
|
+
console.error("❌ Login request failed:", data);
|
|
292
|
+
throw new Error(`Login request failed with status ${response.status}`);
|
|
293
|
+
}
|
|
290
294
|
|
|
291
|
-
this.lastResponse =
|
|
295
|
+
this.lastResponse = data; // ✅ Makes aliasing work
|
|
292
296
|
console.log("🔐 Login successful, response saved to alias context.");
|
|
293
297
|
} catch (err) {
|
|
294
298
|
console.error("❌ Login request failed:", err.message);
|
package/.env
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
NODE_ENV=sandbox
|
|
2
|
-
POSTMAN_ENV=test
|
|
3
|
-
APP_ENVIRONMENT=development
|
|
4
|
-
|
|
5
|
-
POSTMAN_COLLECTION_URL='https://api.getpostman.com/collections/21022247-5a73af48-e8b9-4aa3-a55d-a352517404bf'
|
|
6
|
-
POSTMAN_ENVIRONMENT_URL='https://api.getpostman.com/environments/21022247-fdb96b14-4bd7-4e5b-8bec-c39f95c8fa0d'
|
|
7
|
-
POSTMAN_ENVIRONMENT_URL_STAGE='https://api.getpostman.com/environments/21022247-fdb96b14-4bd7-4e5b-8bec-c39f95c8fa0d'
|
|
8
|
-
POSTMAN_ENVIRONMENT_URL_SANDBOX=https://api.getpostman.com/environments/26431315-6e705dea-3f42-4fda-a8a0-cdea63dac91d
|
|
9
|
-
POSTMAN_ENVIRONMENT_URL_PROD=https://api.getpostman.com/environments/26431315-6e705dea-3f42-4fda-a8a0-cdea63dac91d
|
|
10
|
-
# SLACK_WEBHOOK_URL-stage=https://hooks.slack.com/services/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
|
|
11
|
-
# SLACK_WEBHOOK_URL='https://hooks.slack.com/services/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'
|
|
12
|
-
POSTMAN_API_KEY='PMAK-655f12ee88ca96002a53ce0e-f91a566c91b8b88e9f17cb460347cd6a47'
|
|
13
|
-
21022247-5a73af48-e8b9-4aa3-a55d-a352517404bf
|
|
14
|
-
21022247-fdb96b14-4bd7-4e5b-8bec-c39f95c8fa0d
|
|
15
|
-
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/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
|
|
16
|
-
WEB_URL='https://sandbox-decide.indicina.net/'
|
|
17
|
-
# WEB_URL=https://decide.indicina.co/
|
|
18
|
-
# CYPRESS_TAGS='@regression'
|
|
19
|
-
# CYPRESS_TAGS='@sanity'
|
|
20
|
-
|
|
21
|
-
# API_BASE_URL=https://sandbox-decide-api.indicina.net
|
|
22
|
-
BASE_URL=https://sandbox-decide-api.indicina.net
|
|
23
|
-
USER_EMAIL=product.indicina@yopmail.com
|
|
24
|
-
USER_PASSWORD=1Password@
|
|
25
|
-
# USER_EMAIL= product.tester@indicina.co
|
|
26
|
-
# USER_PASSWORD=?Indicina123
|
|
27
|
-
CLIENT_SECRET_PROD=AHP84J7-KJJMSJ3-NAH3NWE-JEWSEA0
|
|
28
|
-
SLUG=indicina
|
|
29
|
-
ACCOUNT_TYPE=ACCOUNT_TYPE_MERCHANT
|
|
30
|
-
CLIENT_SECRET=MD5Y106-RYG4STY-H3B33FS-CRS5AMG
|
|
31
|
-
CLIENT_ID=indicina
|
|
32
|
-
CUSTOMER_ID_PROD=3a39b1c0-a725-48cf-8c44-1298d3c399a6
|
|
33
|
-
CUSTOMER_ID_SANDBOX=f7cbfe40-2330-11ef-8a77-025b06f85973
|
|
34
|
-
|
|
35
|
-
TEAMS_WEBHOOK_URL= https://seamlesshrsuite.webhook.office.com/webhookb2/51bb6663-5d8e-4c68-bfc6-f01e24999c3a@45908be8-ba32-466d-ac1f-8fb319a24cba/IncomingWebhook/ef5fd5b0a6be4e05a2b0943968c40429/04c7e600-d01e-41f8-9298-d38d80577410/V28Cgsd2MwRXM7LxjM-cLtSMm0QuwZm27DPq7sXeK2q9c1
|
|
36
|
-
# GITHUB_RUN_ID= tests_webhook
|
|
37
|
-
# TEAMS_WEBHOOK_URL=https://seamlesshrsuite.webhook.office.com/webhookb2/58ab15f8-c6a7-44ec-b1ad-e437c707ed73@45908be8-ba32-466d-ac1f-8fb319a24cba/IncomingWebhook/59a3b2b15f254f24a822ec6b0452f670/04c7e600-d01e-41f8-9298-d38d80577410/V2idCGcJwnS_VqKep-2Hmx5rZosVRByQrvMV2Yxh22lM81
|
|
38
|
-
REPORT_URL="http://localhost:5500/cypress-ms-teams-reporter/cypress/reports/html/index.html"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
name: build
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
release:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
permissions:
|
|
10
|
-
contents: write
|
|
11
|
-
strategy:
|
|
12
|
-
matrix:
|
|
13
|
-
node-version: [lts/*]
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
18
|
-
uses: actions/setup-node@v4
|
|
19
|
-
with:
|
|
20
|
-
node-version: ${{ matrix.node-version }}
|
|
21
|
-
cache: "npm"
|
|
22
|
-
registry-url: "https://registry.npmjs.org"
|
|
23
|
-
- name: Install Dependencies
|
|
24
|
-
run: npm install
|
|
25
|
-
- name: Configure Git for Commit
|
|
26
|
-
run: |
|
|
27
|
-
git config --global user.email "paschal.enyimiri@gmail.com"
|
|
28
|
-
git config --global user.name "Paschal Enyimiri"
|
|
29
|
-
- name: Add changes
|
|
30
|
-
run: git add .
|
|
31
|
-
- name: Commit changes
|
|
32
|
-
run: git commit -m "chore:Automated changes before versioning" || echo "No changes to commit"
|
|
33
|
-
- name: Set new version as patch and create commit
|
|
34
|
-
run: npm version patch
|
|
35
|
-
- name: Check new version
|
|
36
|
-
run: echo "New version is $(npm pkg get version)"
|
|
37
|
-
- name: Push changes
|
|
38
|
-
run: git push --follow-tags
|
|
39
|
-
- name: Publish to npm
|
|
40
|
-
run: npm publish
|
|
41
|
-
env:
|
|
42
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.vscode/extensions.json
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cucumber.features": [
|
|
3
|
-
"src/features/*.feature",
|
|
4
|
-
"src/features/**/*.feature",
|
|
5
|
-
"src/features/**/*.k6.feature",
|
|
6
|
-
"src/features/template/*.feature"
|
|
7
|
-
],
|
|
8
|
-
"cucumber.glue": [
|
|
9
|
-
"step_definitions/*.js",
|
|
10
|
-
"src/features/stepDefinitions/*.js"
|
|
11
|
-
],
|
|
12
|
-
"liveServer.settings.port": 5501,
|
|
13
|
-
"git.ignoreLimitWarning": true
|
|
14
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cucumber.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
default: {
|
|
3
|
-
require: ["./step_definitions/**/*.js"],
|
|
4
|
-
format: [
|
|
5
|
-
"summary",
|
|
6
|
-
"json:./reports/load-report.json",
|
|
7
|
-
"html:./reports/cucumber-report.html",
|
|
8
|
-
],
|
|
9
|
-
paths: ["./features/bsp.feature"],
|
|
10
|
-
tags: "@get",
|
|
11
|
-
worldParameters: {
|
|
12
|
-
payloadPath: "payloads",
|
|
13
|
-
},
|
|
14
|
-
overwrite: true,
|
|
15
|
-
reporter: true,
|
|
16
|
-
},
|
|
17
|
-
};
|