k6-cucumber-steps 1.0.38 → 1.0.39
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 +3 -0
- package/cucumber.js +3 -0
- package/package.json +1 -1
- package/step_definitions/load_test_steps.js +10 -4
package/README.md
CHANGED
|
@@ -124,6 +124,9 @@ Here's a step-by-step guide to using `k6-cucumber-steps` in your project:
|
|
|
124
124
|
],
|
|
125
125
|
paths: ["./features/*.feature"],
|
|
126
126
|
tags: process.env.TAGS,
|
|
127
|
+
worldParameters: {
|
|
128
|
+
payloadPath: "apps/qa/performance/payloads"
|
|
129
|
+
}
|
|
127
130
|
overwrite: false, // Default to not overwrite the report file
|
|
128
131
|
};
|
|
129
132
|
```
|
package/cucumber.js
CHANGED
package/package.json
CHANGED
|
@@ -156,9 +156,12 @@ When(
|
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const
|
|
159
|
+
const basePayloadPath =
|
|
160
|
+
this.parameters?.payloadPath || path.resolve(__dirname, "../../payloads");
|
|
161
|
+
const payloadPath = path.resolve(basePayloadPath, fileName);
|
|
162
|
+
|
|
160
163
|
if (!fs.existsSync(payloadPath)) {
|
|
161
|
-
throw new Error(`Payload file not found: ${
|
|
164
|
+
throw new Error(`Payload file not found: ${payloadPath}`);
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
const rawTemplate = fs.readFileSync(payloadPath, "utf-8");
|
|
@@ -185,6 +188,7 @@ When(
|
|
|
185
188
|
};
|
|
186
189
|
}
|
|
187
190
|
);
|
|
191
|
+
|
|
188
192
|
/**
|
|
189
193
|
* @param {string} authType - Authentication type (api_key, bearer_token, basic, none).
|
|
190
194
|
* @example
|
|
@@ -227,10 +231,12 @@ Then(
|
|
|
227
231
|
When(
|
|
228
232
|
"I login via POST to {string} with payload from {string}",
|
|
229
233
|
async function (endpoint, fileName) {
|
|
230
|
-
const
|
|
234
|
+
const basePayloadPath =
|
|
235
|
+
this.parameters?.payloadPath || path.resolve(__dirname, "../../payloads");
|
|
236
|
+
const payloadPath = path.resolve(basePayloadPath, fileName);
|
|
231
237
|
|
|
232
238
|
if (!fs.existsSync(payloadPath)) {
|
|
233
|
-
throw new Error(`Payload file not found: ${
|
|
239
|
+
throw new Error(`Payload file not found: ${payloadPath}`);
|
|
234
240
|
}
|
|
235
241
|
|
|
236
242
|
const rawTemplate = fs.readFileSync(payloadPath, "utf-8");
|