@bigbinary/neeto-playwright-commons 1.6.4 → 1.6.6
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/configs/eslint/host.js +1 -0
- package/index.cjs.js +11 -15
- package/index.cjs.js.map +1 -1
- package/index.d.ts +5 -0
- package/index.js +12 -16
- 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;
|
|
@@ -239,6 +240,9 @@ declare const COMMON_SELECTORS: {
|
|
|
239
240
|
appSwitcherButton: string;
|
|
240
241
|
appSwitcherWrapper: string;
|
|
241
242
|
tableSpinner: string;
|
|
243
|
+
pageLoader: string;
|
|
244
|
+
homeButton: string;
|
|
245
|
+
neetoUiSwitch: string;
|
|
242
246
|
};
|
|
243
247
|
|
|
244
248
|
declare const NEETO_EDITOR_SELECTORS: {
|
|
@@ -258,6 +262,7 @@ declare const NEETO_EDITOR_SELECTORS: {
|
|
|
258
262
|
undoOption: string;
|
|
259
263
|
redoOption: string;
|
|
260
264
|
imageWrapper: string;
|
|
265
|
+
contentField: string;
|
|
261
266
|
};
|
|
262
267
|
|
|
263
268
|
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
|
|
|
@@ -7562,6 +7566,7 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
7562
7566
|
undoOption: "neeto-editor-fixed-menu-undo-option",
|
|
7563
7567
|
redoOption: "neeto-editor-fixed-menu-redo-option",
|
|
7564
7568
|
imageWrapper: "neeto-editor-image-wrapper",
|
|
7569
|
+
contentField: "neeto-editor-content",
|
|
7565
7570
|
};
|
|
7566
7571
|
|
|
7567
7572
|
const NEETO_FILTERS_SELECTORS = {
|
|
@@ -7669,19 +7674,10 @@ const MERGE_TAGS_SELECTORS = {
|
|
|
7669
7674
|
const initializeCredentials = (product) => {
|
|
7670
7675
|
const { user } = readFileSyncIfExists();
|
|
7671
7676
|
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));
|
|
7677
|
+
const newUserState = mergeLeft(user, stagingData);
|
|
7678
|
+
writeDataToFile(JSON.stringify({ user: newUserState }, null, 2));
|
|
7683
7679
|
if (IS_STAGING_ENV) {
|
|
7684
|
-
const baseUrl = `https://${
|
|
7680
|
+
const baseUrl = `https://${newUserState.subdomainName}.${stagingData.domain}`;
|
|
7685
7681
|
process.env.BASE_URL = baseUrl;
|
|
7686
7682
|
}
|
|
7687
7683
|
};
|