@bigbinary/neeto-playwright-commons 1.8.16 → 1.8.17

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/index.d.ts CHANGED
@@ -11,6 +11,7 @@ interface InterceptMultipleResponsesParams {
11
11
  baseUrl: string;
12
12
  customPageContext: Page | undefined;
13
13
  timeout: number;
14
+ responseStatus: number;
14
15
  }
15
16
  type GenericCallback = (...params: any[]) => Promise<unknown> | unknown;
16
17
  interface ExecuteRecursivelyParams {
@@ -45,7 +46,7 @@ declare class CustomCommands {
45
46
  request: APIRequestContext;
46
47
  baseURL: string | undefined;
47
48
  constructor(page: Page, request: APIRequestContext, baseURL?: string | undefined);
48
- interceptMultipleResponses: ({ responseUrl, times, baseUrl, customPageContext, timeout, }?: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
49
+ interceptMultipleResponses: ({ responseUrl, responseStatus, times, baseUrl, customPageContext, timeout, }?: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
49
50
  private recursiveMethod;
50
51
  executeRecursively: ExecuteRecursively;
51
52
  verifySuccessToast: ({ message, closeAfterVerification, }?: Partial<VerifySuccessToastParams>) => Promise<void>;
package/index.js CHANGED
@@ -158,12 +158,12 @@ const COMMON_SELECTORS = {
158
158
 
159
159
  class CustomCommands {
160
160
  constructor(page, request, baseURL = process.env.BASE_URL) {
161
- this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
161
+ this.interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
162
162
  const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
163
163
  return Promise.all([...new Array(times)].map(() => pageContext.waitForResponse((response) => {
164
164
  var _a, _b, _c;
165
165
  if (response.request().resourceType() === "xhr" &&
166
- response.status() === 200 &&
166
+ response.status() === responseStatus &&
167
167
  response.url().includes(responseUrl) &&
168
168
  response.url().startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : this.baseURL) !== null && _a !== void 0 ? _a : "") &&
169
169
  !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {