k6-cucumber-steps 1.1.3 → 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 +57 -132
- package/package.json +23 -19
- package/scripts/linkReports.js +41 -44
- 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 -13
- 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,12 +1,11 @@
|
|
|
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");
|
|
6
|
-
const yargs = require("yargs/yargs");
|
|
7
|
-
const { hideBin } = require("yargs/helpers");
|
|
5
|
+
const yargs = require("yargs/yargs");
|
|
6
|
+
const { hideBin } = require("yargs/helpers");
|
|
8
7
|
require("dotenv").config();
|
|
9
|
-
|
|
8
|
+
|
|
10
9
|
const { linkReports } = require("../scripts/linkReports");
|
|
11
10
|
|
|
12
11
|
console.log(`
|
|
@@ -16,145 +15,97 @@ console.log(`
|
|
|
16
15
|
`);
|
|
17
16
|
|
|
18
17
|
const argv = yargs(hideBin(process.argv))
|
|
19
|
-
.usage("Usage: $0 run [options]")
|
|
20
18
|
.option("feature", {
|
|
21
19
|
alias: "f",
|
|
22
|
-
describe: "Path to the feature file",
|
|
23
20
|
type: "string",
|
|
21
|
+
describe: "Feature file path",
|
|
24
22
|
})
|
|
25
|
-
.option("tags", {
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
.option("tags", { alias: "t", type: "string", describe: "Cucumber tags" })
|
|
24
|
+
.option("configFile", {
|
|
25
|
+
alias: "c",
|
|
28
26
|
type: "string",
|
|
27
|
+
describe: "Custom config file",
|
|
29
28
|
})
|
|
30
29
|
.option("reporter", {
|
|
31
30
|
alias: "r",
|
|
32
|
-
describe: "Enable HTML and JSON reports",
|
|
33
31
|
type: "boolean",
|
|
34
32
|
default: false,
|
|
33
|
+
describe: "Enable report generation",
|
|
35
34
|
})
|
|
36
35
|
.option("overwrite", {
|
|
37
36
|
alias: "o",
|
|
38
|
-
describe: "Overwrite existing reports",
|
|
39
37
|
type: "boolean",
|
|
40
38
|
default: false,
|
|
39
|
+
describe: "Overwrite report files",
|
|
41
40
|
})
|
|
42
|
-
.option("
|
|
43
|
-
alias: "
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
.option("cleanReports", {
|
|
42
|
+
alias: "clean",
|
|
43
|
+
type: "boolean",
|
|
44
|
+
describe: "Clean the reports folder before running",
|
|
46
45
|
})
|
|
47
46
|
.help().argv;
|
|
48
47
|
|
|
49
48
|
const cucumberArgs = ["cucumber-js"];
|
|
50
49
|
|
|
51
|
-
const
|
|
50
|
+
const configFileInput =
|
|
52
51
|
argv.configFile || process.env.CUCUMBER_CONFIG_FILE || "cucumber.js";
|
|
53
|
-
const configFilePath = path.
|
|
52
|
+
const configFilePath = path.isAbsolute(configFileInput)
|
|
53
|
+
? configFileInput
|
|
54
|
+
: path.resolve(process.cwd(), configFileInput);
|
|
54
55
|
|
|
55
56
|
let configOptions = {};
|
|
57
|
+
|
|
56
58
|
if (fs.existsSync(configFilePath)) {
|
|
57
|
-
cucumberArgs.push("--config",
|
|
59
|
+
cucumberArgs.push("--config", configFileInput);
|
|
58
60
|
try {
|
|
59
61
|
const loadedConfig = require(configFilePath);
|
|
60
62
|
configOptions = loadedConfig.default || loadedConfig;
|
|
61
|
-
} catch {
|
|
62
|
-
console.warn("⚠️
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.warn("⚠️ Could not load config file:", err.message);
|
|
63
65
|
}
|
|
66
|
+
} else {
|
|
67
|
+
console.warn(`⚠️ Config file not found at ${configFilePath}`);
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
//
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
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 });
|
|
70
88
|
}
|
|
71
89
|
|
|
72
|
-
//
|
|
90
|
+
// Build featureFiles array before using it
|
|
73
91
|
let featureFiles = [];
|
|
74
92
|
if (argv.feature) {
|
|
75
93
|
featureFiles.push(path.resolve(argv.feature));
|
|
76
|
-
} else if (
|
|
77
|
-
featureFiles
|
|
94
|
+
} else if (Array.isArray(configOptions.paths)) {
|
|
95
|
+
featureFiles = configOptions.paths.map((f) => path.resolve(f));
|
|
78
96
|
}
|
|
79
|
-
if (featureFiles.length > 0) {
|
|
80
|
-
cucumberArgs.push(...featureFiles);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Require default step definitions
|
|
84
|
-
const defaultStepsPath = path.resolve(
|
|
85
|
-
process.cwd(),
|
|
86
|
-
"node_modules",
|
|
87
|
-
"k6-cucumber-steps",
|
|
88
|
-
"step_definitions"
|
|
89
|
-
);
|
|
90
|
-
cucumberArgs.push("--require", defaultStepsPath);
|
|
91
|
-
|
|
92
|
-
// Also require additional custom step definitions from config, if any
|
|
93
|
-
if (configOptions.require && Array.isArray(configOptions.require)) {
|
|
94
|
-
for (const reqPath of configOptions.require) {
|
|
95
|
-
cucumberArgs.push("--require", reqPath);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Determine base report name
|
|
100
|
-
const reportsDir = path.join(process.cwd(), "reports");
|
|
101
|
-
const cleanReportsDir = () => {
|
|
102
|
-
if (fs.existsSync(reportsDir)) {
|
|
103
|
-
try {
|
|
104
|
-
fs.rmSync(reportsDir, { recursive: true, force: true });
|
|
105
|
-
console.log("🧹 Cleaned existing reports directory.");
|
|
106
|
-
} catch (err) {
|
|
107
|
-
console.error("❌ Failed to clean reports directory:", err.message);
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
fs.mkdirSync(reportsDir, { recursive: true });
|
|
114
|
-
console.log("📁 Created fresh reports directory.");
|
|
115
|
-
} catch (err) {
|
|
116
|
-
console.error("❌ Failed to create reports directory:", err.message);
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
cleanReportsDir();
|
|
122
|
-
|
|
123
|
-
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
124
97
|
|
|
125
98
|
let baseReportName = "load-report";
|
|
126
99
|
if (featureFiles.length === 1) {
|
|
127
|
-
|
|
128
|
-
baseReportName = nameFromFeature || baseReportName;
|
|
100
|
+
baseReportName = path.basename(featureFiles[0], ".feature");
|
|
129
101
|
} else if (featureFiles.length > 1) {
|
|
130
102
|
baseReportName = "multi-feature";
|
|
131
103
|
}
|
|
104
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
105
|
+
let reportHtmlPath = path.join(reportsDir, `cucumber-report.html`);
|
|
132
106
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
argv.overwrite ||
|
|
136
|
-
process.env.K6_CUCUMBER_OVERWRITE === "true" ||
|
|
137
|
-
configOptions.overwrite === true;
|
|
138
|
-
|
|
139
|
-
let reportJsonPath = "reports/load-report.json";
|
|
140
|
-
let reportHtmlPath = path.join(reportsDir, `${baseReportName}.html`);
|
|
141
|
-
|
|
142
|
-
// 🆕 Respect config format path if defined
|
|
143
|
-
if (Array.isArray(configOptions.format)) {
|
|
144
|
-
const jsonFmt = configOptions.format.find((f) => f.startsWith("json:"));
|
|
145
|
-
if (jsonFmt) {
|
|
146
|
-
reportJsonPath = jsonFmt.split("json:")[1];
|
|
147
|
-
console.log(`📝 Using report path from config: ${reportJsonPath}`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const formatInConfig =
|
|
152
|
-
Array.isArray(configOptions.format) && configOptions.format.length > 0;
|
|
153
|
-
|
|
154
|
-
if (shouldGenerateReports && !formatInConfig) {
|
|
155
|
-
fs.mkdirSync(reportsDir, { recursive: true });
|
|
156
|
-
cucumberArgs.push("--format", `summary`);
|
|
157
|
-
cucumberArgs.push("--format", `json:${reportJsonPath}`);
|
|
107
|
+
if (argv.reporter && !Array.isArray(configOptions.format)) {
|
|
108
|
+
cucumberArgs.push("--format", "summary");
|
|
158
109
|
cucumberArgs.push("--format", `html:${reportHtmlPath}`);
|
|
159
110
|
}
|
|
160
111
|
|
|
@@ -165,52 +116,26 @@ const cucumberProcess = spawn("npx", cucumberArgs, {
|
|
|
165
116
|
stdio: "inherit",
|
|
166
117
|
env: {
|
|
167
118
|
...process.env,
|
|
168
|
-
K6_CUCUMBER_OVERWRITE: shouldOverwrite ? "true" : "false",
|
|
169
|
-
TAGS: tags,
|
|
170
|
-
FEATURE_PATH: featureFiles.join(","),
|
|
171
|
-
REPORT_JSON_PATH: reportJsonPath,
|
|
172
119
|
REPORT_HTML_PATH: reportHtmlPath,
|
|
120
|
+
K6_CUCUMBER_OVERWRITE: argv.overwrite ? "true" : "false",
|
|
173
121
|
},
|
|
174
122
|
});
|
|
175
123
|
|
|
176
|
-
function detectMostRecentK6Report() {
|
|
177
|
-
const reportsDir = path.join(process.cwd(), "reports");
|
|
178
|
-
if (!fs.existsSync(reportsDir)) return null;
|
|
179
|
-
|
|
180
|
-
const files = fs
|
|
181
|
-
.readdirSync(reportsDir)
|
|
182
|
-
.filter((file) => /^k6-report.*\.html$/.test(file))
|
|
183
|
-
.map((file) => ({
|
|
184
|
-
name: file,
|
|
185
|
-
time: fs.statSync(path.join(reportsDir, file)).mtime.getTime(),
|
|
186
|
-
}))
|
|
187
|
-
.sort((a, b) => b.time - a.time);
|
|
188
|
-
|
|
189
|
-
return files.length > 0 ? path.join("reports", files[0].name) : null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
124
|
cucumberProcess.on("close", async (code) => {
|
|
193
125
|
if (code === 0) {
|
|
194
126
|
console.log("-----------------------------------------");
|
|
195
127
|
console.log("✅ k6-cucumber-steps execution completed successfully.");
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
await linkReports(); // 🧬 Combine and link reports
|
|
204
|
-
|
|
205
|
-
console.log(
|
|
206
|
-
"📦 Combined and minified HTML report available at: reports/combined-report.html"
|
|
207
|
-
);
|
|
128
|
+
try {
|
|
129
|
+
await linkReports();
|
|
130
|
+
console.log("🔗 Reports linked successfully with embedded Cucumber tab.");
|
|
131
|
+
} catch (err) {
|
|
132
|
+
console.error("⚠️ Failed to link reports:", err.message);
|
|
133
|
+
}
|
|
208
134
|
console.log("-----------------------------------------");
|
|
209
135
|
} else {
|
|
210
136
|
console.error("-----------------------------------------");
|
|
211
137
|
console.error("❌ k6-cucumber-steps execution failed.");
|
|
212
138
|
console.error("-----------------------------------------");
|
|
213
139
|
}
|
|
214
|
-
|
|
215
140
|
process.exit(code);
|
|
216
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",
|
|
@@ -49,26 +58,21 @@
|
|
|
49
58
|
},
|
|
50
59
|
"author": "qaPaschalE",
|
|
51
60
|
"description": "Cucumber step definitions for running k6 performance tests.",
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@cucumber/cucumber": "*",
|
|
63
|
+
"k6": "*"
|
|
64
|
+
},
|
|
52
65
|
"devDependencies": {
|
|
53
|
-
"@babel/cli": "
|
|
54
|
-
"@babel/core": "
|
|
55
|
-
"@babel/preset-env": "
|
|
56
|
-
"@
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"form-data": "latest",
|
|
62
|
-
"k6": "latest",
|
|
63
|
-
"tsconfig-paths": "latest"
|
|
66
|
+
"@babel/cli": "^7.27.2",
|
|
67
|
+
"@babel/core": "^7.27.4",
|
|
68
|
+
"@babel/preset-env": "^7.27.2",
|
|
69
|
+
"@faker-js/faker": "^9.8.0",
|
|
70
|
+
"@types/k6": "^1.0.2",
|
|
71
|
+
"dotenv": "^16.5.0",
|
|
72
|
+
"html-minifier-terser": "^7.2.0",
|
|
73
|
+
"yargs": "^18.0.0"
|
|
64
74
|
},
|
|
65
75
|
"dependencies": {
|
|
66
|
-
"@babel/register": "
|
|
67
|
-
"@cucumber/cucumber": "latest",
|
|
68
|
-
"@faker-js/faker": "latest",
|
|
69
|
-
"axios": "^1.9.0",
|
|
70
|
-
"dotenv": "latest",
|
|
71
|
-
"html-minifier-terser": "^7.2.0",
|
|
72
|
-
"yargs": "latest"
|
|
76
|
+
"@babel/register": "^7.27.1"
|
|
73
77
|
}
|
|
74
78
|
}
|
package/scripts/linkReports.js
CHANGED
|
@@ -1,65 +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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
async function linkReports() {
|
|
8
|
+
if (!fs.existsSync(reportsDir)) {
|
|
9
|
+
console.warn("⚠️ No reports directory found.");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const htmlFiles = fs
|
|
14
|
+
.readdirSync(reportsDir)
|
|
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.");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const k6Path = path.join(reportsDir, k6ReportFile);
|
|
29
|
+
const cucumberPath = path.basename(cucumberReportFile);
|
|
30
|
+
let content = fs.readFileSync(k6Path, "utf8");
|
|
11
31
|
|
|
12
|
-
// Inject the Cucumber Report tab before the Request Metrics tab
|
|
13
32
|
const cucumberTab = `
|
|
14
33
|
<input type="radio" name="tabs" id="tabcucumber">
|
|
15
34
|
<label for="tabcucumber"><i class="fas fa-file-alt"></i> Cucumber Report</label>
|
|
16
35
|
<div class="tab">
|
|
17
|
-
<iframe src="
|
|
36
|
+
<iframe src="${cucumberPath}" style="width:100%; height:600px; border:none;"></iframe>
|
|
18
37
|
</div>
|
|
19
38
|
`;
|
|
20
39
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
`${cucumberTab}\n<input type="radio" name="tabs" id="tabone"`
|
|
25
|
-
)
|
|
26
|
-
// Remove standalone links to cucumber-report.html or k6-report.html
|
|
27
|
-
.replace(
|
|
28
|
-
/<div style="padding:10px;margin-top:20px;text-align:center">[\s\S]*?View (Cucumber|k6).*?<\/div>/,
|
|
29
|
-
""
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
fs.writeFileSync(targetFile, modifiedContent, "utf-8");
|
|
33
|
-
console.log(
|
|
34
|
-
`🔗 Updated ${path.basename(
|
|
35
|
-
targetFile
|
|
36
|
-
)} with Cucumber tab and removed standalone links.`
|
|
40
|
+
content = content.replace(
|
|
41
|
+
/<input type="radio" name="tabs" id="tabone"/,
|
|
42
|
+
`${cucumberTab}\n<input type="radio" name="tabs" id="tabone"`
|
|
37
43
|
);
|
|
38
|
-
}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (!fs.existsSync(reportsDir)) {
|
|
45
|
-
console.warn("⚠️ No reports directory found.");
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
45
|
+
content = content.replace(
|
|
46
|
+
/<div style="padding:10px;margin-top:20px;text-align:center">[\s\S]*?<\/div>/,
|
|
47
|
+
""
|
|
48
|
+
);
|
|
48
49
|
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const minified = await minify(content, {
|
|
51
|
+
collapseWhitespace: true,
|
|
52
|
+
removeComments: true,
|
|
53
|
+
minifyCSS: true,
|
|
54
|
+
});
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
56
|
+
const combinedPath = path.join(reportsDir, "combined-report.html");
|
|
57
|
+
fs.writeFileSync(combinedPath, minified, "utf8");
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
const others = htmlFiles.filter((f) => f !== file);
|
|
61
|
-
addLinksToReport(file, others);
|
|
62
|
-
}
|
|
59
|
+
console.log(`📄 Combined report generated at: ${combinedPath}`);
|
|
63
60
|
}
|
|
64
61
|
|
|
65
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,13 +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
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|