@bigbinary/neeto-playwright-commons 1.8.8 → 1.8.10
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.cjs.js +13 -13
- package/index.cjs.js.map +1 -1
- package/index.d.ts +3 -2
- package/index.js +13 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -43,12 +43,13 @@ declare class CustomCommands {
|
|
|
43
43
|
page: Page;
|
|
44
44
|
responses: string[];
|
|
45
45
|
request: APIRequestContext;
|
|
46
|
-
|
|
46
|
+
baseURL: string | undefined;
|
|
47
|
+
constructor(page: Page, request: APIRequestContext, baseURL?: string | undefined);
|
|
47
48
|
interceptMultipleResponses: ({ responseUrl, times, baseUrl, customPageContext, timeout, }?: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
|
|
48
49
|
private recursiveMethod;
|
|
49
50
|
executeRecursively: ExecuteRecursively;
|
|
50
51
|
verifySuccessToast: ({ message, closeAfterVerification, }?: Partial<VerifySuccessToastParams>) => Promise<void>;
|
|
51
|
-
reloadAndWait: (requestCount: number, customPageContext?: Page) => Promise<void>;
|
|
52
|
+
reloadAndWait: (requestCount: number, customPageContext?: Page, interceptMultipleResponsesProps?: Partial<Omit<InterceptMultipleResponsesParams, "times">>) => Promise<void>;
|
|
52
53
|
apiRequest: ApiRequest;
|
|
53
54
|
verifyFieldValue: VerifyFieldValue;
|
|
54
55
|
}
|
package/index.js
CHANGED
|
@@ -145,14 +145,14 @@ const COMMON_SELECTORS = {
|
|
|
145
145
|
appSwitcherButton: "app-switcher-button",
|
|
146
146
|
appSwitcherWrapper: "switcher-wrapper",
|
|
147
147
|
tableSpinner: ".ant-spin",
|
|
148
|
-
pageLoader: "neeto-molecules-
|
|
148
|
+
pageLoader: "neeto-molecules-pageloader",
|
|
149
149
|
homeButton: "home-button",
|
|
150
150
|
neetoUiSwitch: "nui-switch",
|
|
151
151
|
floatingActionMenuButton: "floating-action-menu-container",
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
class CustomCommands {
|
|
155
|
-
constructor(page, request) {
|
|
155
|
+
constructor(page, request, baseURL = process.env.BASE_URL) {
|
|
156
156
|
this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
|
|
157
157
|
const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
|
|
158
158
|
return Promise.all([...new Array(times)].map(() => pageContext.waitForResponse((response) => {
|
|
@@ -160,9 +160,7 @@ class CustomCommands {
|
|
|
160
160
|
if (response.request().resourceType() === "xhr" &&
|
|
161
161
|
response.status() === 200 &&
|
|
162
162
|
response.url().includes(responseUrl) &&
|
|
163
|
-
response
|
|
164
|
-
.url()
|
|
165
|
-
.startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
|
|
163
|
+
response.url().startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : this.baseURL) !== null && _a !== void 0 ? _a : "") &&
|
|
166
164
|
!this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
|
|
167
165
|
this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
|
|
168
166
|
return true;
|
|
@@ -194,10 +192,11 @@ class CustomCommands {
|
|
|
194
192
|
(await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
|
|
195
193
|
await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
|
|
196
194
|
};
|
|
197
|
-
this.reloadAndWait = async (requestCount, customPageContext) => {
|
|
195
|
+
this.reloadAndWait = async (requestCount, customPageContext, interceptMultipleResponsesProps = {}) => {
|
|
198
196
|
const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
|
|
199
197
|
const reloadRequests = this.interceptMultipleResponses({
|
|
200
198
|
times: requestCount,
|
|
199
|
+
...interceptMultipleResponsesProps,
|
|
201
200
|
});
|
|
202
201
|
await pageContext.reload();
|
|
203
202
|
await reloadRequests;
|
|
@@ -235,6 +234,7 @@ class CustomCommands {
|
|
|
235
234
|
this.page = page;
|
|
236
235
|
this.responses = [];
|
|
237
236
|
this.request = request;
|
|
237
|
+
this.baseURL = baseURL;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -261,8 +261,8 @@ class MailosaurUtils {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
const commands = {
|
|
264
|
-
neetoPlaywrightUtilities: async ({ page, request }, use) => {
|
|
265
|
-
const commands = new CustomCommands(page, request);
|
|
264
|
+
neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
|
|
265
|
+
const commands = new CustomCommands(page, request, baseURL);
|
|
266
266
|
await use(commands);
|
|
267
267
|
},
|
|
268
268
|
mailosaur: async ({}, use) => {
|
|
@@ -289,11 +289,11 @@ const commands = {
|
|
|
289
289
|
|
|
290
290
|
const generateStagingData = (product = "invoice") => {
|
|
291
291
|
var _a;
|
|
292
|
-
const timestamp = `${dayjs().format("
|
|
292
|
+
const timestamp = `${dayjs().format("MMDDHHmmssSSS")}${(_a = process.env.JOB_COMPLETION_INDEX) !== null && _a !== void 0 ? _a : ""}`;
|
|
293
293
|
const firstName = "André";
|
|
294
294
|
const lastName = "O'Reilly";
|
|
295
295
|
const otpBypassKey = process.env.OTP_BYPASS_KEY;
|
|
296
|
-
const stagingOrganization = `
|
|
296
|
+
const stagingOrganization = `cpt-${product}-${timestamp}`;
|
|
297
297
|
return {
|
|
298
298
|
firstName,
|
|
299
299
|
lastName,
|
|
@@ -305,7 +305,7 @@ const generateStagingData = (product = "invoice") => {
|
|
|
305
305
|
businessName: stagingOrganization,
|
|
306
306
|
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
307
307
|
email: IS_STAGING_ENV
|
|
308
|
-
? `
|
|
308
|
+
? `cpt${otpBypassKey}+${product}+${timestamp}@bigbinary.com`
|
|
309
309
|
: CREDENTIALS.email,
|
|
310
310
|
};
|
|
311
311
|
};
|
|
@@ -7430,7 +7430,7 @@ class HelpAndProfilePage {
|
|
|
7430
7430
|
.replaceAll(" ", "then")
|
|
7431
7431
|
.replaceAll("+", "");
|
|
7432
7432
|
return osPlatform === "mac"
|
|
7433
|
-
? formattedShortcut.replace(/ctrl/g, "⌘")
|
|
7433
|
+
? formattedShortcut.replace(/ctrl/g, "⌘").replace(/alt/g, "opt")
|
|
7434
7434
|
: formattedShortcut;
|
|
7435
7435
|
};
|
|
7436
7436
|
this.openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
|
|
@@ -7705,7 +7705,7 @@ const SIGNUP_SELECTORS = {
|
|
|
7705
7705
|
};
|
|
7706
7706
|
|
|
7707
7707
|
const extractSubdomainFromError = (errorString) => {
|
|
7708
|
-
const regex = /
|
|
7708
|
+
const regex = /cpt[a-zA-Z0-9-]+/g;
|
|
7709
7709
|
const matches = errorString.match(regex);
|
|
7710
7710
|
return matches[1];
|
|
7711
7711
|
};
|