k6-cucumber-steps 1.1.1 → 1.1.2

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/.env ADDED
@@ -0,0 +1,38 @@
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"
@@ -3,7 +3,8 @@
3
3
  const path = require("path");
4
4
  const fs = require("fs");
5
5
  const { spawn } = require("child_process");
6
- const yargs = require("yargs");
6
+ const yargs = require("yargs/yargs"); // Use the correct import for yargs
7
+ const { hideBin } = require("yargs/helpers"); // Helper to parse CLI arguments
7
8
  require("dotenv").config();
8
9
  const { generateHtmlReports } = require("../scripts/generateHtmlReports");
9
10
  const { linkReports } = require("../scripts/linkReports");
@@ -14,7 +15,7 @@ console.log(`
14
15
  -----------------------------------------
15
16
  `);
16
17
 
17
- const argv = yargs
18
+ const argv = yargs(hideBin(process.argv))
18
19
  .usage("Usage: $0 run [options]")
19
20
  .option("feature", {
20
21
  alias: "f",
@@ -97,7 +98,6 @@ if (configOptions.require && Array.isArray(configOptions.require)) {
97
98
 
98
99
  // Determine base report name
99
100
  const reportsDir = path.join(process.cwd(), "reports");
100
- // Clean and prepare reports directory
101
101
  const cleanReportsDir = () => {
102
102
  if (fs.existsSync(reportsDir)) {
103
103
  try {
@@ -136,12 +136,16 @@ const shouldOverwrite =
136
136
  process.env.K6_CUCUMBER_OVERWRITE === "true" ||
137
137
  configOptions.overwrite === true;
138
138
 
139
- let reportJsonPath = path.join(reportsDir, `${baseReportName}.json`);
139
+ let reportJsonPath = "reports/load-report.json";
140
140
  let reportHtmlPath = path.join(reportsDir, `${baseReportName}.html`);
141
141
 
142
- if (!shouldOverwrite) {
143
- reportJsonPath = path.join(reportsDir, `${baseReportName}-${timestamp}.json`);
144
- reportHtmlPath = path.join(reportsDir, `${baseReportName}-${timestamp}.html`);
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
+ }
145
149
  }
146
150
 
147
151
  const formatInConfig =
@@ -169,25 +173,38 @@ const cucumberProcess = spawn("npx", cucumberArgs, {
169
173
  },
170
174
  });
171
175
 
172
- cucumberProcess.on("close", (code) => {
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
+ cucumberProcess.on("close", async (code) => {
173
193
  if (code === 0) {
174
194
  console.log("-----------------------------------------");
175
195
  console.log("✅ k6-cucumber-steps execution completed successfully.");
176
196
 
177
- generateHtmlReports(); // Cucumber HTML
197
+ generateHtmlReports(); // 🍋 Cucumber HTML
198
+
178
199
  console.log(
179
200
  "🚀 Cucumber HTML report reports/cucumber-report.html generated successfully 👍"
180
201
  );
181
202
 
182
- const k6ReportPath = detectMostRecentK6Report(); // Add this helper function
183
- if (k6ReportPath) {
184
- console.log(
185
- `📄 K6 HTML report ${k6ReportPath} generated successfully 👍`
186
- );
187
- }
188
-
189
- linkReports(); // Link both reports
203
+ await linkReports(); // 🧬 Combine and link reports
190
204
 
205
+ console.log(
206
+ "📦 Combined and minified HTML report available at: reports/combined-report.html"
207
+ );
191
208
  console.log("-----------------------------------------");
192
209
  } else {
193
210
  console.error("-----------------------------------------");
package/cucumber.js CHANGED
@@ -1,15 +1,15 @@
1
1
  module.exports = {
2
2
  default: {
3
- // require: ["./step_definitions/**/*.js"],
3
+ require: ["./step_definitions/**/*.js"],
4
4
  format: [
5
5
  "summary",
6
6
  "json:./reports/load-report.json",
7
7
  "html:./reports/cucumber-report.html",
8
8
  ],
9
9
  paths: ["./features/bsp.feature"],
10
- tags: "@load",
10
+ tags: "@rate-limit",
11
11
  worldParameters: {
12
- payloadPath: "src/examples/payloads",
12
+ payloadPath: "payloads",
13
13
  },
14
14
  overwrite: true,
15
15
  reporter: true,
@@ -68,10 +68,23 @@ export default function () {
68
68
 
69
69
  export function handleSummary(data) {
70
70
  const outputDir = __ENV.REPORT_OUTPUT_DIR || "reports";
71
+ const html = htmlReport(data);
72
+ const cucumberReportFile = "cucumber-report.html";
73
+ const cucumberLink = \`
74
+ <div style="text-align:center; margin-top:20px;">
75
+ <a href="\${cucumberReportFile}" style="font-size:18px; color:#0066cc;">
76
+ 🔗 View Cucumber Test Report
77
+ </a>
78
+ </div>
79
+ \`;
80
+
71
81
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
72
- const filename = \`\${outputDir}/k6-report-\${timestamp}.html\`;
82
+ const k6ReportFilename = \`\${outputDir}/k6-report-\${timestamp}.html\`;
83
+
84
+ console.log(\`📄 K6 HTML report \${k6ReportFilename} generated successfully 👍\`);
85
+
73
86
  return {
74
- [filename]: htmlReport(data),
87
+ [k6ReportFilename]: html.replace("</body>", \`\${cucumberLink}</body>\`),
75
88
  stdout: textSummary(data, { indent: " ", enableColors: true }),
76
89
  };
77
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k6-cucumber-steps",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -68,6 +68,7 @@
68
68
  "@faker-js/faker": "latest",
69
69
  "axios": "^1.9.0",
70
70
  "dotenv": "latest",
71
+ "html-minifier-terser": "^7.2.0",
71
72
  "yargs": "latest"
72
73
  }
73
74
  }