playwright-cucumber-ts-steps 1.0.1 → 1.0.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/README.md +195 -256
- package/dist/backend/actions/index.js +4 -0
- package/dist/backend/actions/interactions.js +23 -0
- package/dist/backend/actions/navigation.js +19 -0
- package/dist/backend/api/assertions.js +26 -0
- package/dist/backend/api/index.js +4 -0
- package/dist/backend/api/requests.js +24 -0
- package/dist/backend/api/state.js +15 -0
- package/dist/backend/assertions/expectVisible.js +8 -0
- package/dist/backend/assertions/index.js +5 -0
- package/dist/backend/assertions/pageState.js +25 -0
- package/dist/backend/assertions/text.js +20 -0
- package/dist/backend/assertions/visibility.js +20 -0
- package/dist/backend/auth/index.js +71 -0
- package/dist/backend/elements/alerts.js +21 -0
- package/dist/backend/elements/forms.js +59 -0
- package/dist/backend/elements/frames.js +25 -0
- package/dist/backend/elements/index.js +5 -0
- package/dist/core/registry.js +20 -0
- package/dist/core/runner.js +136 -0
- package/dist/index.js +10 -0
- package/dist/reporting/index.js +43 -0
- package/package.json +19 -101
- package/LICENSE +0 -21
- package/lib/actions/clickSteps.d.ts +0 -251
- package/lib/actions/clickSteps.js +0 -415
- package/lib/actions/cookieSteps.d.ts +0 -18
- package/lib/actions/cookieSteps.js +0 -93
- package/lib/actions/debugSteps.d.ts +0 -14
- package/lib/actions/debugSteps.js +0 -23
- package/lib/actions/elementFindSteps.d.ts +0 -668
- package/lib/actions/elementFindSteps.js +0 -931
- package/lib/actions/fillFormSteps.d.ts +0 -69
- package/lib/actions/fillFormSteps.js +0 -237
- package/lib/actions/index.d.ts +0 -11
- package/lib/actions/index.js +0 -28
- package/lib/actions/inputSteps.d.ts +0 -218
- package/lib/actions/inputSteps.js +0 -343
- package/lib/actions/interceptionSteps.d.ts +0 -169
- package/lib/actions/interceptionSteps.js +0 -291
- package/lib/actions/miscSteps.d.ts +0 -645
- package/lib/actions/miscSteps.js +0 -1061
- package/lib/actions/mouseSteps.d.ts +0 -143
- package/lib/actions/mouseSteps.js +0 -234
- package/lib/actions/scrollSteps.d.ts +0 -82
- package/lib/actions/scrollSteps.js +0 -123
- package/lib/actions/storageSteps.d.ts +0 -174
- package/lib/actions/storageSteps.js +0 -292
- package/lib/assertions/buttonAndTextVisibilitySteps.d.ts +0 -245
- package/lib/assertions/buttonAndTextVisibilitySteps.js +0 -401
- package/lib/assertions/cookieSteps.d.ts +0 -75
- package/lib/assertions/cookieSteps.js +0 -113
- package/lib/assertions/elementSteps.d.ts +0 -264
- package/lib/assertions/elementSteps.js +0 -388
- package/lib/assertions/formInputSteps.d.ts +0 -248
- package/lib/assertions/formInputSteps.js +0 -350
- package/lib/assertions/index.d.ts +0 -10
- package/lib/assertions/index.js +0 -27
- package/lib/assertions/interceptionRequestsSteps.d.ts +0 -353
- package/lib/assertions/interceptionRequestsSteps.js +0 -593
- package/lib/assertions/locationSteps.d.ts +0 -217
- package/lib/assertions/locationSteps.js +0 -310
- package/lib/assertions/roleTestIdSteps.d.ts +0 -159
- package/lib/assertions/roleTestIdSteps.js +0 -221
- package/lib/assertions/semanticSteps.d.ts +0 -176
- package/lib/assertions/semanticSteps.js +0 -252
- package/lib/assertions/storageSteps.d.ts +0 -149
- package/lib/assertions/storageSteps.js +0 -210
- package/lib/assertions/visualSteps.d.ts +0 -74
- package/lib/assertions/visualSteps.js +0 -209
- package/lib/custom_setups/loginHooks.d.ts +0 -1
- package/lib/custom_setups/loginHooks.js +0 -130
- package/lib/helpers/checkPeerDeps.d.ts +0 -1
- package/lib/helpers/checkPeerDeps.js +0 -19
- package/lib/helpers/compareSnapshots.d.ts +0 -6
- package/lib/helpers/compareSnapshots.js +0 -20
- package/lib/helpers/hooks.d.ts +0 -1
- package/lib/helpers/hooks.js +0 -210
- package/lib/helpers/utils/fakerUtils.d.ts +0 -1
- package/lib/helpers/utils/fakerUtils.js +0 -60
- package/lib/helpers/utils/index.d.ts +0 -4
- package/lib/helpers/utils/index.js +0 -20
- package/lib/helpers/utils/optionsUtils.d.ts +0 -24
- package/lib/helpers/utils/optionsUtils.js +0 -88
- package/lib/helpers/utils/resolveUtils.d.ts +0 -6
- package/lib/helpers/utils/resolveUtils.js +0 -72
- package/lib/helpers/utils/sessionUtils.d.ts +0 -3
- package/lib/helpers/utils/sessionUtils.js +0 -40
- package/lib/helpers/world.d.ts +0 -34
- package/lib/helpers/world.js +0 -110
- package/lib/iframes/frames.d.ts +0 -1
- package/lib/iframes/frames.js +0 -11
- package/lib/index.d.ts +0 -10
- package/lib/index.js +0 -28
- package/lib/register.d.ts +0 -1
- package/lib/register.js +0 -6
- package/src/actions/clickSteps.ts +0 -429
- package/src/actions/cookieSteps.ts +0 -95
- package/src/actions/debugSteps.ts +0 -21
- package/src/actions/elementFindSteps.ts +0 -961
- package/src/actions/fillFormSteps.ts +0 -270
- package/src/actions/index.ts +0 -12
- package/src/actions/inputSteps.ts +0 -354
- package/src/actions/interceptionSteps.ts +0 -325
- package/src/actions/miscSteps.ts +0 -1144
- package/src/actions/mouseSteps.ts +0 -256
- package/src/actions/scrollSteps.ts +0 -122
- package/src/actions/storageSteps.ts +0 -308
- package/src/assertions/buttonAndTextVisibilitySteps.ts +0 -436
- package/src/assertions/cookieSteps.ts +0 -131
- package/src/assertions/elementSteps.ts +0 -432
- package/src/assertions/formInputSteps.ts +0 -377
- package/src/assertions/index.ts +0 -11
- package/src/assertions/interceptionRequestsSteps.ts +0 -640
- package/src/assertions/locationSteps.ts +0 -315
- package/src/assertions/roleTestIdSteps.ts +0 -254
- package/src/assertions/semanticSteps.ts +0 -267
- package/src/assertions/storageSteps.ts +0 -250
- package/src/assertions/visualSteps.ts +0 -275
- package/src/custom_setups/loginHooks.ts +0 -154
- package/src/helpers/checkPeerDeps.ts +0 -19
- package/src/helpers/compareSnapshots.ts +0 -35
- package/src/helpers/hooks.ts +0 -212
- package/src/helpers/utils/fakerUtils.ts +0 -64
- package/src/helpers/utils/index.ts +0 -4
- package/src/helpers/utils/optionsUtils.ts +0 -104
- package/src/helpers/utils/resolveUtils.ts +0 -74
- package/src/helpers/utils/sessionUtils.ts +0 -36
- package/src/helpers/world.ts +0 -119
- package/src/iframes/frames.ts +0 -15
- package/src/index.ts +0 -18
- package/src/register.ts +0 -4
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.When_I_intercept_URL_and_stub_body = When_I_intercept_URL_and_stub_body;
|
|
4
|
-
exports.When_I_intercept_URL = When_I_intercept_URL;
|
|
5
|
-
exports.When_I_intercept_URL_and_stub_raw_body = When_I_intercept_URL_and_stub_raw_body;
|
|
6
|
-
exports.When_I_make_GET_request_to = When_I_make_GET_request_to;
|
|
7
|
-
exports.When_I_make_POST_request_with_JSON_body = When_I_make_POST_request_with_JSON_body;
|
|
8
|
-
exports.When_I_make_HTTP_request_with_options = When_I_make_HTTP_request_with_options;
|
|
9
|
-
// e2e/step_definitions/common/interceptionSteps.ts
|
|
10
|
-
const cucumber_1 = require("@cucumber/cucumber");
|
|
11
|
-
// =============================
|
|
12
|
-
// WHEN I INTERCEPT / STUB
|
|
13
|
-
// =============================
|
|
14
|
-
/**
|
|
15
|
-
* Intercepts a network request to the given URL and stubs its response body with the provided JSON.
|
|
16
|
-
* This step should be used *before* the action that triggers the request (e.g., navigating to a page
|
|
17
|
-
* or clicking a button that makes an API call).
|
|
18
|
-
*
|
|
19
|
-
* ```gherkin
|
|
20
|
-
* When I intercept URL {string} and stub body:
|
|
21
|
-
* """
|
|
22
|
-
* { "foo": "bar" }
|
|
23
|
-
* """
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @param url - The URL to intercept. This can be a full URL, a URL glob, or a regular expression string.
|
|
27
|
-
* @param body - A DocString containing the JSON string to use as the response body.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* Scenario: Stubbing an API response
|
|
31
|
-
* When I intercept URL "https://api.example.com/data" and stub body:
|
|
32
|
-
* """
|
|
33
|
-
* { "status": "success", "items": ["item1", "item2"] }
|
|
34
|
-
* """
|
|
35
|
-
* And I go to "/dashboard"
|
|
36
|
-
* Then I should see text "item1"
|
|
37
|
-
*
|
|
38
|
-
* @remarks
|
|
39
|
-
* The intercepted request will respond with a `200 OK` status and a `Content-Type` of `application/json`.
|
|
40
|
-
* The `body` provided must be valid JSON. Playwright's `page.route()` is used internally.
|
|
41
|
-
* Make sure this step executes *before* the network request is initiated.
|
|
42
|
-
* @category Network Interception Steps
|
|
43
|
-
*/
|
|
44
|
-
async function When_I_intercept_URL_and_stub_body(url, body) {
|
|
45
|
-
let parsedBody;
|
|
46
|
-
try {
|
|
47
|
-
parsedBody = JSON.parse(body);
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
51
|
-
throw new Error(`Failed to parse JSON body for URL "${url}": ${message}. Please provide valid JSON.`);
|
|
52
|
-
}
|
|
53
|
-
await this.page.route(url, (route) => {
|
|
54
|
-
route.fulfill({
|
|
55
|
-
status: 200,
|
|
56
|
-
contentType: "application/json",
|
|
57
|
-
body: JSON.stringify(parsedBody),
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
this.log?.(`📡 Intercepted and stubbed URL "${url}" with JSON body: ${JSON.stringify(parsedBody).slice(0, 100)}...`);
|
|
61
|
-
}
|
|
62
|
-
(0, cucumber_1.When)("I intercept URL {string} and stub body:", When_I_intercept_URL_and_stub_body);
|
|
63
|
-
/**
|
|
64
|
-
* Intercepts a network request to the given URL and allows it to continue unmodified.
|
|
65
|
-
* This can be useful for ensuring that specific requests are *not* blocked or for logging
|
|
66
|
-
* requests without altering their behavior.
|
|
67
|
-
*
|
|
68
|
-
* ```gherkin
|
|
69
|
-
* When I intercept URL {string}
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @param url - The URL to intercept. This can be a full URL, a URL glob, or a regular expression string.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* Scenario: Allowing a specific request to pass through
|
|
76
|
-
* When I intercept URL "https://analytics.example.com/*"
|
|
77
|
-
* And I go to "/dashboard"
|
|
78
|
-
* Then the page title should be "Dashboard"
|
|
79
|
-
*
|
|
80
|
-
* @remarks
|
|
81
|
-
* This step uses Playwright's `page.route()` with `route.continue()`. No changes are made
|
|
82
|
-
* to the request or its response. This is essentially a "monitor" step.
|
|
83
|
-
* @category Network Interception Steps
|
|
84
|
-
*/
|
|
85
|
-
async function When_I_intercept_URL(url) {
|
|
86
|
-
await this.page.route(url, async (route) => {
|
|
87
|
-
await route.continue();
|
|
88
|
-
});
|
|
89
|
-
this.log?.(`📡 Intercepted URL "${url}" and allowed it to continue.`);
|
|
90
|
-
}
|
|
91
|
-
(0, cucumber_1.When)("I intercept URL {string}", When_I_intercept_URL);
|
|
92
|
-
/**
|
|
93
|
-
* Intercepts a network request to the given URL and stubs its response body with a raw string.
|
|
94
|
-
* This is useful for returning non-JSON content or simple string responses.
|
|
95
|
-
*
|
|
96
|
-
* ```gherkin
|
|
97
|
-
* When I intercept URL {string} and stub body {string}
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @param url - The URL to intercept. This can be a full URL, a URL glob, or a regular expression string.
|
|
101
|
-
* @param body - The raw string content to use as the response body.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* Scenario: Stubbing a simple text response
|
|
105
|
-
* When I intercept URL "https://api.example.com/status" and stub body "OK"
|
|
106
|
-
* And I visit page with JS that fetches "/status"
|
|
107
|
-
* Then I should see text "OK"
|
|
108
|
-
*
|
|
109
|
-
* @remarks
|
|
110
|
-
* The intercepted request will respond with a `200 OK` status and a `Content-Type` of `application/json`
|
|
111
|
-
* by default (though the `body` is a raw string). If a different `contentType` is needed, consider
|
|
112
|
-
* using the `I intercept URL {string} and stub response with:` step if available, or extending this step.
|
|
113
|
-
* @category Network Interception Steps
|
|
114
|
-
*/
|
|
115
|
-
async function When_I_intercept_URL_and_stub_raw_body(url, body) {
|
|
116
|
-
await this.page.route(url, (route) => {
|
|
117
|
-
route.fulfill({
|
|
118
|
-
status: 200,
|
|
119
|
-
contentType: "application/json", // Defaulting to JSON, can be customized if needed
|
|
120
|
-
body,
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
this.log?.(`📡 Intercepted and stubbed URL "${url}" with raw body: "${body.slice(0, 100)}..."`);
|
|
124
|
-
}
|
|
125
|
-
(0, cucumber_1.When)("I intercept URL {string} and stub body {string}", When_I_intercept_URL_and_stub_raw_body);
|
|
126
|
-
// =============================
|
|
127
|
-
// WHEN I MAKE REQUEST
|
|
128
|
-
// =============================
|
|
129
|
-
/**
|
|
130
|
-
* Makes a GET request to the given URL and stores the response details (status and body)
|
|
131
|
-
* in the test context.
|
|
132
|
-
*
|
|
133
|
-
* ```gherkin
|
|
134
|
-
* When I make request to {string}
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* @param url - The URL to which the GET request will be made.
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* Scenario: Verify API endpoint status
|
|
141
|
-
* When I make request to "https://api.example.com/health"
|
|
142
|
-
* Then the last response status should be 200
|
|
143
|
-
* And the last response body should contain "healthy"
|
|
144
|
-
*
|
|
145
|
-
* @remarks
|
|
146
|
-
* The response object (including status and body) is stored in
|
|
147
|
-
* {@link CustomWorld.data.lastResponse | this.data.lastResponse}. Subsequent assertion steps
|
|
148
|
-
* can then access this data.
|
|
149
|
-
* @category API Request Steps
|
|
150
|
-
*/
|
|
151
|
-
async function When_I_make_GET_request_to(url) {
|
|
152
|
-
this.log?.(`⚡ Making GET request to "${url}"...`);
|
|
153
|
-
const response = await this.page.request.get(url);
|
|
154
|
-
const status = response.status();
|
|
155
|
-
const body = await response.text();
|
|
156
|
-
this.data.lastResponse = { status, body }; // Storing as an object for clarity
|
|
157
|
-
this.log?.(`✅ GET request to "${url}" completed. Status: ${status}. Body preview: ${body.slice(0, 100)}...`);
|
|
158
|
-
}
|
|
159
|
-
// Note: You had two steps "I make request to" and "I make a request to".
|
|
160
|
-
// I'm keeping one for clarity and suggesting the other is an alias if needed.
|
|
161
|
-
(0, cucumber_1.When)("I make request to {string}", When_I_make_GET_request_to);
|
|
162
|
-
(0, cucumber_1.When)("I make a request to {string}", When_I_make_GET_request_to); // Alias for consistency
|
|
163
|
-
/**
|
|
164
|
-
* Makes a POST request to the given URL with the provided JSON body and stores the response details.
|
|
165
|
-
*
|
|
166
|
-
* ```gherkin
|
|
167
|
-
* When I make a POST request to {string} with JSON body:
|
|
168
|
-
* """
|
|
169
|
-
* { "username": "user", "password": "pass" }
|
|
170
|
-
* """
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
* @param url - The URL to which the POST request will be made.
|
|
174
|
-
* @param docString - A Cucumber DocString containing the JSON payload for the request body.
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* Scenario: Login via API
|
|
178
|
-
* When I make a POST request to "https://api.example.com/login" with JSON body:
|
|
179
|
-
* """
|
|
180
|
-
* { "email": "test@example.com", "password": "password123" }
|
|
181
|
-
* """
|
|
182
|
-
* Then the last response status should be 200
|
|
183
|
-
* And the last response body should contain "token"
|
|
184
|
-
*
|
|
185
|
-
* @remarks
|
|
186
|
-
* The `docString` must contain valid JSON. The request will have a `Content-Type` of `application/json`.
|
|
187
|
-
* The response object (including status and body) is stored in
|
|
188
|
-
* {@link CustomWorld.data.lastResponse | this.data.lastResponse}.
|
|
189
|
-
* @category API Request Steps
|
|
190
|
-
*/
|
|
191
|
-
async function When_I_make_POST_request_with_JSON_body(url, docString) {
|
|
192
|
-
let payload;
|
|
193
|
-
try {
|
|
194
|
-
payload = JSON.parse(docString);
|
|
195
|
-
}
|
|
196
|
-
catch (e) {
|
|
197
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
198
|
-
throw new Error(`Invalid JSON payload for POST request to "${url}": ${message}.`);
|
|
199
|
-
}
|
|
200
|
-
this.log?.(`⚡ Making POST request to "${url}" with payload: ${docString.slice(0, 100)}...`);
|
|
201
|
-
const response = await this.page.request.post(url, { data: payload });
|
|
202
|
-
const status = response.status();
|
|
203
|
-
const body = await response.text();
|
|
204
|
-
this.data.lastResponse = { status, body };
|
|
205
|
-
this.log?.(`✅ POST request to "${url}" completed. Status: ${status}. Body preview: ${body.slice(0, 100)}...`);
|
|
206
|
-
}
|
|
207
|
-
(0, cucumber_1.When)("I make a POST request to {string} with JSON body:", When_I_make_POST_request_with_JSON_body);
|
|
208
|
-
/**
|
|
209
|
-
* Makes a generic HTTP request with a specified method and optional headers/body from a data table.
|
|
210
|
-
*
|
|
211
|
-
* ```gherkin
|
|
212
|
-
* When I make a "{word}" request to {string}
|
|
213
|
-
* | header | value |
|
|
214
|
-
* | Content-Type | application/json |
|
|
215
|
-
* | ... | ... |
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* @param method - The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
|
|
219
|
-
* @param url - The URL for the request.
|
|
220
|
-
* @param table - (Optional) A Cucumber DataTable with `header` and `value` columns for headers,
|
|
221
|
-
* and a `body` row for the request body.
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
* Scenario: Make a PUT request with custom headers
|
|
225
|
-
* When I make a "PUT" request to "https://api.example.com/resource/123"
|
|
226
|
-
* | Content-Type | application/json |
|
|
227
|
-
* | Authorization | Bearer my-token |
|
|
228
|
-
* | body | { "status": "updated" } |
|
|
229
|
-
* Then the last response status should be 200
|
|
230
|
-
*
|
|
231
|
-
* @remarks
|
|
232
|
-
* This step constructs a `fetch` request using the provided method, URL, and options from the
|
|
233
|
-
* data table. The `body` provided in the data table (if any) will be automatically
|
|
234
|
-
* JSON.parsed and then JSON.stringified. The entire `Response` object from `fetch` is
|
|
235
|
-
* stored in {@link CustomWorld.data.lastResponse | this.data.lastResponse}.
|
|
236
|
-
*
|
|
237
|
-
* **Note on `fetch`:** This step uses the browser's `fetch` API, which runs in the browser context.
|
|
238
|
-
* If you need to make Node.js-based requests (e.g., for backend APIs that are not accessible from the browser),
|
|
239
|
-
* you might prefer `page.request` (as used in `When_I_make_GET_request_to` or `When_I_make_POST_request_with_JSON_body`).
|
|
240
|
-
* This step stores the raw `Response` object, so you might need to call `.json()` or `.text()`
|
|
241
|
-
* on `this.data.lastResponse` in subsequent steps if you need to assert on its content.
|
|
242
|
-
* @category API Request Steps
|
|
243
|
-
*/
|
|
244
|
-
async function When_I_make_HTTP_request_with_options(method, url, table) {
|
|
245
|
-
const options = {};
|
|
246
|
-
if (table) {
|
|
247
|
-
const rows = table.rows();
|
|
248
|
-
rows.forEach((row) => {
|
|
249
|
-
const [key, val] = row;
|
|
250
|
-
if (key.toLowerCase() === "body") {
|
|
251
|
-
try {
|
|
252
|
-
options.body = JSON.stringify(JSON.parse(val)); // Parse then stringify for valid JSON body
|
|
253
|
-
}
|
|
254
|
-
catch (e) {
|
|
255
|
-
throw new Error(`${e}Invalid JSON body provided in data table for request: ${val}`);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
// Treat as headers for now. Can be expanded for other options (e.g., credentials, mode)
|
|
260
|
-
if (!options.headers) {
|
|
261
|
-
options.headers = {};
|
|
262
|
-
}
|
|
263
|
-
options.headers[key] = val;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
options.method = method.toUpperCase(); // Ensure method is uppercase
|
|
268
|
-
this.log?.(`⚡ Making ${method.toUpperCase()} request to "${url}" with options: ${JSON.stringify(options).slice(0, 100)}...`);
|
|
269
|
-
const res = await this.page.evaluate(async ([urlArg, optsArg]) => {
|
|
270
|
-
const response = await fetch(urlArg, optsArg);
|
|
271
|
-
// Return a serializable subset of the response
|
|
272
|
-
return {
|
|
273
|
-
status: response.status,
|
|
274
|
-
statusText: response.statusText,
|
|
275
|
-
// Correct way to get headers as a plain object for serialization
|
|
276
|
-
headers: (() => {
|
|
277
|
-
const result = {};
|
|
278
|
-
response.headers.forEach((value, key) => {
|
|
279
|
-
result[key] = value;
|
|
280
|
-
});
|
|
281
|
-
return result;
|
|
282
|
-
})(),
|
|
283
|
-
body: await response.text(),
|
|
284
|
-
};
|
|
285
|
-
}, [url, options] // Cast to ensure type compatibility
|
|
286
|
-
);
|
|
287
|
-
// Store the serializable response object
|
|
288
|
-
this.data.lastResponse = res;
|
|
289
|
-
this.log?.(`✅ ${method.toUpperCase()} request to "${url}" completed. Status: ${res.status}. Body preview: ${res.body.slice(0, 100)}...`);
|
|
290
|
-
}
|
|
291
|
-
(0, cucumber_1.When)('I make a "{word}" request to {string}', When_I_make_HTTP_request_with_options);
|