@cronn/playwright-utils 0.2.0 → 0.3.0
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/dist/index.d.mts +15 -1
- package/dist/index.mjs +18 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Normalizer } from "@cronn/playwright-file-snapshots";
|
|
2
|
-
import { APIRequestContext, APIResponse, Locator, Page, Route } from "@playwright/test";
|
|
2
|
+
import { APIRequestContext, APIResponse, Locator, Page, Request, Response, Route } from "@playwright/test";
|
|
3
3
|
//#region src/environment.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Whether the current process runs in a CI environment, based on the `CI`
|
|
@@ -178,6 +178,20 @@ declare class RouteInterceptor {
|
|
|
178
178
|
* ```
|
|
179
179
|
*/
|
|
180
180
|
modifyResponse(modifier: ResponseHandler): ExecutableRouteInterceptor;
|
|
181
|
+
/**
|
|
182
|
+
* Wait until the target route was called and return the client request.
|
|
183
|
+
*
|
|
184
|
+
* @param options - Options for {@link Page#waitForRequest}
|
|
185
|
+
* @returns Response - The server response
|
|
186
|
+
*/
|
|
187
|
+
waitForRequest(options?: Parameters<Page["waitForRequest"]>[1]): Promise<Request>;
|
|
188
|
+
/**
|
|
189
|
+
* Wait until the target route was called and return the server response.
|
|
190
|
+
*
|
|
191
|
+
* @param options - Options for {@link Page#waitForResponse}
|
|
192
|
+
* @returns Response - The server response
|
|
193
|
+
*/
|
|
194
|
+
waitForResponse(options?: Parameters<Page["waitForResponse"]>[1]): Promise<Response>;
|
|
181
195
|
}
|
|
182
196
|
/**
|
|
183
197
|
* Stub returned by {@link RouteInterceptor} used to intercept routes during a block.
|
package/dist/index.mjs
CHANGED
|
@@ -224,6 +224,24 @@ var RouteInterceptor = class {
|
|
|
224
224
|
modifyResponse(modifier) {
|
|
225
225
|
return new ExecutableRouteInterceptor((action) => withModifiedResponse(this.page, this.filter, modifier, action));
|
|
226
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Wait until the target route was called and return the client request.
|
|
229
|
+
*
|
|
230
|
+
* @param options - Options for {@link Page#waitForRequest}
|
|
231
|
+
* @returns Response - The server response
|
|
232
|
+
*/
|
|
233
|
+
waitForRequest(options) {
|
|
234
|
+
return this.page.waitForRequest((request) => isFiltered(this.filter, request), options);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Wait until the target route was called and return the server response.
|
|
238
|
+
*
|
|
239
|
+
* @param options - Options for {@link Page#waitForResponse}
|
|
240
|
+
* @returns Response - The server response
|
|
241
|
+
*/
|
|
242
|
+
waitForResponse(options) {
|
|
243
|
+
return this.page.waitForResponse((response) => isFiltered(this.filter, response.request()), options);
|
|
244
|
+
}
|
|
227
245
|
};
|
|
228
246
|
/**
|
|
229
247
|
* Stub returned by {@link RouteInterceptor} used to intercept routes during a block.
|