@bigbinary/neeto-playwright-commons 1.6.5 → 1.6.7
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 +20 -18
- package/index.cjs.js.map +1 -1
- package/index.d.ts +6 -0
- package/index.js +21 -19
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ type BasicTypesInterface = Record<string, number | string | boolean>;
|
|
|
27
27
|
type HttpMethods = "get" | "patch" | "post" | "put" | "delete";
|
|
28
28
|
interface ApiRequestProps {
|
|
29
29
|
url: string;
|
|
30
|
+
failOnStatusCode?: boolean;
|
|
30
31
|
headers?: BasicTypesInterface;
|
|
31
32
|
data?: Record<string, unknown>;
|
|
32
33
|
method?: HttpMethods;
|
|
@@ -108,6 +109,7 @@ declare class HelpAndProfilePage {
|
|
|
108
109
|
t: TFunction;
|
|
109
110
|
profileSectionButton: Locator;
|
|
110
111
|
constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }: HelpAndProfilePageInitializerProps);
|
|
112
|
+
private hoverOnBody;
|
|
111
113
|
openHelpCenter: () => Promise<void>;
|
|
112
114
|
private openLiveChatAndVerify;
|
|
113
115
|
openAndVerifyChatWidget: () => Promise<void>;
|
|
@@ -239,6 +241,9 @@ declare const COMMON_SELECTORS: {
|
|
|
239
241
|
appSwitcherButton: string;
|
|
240
242
|
appSwitcherWrapper: string;
|
|
241
243
|
tableSpinner: string;
|
|
244
|
+
pageLoader: string;
|
|
245
|
+
homeButton: string;
|
|
246
|
+
neetoUiSwitch: string;
|
|
242
247
|
};
|
|
243
248
|
|
|
244
249
|
declare const NEETO_EDITOR_SELECTORS: {
|
|
@@ -258,6 +263,7 @@ declare const NEETO_EDITOR_SELECTORS: {
|
|
|
258
263
|
undoOption: string;
|
|
259
264
|
redoOption: string;
|
|
260
265
|
imageWrapper: string;
|
|
266
|
+
contentField: string;
|
|
261
267
|
};
|
|
262
268
|
|
|
263
269
|
declare const NEETO_FILTERS_SELECTORS: {
|
package/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import test, { expect, test as test$1, defineConfig, devices } from '@playwright
|
|
|
2
2
|
import * as require$$0 from 'fs';
|
|
3
3
|
import require$$0__default from 'fs';
|
|
4
4
|
import { faker } from '@faker-js/faker';
|
|
5
|
-
import { isNil, isNotNil, mergeDeepLeft, mergeAll } from 'ramda';
|
|
5
|
+
import { isNil, isNotNil, mergeDeepLeft, mergeAll, mergeLeft } from 'ramda';
|
|
6
6
|
import MailosaurClient from 'mailosaur';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
|
-
import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
|
|
9
8
|
import require$$2 from 'os';
|
|
10
9
|
import require$$0$1 from 'path';
|
|
11
10
|
import require$$0$2 from 'util';
|
|
12
11
|
import require$$0$3 from 'stream';
|
|
13
12
|
import require$$0$4 from 'events';
|
|
13
|
+
import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
|
|
14
14
|
import require$$3 from 'crypto';
|
|
15
15
|
|
|
16
16
|
const ENVIRONMENT = {
|
|
@@ -138,6 +138,9 @@ const COMMON_SELECTORS = {
|
|
|
138
138
|
appSwitcherButton: "app-switcher-button",
|
|
139
139
|
appSwitcherWrapper: "switcher-wrapper",
|
|
140
140
|
tableSpinner: ".ant-spin",
|
|
141
|
+
pageLoader: "neeto-molecules-page-loader",
|
|
142
|
+
homeButton: "home-button",
|
|
143
|
+
neetoUiSwitch: "nui-switch",
|
|
141
144
|
};
|
|
142
145
|
|
|
143
146
|
class CustomCommands {
|
|
@@ -190,11 +193,12 @@ class CustomCommands {
|
|
|
190
193
|
await this.page.reload();
|
|
191
194
|
await reloadRequests;
|
|
192
195
|
};
|
|
193
|
-
this.apiRequest = async ({ url, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
196
|
+
this.apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
194
197
|
const csrfToken = await this.page
|
|
195
198
|
.locator("[name='csrf-token']")
|
|
196
199
|
.getAttribute("content");
|
|
197
200
|
const requestOptions = {
|
|
201
|
+
failOnStatusCode,
|
|
198
202
|
headers: {
|
|
199
203
|
...additionalHeaders,
|
|
200
204
|
"accept-encoding": "gzip",
|
|
@@ -292,7 +296,7 @@ const generateStagingData = (product = "invoice") => {
|
|
|
292
296
|
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
293
297
|
email: IS_STAGING_ENV
|
|
294
298
|
? `cypresstest${otpBypassKey}+${product}+${timestamp}-playwright@bigbinary.com`
|
|
295
|
-
:
|
|
299
|
+
: CREDENTIALS.email,
|
|
296
300
|
};
|
|
297
301
|
};
|
|
298
302
|
|
|
@@ -7198,11 +7202,13 @@ const KEYBOARD_SHORTCUTS_SELECTORS = {
|
|
|
7198
7202
|
hotKeyItem: "hotkey-item",
|
|
7199
7203
|
};
|
|
7200
7204
|
|
|
7201
|
-
/* eslint-disable playwright/
|
|
7205
|
+
/* eslint-disable playwright/no-raw-locators */
|
|
7202
7206
|
class HelpAndProfilePage {
|
|
7203
7207
|
constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }) {
|
|
7208
|
+
this.hoverOnBody = () => this.page.locator("body").hover();
|
|
7204
7209
|
this.openHelpCenter = async () => {
|
|
7205
7210
|
await expect(async () => {
|
|
7211
|
+
await this.hoverOnBody();
|
|
7206
7212
|
const helpButton = this.page.getByTestId(CHAT_WIDGET_SELECTORS.helpButton);
|
|
7207
7213
|
await helpButton.scrollIntoViewIfNeeded();
|
|
7208
7214
|
await helpButton.hover();
|
|
@@ -7267,8 +7273,10 @@ class HelpAndProfilePage {
|
|
|
7267
7273
|
});
|
|
7268
7274
|
};
|
|
7269
7275
|
this.openChangelogPane = async () => {
|
|
7270
|
-
await
|
|
7271
|
-
|
|
7276
|
+
await expect(async () => {
|
|
7277
|
+
await this.page.getByTestId(HELP_CENTER_SELECTORS.whatsNewButton).click();
|
|
7278
|
+
await expect(this.page.locator(CHANGELOG_WIDGET_SELECTORS.changelogWrapper)).toBeVisible();
|
|
7279
|
+
}).toPass({ timeout: 15000 });
|
|
7272
7280
|
};
|
|
7273
7281
|
this.openAndVerifyChangelog = async () => {
|
|
7274
7282
|
await test$1.step("Step 1: Open Help Center links", this.openHelpCenter);
|
|
@@ -7352,12 +7360,14 @@ class HelpAndProfilePage {
|
|
|
7352
7360
|
this.openAppSwitcherAndVerify = async () => {
|
|
7353
7361
|
const appSwitcher = this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton);
|
|
7354
7362
|
await test$1.step("Step 1: Verify hovering over app switcher opens the app switcher drawer", () => expect(async () => {
|
|
7363
|
+
await this.hoverOnBody();
|
|
7355
7364
|
await appSwitcher.scrollIntoViewIfNeeded();
|
|
7356
7365
|
await appSwitcher.hover();
|
|
7357
7366
|
await expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
|
|
7358
7367
|
}).toPass({ timeout: 15000 }));
|
|
7359
7368
|
};
|
|
7360
7369
|
this.openProfilePopup = () => expect(async () => {
|
|
7370
|
+
await this.hoverOnBody();
|
|
7361
7371
|
await this.profileSectionButton.scrollIntoViewIfNeeded();
|
|
7362
7372
|
await this.profileSectionButton.hover();
|
|
7363
7373
|
await expect(this.page.getByTestId(PROFILE_SECTION_SELECTORS.profilePopup)).toBeVisible();
|
|
@@ -7562,6 +7572,7 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
7562
7572
|
undoOption: "neeto-editor-fixed-menu-undo-option",
|
|
7563
7573
|
redoOption: "neeto-editor-fixed-menu-redo-option",
|
|
7564
7574
|
imageWrapper: "neeto-editor-image-wrapper",
|
|
7575
|
+
contentField: "neeto-editor-content",
|
|
7565
7576
|
};
|
|
7566
7577
|
|
|
7567
7578
|
const NEETO_FILTERS_SELECTORS = {
|
|
@@ -7669,19 +7680,10 @@ const MERGE_TAGS_SELECTORS = {
|
|
|
7669
7680
|
const initializeCredentials = (product) => {
|
|
7670
7681
|
const { user } = readFileSyncIfExists();
|
|
7671
7682
|
const stagingData = generateStagingData(product);
|
|
7672
|
-
const
|
|
7673
|
-
|
|
7674
|
-
businessName: (user === null || user === void 0 ? void 0 : user.businessName) || stagingData.businessName,
|
|
7675
|
-
currentUserName: (user === null || user === void 0 ? void 0 : user.currentUserName) || stagingData.currentUserName,
|
|
7676
|
-
email: (user === null || user === void 0 ? void 0 : user.email) || stagingData.email,
|
|
7677
|
-
firstName: (user === null || user === void 0 ? void 0 : user.firstName) || stagingData.firstName,
|
|
7678
|
-
lastName: (user === null || user === void 0 ? void 0 : user.lastName) || stagingData.lastName,
|
|
7679
|
-
subdomainName: (user === null || user === void 0 ? void 0 : user.subdomainName) || stagingData.subdomainName,
|
|
7680
|
-
skipSetup: user === null || user === void 0 ? void 0 : user.skipSetup,
|
|
7681
|
-
};
|
|
7682
|
-
writeDataToFile(JSON.stringify({ user: newState }, null, 2));
|
|
7683
|
+
const newUserState = mergeLeft(user, stagingData);
|
|
7684
|
+
writeDataToFile(JSON.stringify({ user: newUserState }, null, 2));
|
|
7683
7685
|
if (IS_STAGING_ENV) {
|
|
7684
|
-
const baseUrl = `https://${
|
|
7686
|
+
const baseUrl = `https://${newUserState.subdomainName}.${stagingData.domain}`;
|
|
7685
7687
|
process.env.BASE_URL = baseUrl;
|
|
7686
7688
|
}
|
|
7687
7689
|
};
|