@bigbinary/neeto-playwright-commons 1.8.35 → 1.8.36
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 +209 -0
- package/index.cjs.js.map +1 -1
- package/index.d.ts +77 -2
- package/index.js +209 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
|
-
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Browser,
|
|
2
|
+
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Browser, BrowserContext, FrameLocator, Locator, CDPSession } from '@playwright/test';
|
|
3
3
|
import MailosaurClient from 'mailosaur';
|
|
4
4
|
import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
|
|
5
5
|
import { TFunction } from 'i18next';
|
|
@@ -111,6 +111,78 @@ declare const _default: _playwright_test.TestType<_playwright_test.PlaywrightTes
|
|
|
111
111
|
|
|
112
112
|
declare const i18nFixture: Fixtures<I18nPlaywrightFixture, PlaywrightWorkerArgs & PlaywrightWorkerOptions, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
113
113
|
|
|
114
|
+
type EmbedType = "inline" | "floatingPopup" | "elementClick";
|
|
115
|
+
type GetByRoleOptions = {
|
|
116
|
+
checked?: boolean;
|
|
117
|
+
disabled?: boolean;
|
|
118
|
+
exact?: boolean;
|
|
119
|
+
expanded?: boolean;
|
|
120
|
+
includeHidden?: boolean;
|
|
121
|
+
level?: number;
|
|
122
|
+
name?: string | RegExp;
|
|
123
|
+
pressed?: boolean;
|
|
124
|
+
selected?: boolean;
|
|
125
|
+
};
|
|
126
|
+
type InlineCustomizationOptions = {
|
|
127
|
+
embedHeight: string;
|
|
128
|
+
embedWidth: string;
|
|
129
|
+
embedDivContainerId: string;
|
|
130
|
+
};
|
|
131
|
+
type VerifyInlineCustomizationParams = {
|
|
132
|
+
headingTestId: string;
|
|
133
|
+
inlineEmbedInterceptParams: Partial<InterceptMultipleResponsesParams>;
|
|
134
|
+
customizationOptions: InlineCustomizationOptions;
|
|
135
|
+
};
|
|
136
|
+
type FloatingPopupCustomizationOptions = {
|
|
137
|
+
buttonText: string;
|
|
138
|
+
buttonColorHex: string;
|
|
139
|
+
buttonTextColorHex: string;
|
|
140
|
+
buttonPosition: "Bottom left" | "Bottom right";
|
|
141
|
+
};
|
|
142
|
+
type ElementClickCustomizationOptions = {
|
|
143
|
+
customId: string;
|
|
144
|
+
};
|
|
145
|
+
type initializeEmbedPageParams = {
|
|
146
|
+
embedType: EmbedType;
|
|
147
|
+
embedCode: string;
|
|
148
|
+
customElementText?: string;
|
|
149
|
+
};
|
|
150
|
+
type EmbedBasePageConstructorParams = {
|
|
151
|
+
context: BrowserContext;
|
|
152
|
+
page: Page;
|
|
153
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
154
|
+
appName: string;
|
|
155
|
+
};
|
|
156
|
+
declare class EmbedBase {
|
|
157
|
+
context: BrowserContext;
|
|
158
|
+
page: Page;
|
|
159
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
160
|
+
appName: string;
|
|
161
|
+
t: TFunction;
|
|
162
|
+
embedTestPage: Page;
|
|
163
|
+
embedTestPageType: EmbedType;
|
|
164
|
+
embeddedFrame: FrameLocator;
|
|
165
|
+
filePath: string;
|
|
166
|
+
codeBlock: Locator;
|
|
167
|
+
previewTab: Locator;
|
|
168
|
+
constructor({ context, page, neetoPlaywrightUtilities, appName, }: EmbedBasePageConstructorParams);
|
|
169
|
+
initializeEmbedPage: ({ embedType, embedCode, customElementText, }: initializeEmbedPageParams) => Promise<Page>;
|
|
170
|
+
closeEmbedModalAndPage: () => Promise<void>;
|
|
171
|
+
clickOnPopupButton: (popUpButtonSelectorOptions: GetByRoleOptions) => Promise<void>;
|
|
172
|
+
copyEmbedScript: ({ embedLabel }: {
|
|
173
|
+
embedLabel: string;
|
|
174
|
+
}) => Promise<string>;
|
|
175
|
+
selectEmbedType: (embedLabel: string) => Promise<void>;
|
|
176
|
+
verifyInlineCustomization: ({ headingTestId, inlineEmbedInterceptParams, customizationOptions, }: VerifyInlineCustomizationParams) => Promise<void>;
|
|
177
|
+
verifyFloatingPopupCustomization: (customizationOptions: FloatingPopupCustomizationOptions) => Promise<void>;
|
|
178
|
+
verifyElementClickCustomization: (customizationOptions: ElementClickCustomizationOptions) => Promise<void>;
|
|
179
|
+
expectMultipleTextsInCodeblock: (containTextOptions: [
|
|
180
|
+
string | RegExp,
|
|
181
|
+
string | RegExp,
|
|
182
|
+
...(string | RegExp)[]
|
|
183
|
+
]) => Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
|
|
114
186
|
interface HelpAndProfilePageInitializerProps {
|
|
115
187
|
page: Page;
|
|
116
188
|
neetoPlaywrightUtilities: CustomCommands;
|
|
@@ -320,6 +392,7 @@ declare const THIRD_PARTY_ROUTES: {
|
|
|
320
392
|
declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling", Protocol.Network.emulateNetworkConditionsParameters>;
|
|
321
393
|
|
|
322
394
|
declare const COMMON_SELECTORS: {
|
|
395
|
+
copyButton: string;
|
|
323
396
|
spinner: string;
|
|
324
397
|
subheaderText: string;
|
|
325
398
|
alertTitle: string;
|
|
@@ -334,6 +407,7 @@ declare const COMMON_SELECTORS: {
|
|
|
334
407
|
paneHeader: string;
|
|
335
408
|
profileSidebar: string;
|
|
336
409
|
selectOption: (label: string) => string;
|
|
410
|
+
radioLabel: (embedLabel: string) => string;
|
|
337
411
|
toastMessage: string;
|
|
338
412
|
toastCloseButton: string;
|
|
339
413
|
windowAlert: string;
|
|
@@ -649,6 +723,7 @@ declare const skipTest: {
|
|
|
649
723
|
};
|
|
650
724
|
declare const shouldSkipSetupAndTeardown: () => boolean | "";
|
|
651
725
|
declare const squish: (text: string) => string;
|
|
726
|
+
declare const toCamelCase: (string: string) => string;
|
|
652
727
|
|
|
653
728
|
interface LoginProps {
|
|
654
729
|
page: Page;
|
|
@@ -756,4 +831,4 @@ interface Overrides {
|
|
|
756
831
|
}
|
|
757
832
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
758
833
|
|
|
759
|
-
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, updateCredentials, writeDataToFile };
|
|
834
|
+
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import test$1, { expect, test as test$2, defineConfig, devices } from '@playwright/test';
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
import * as fs$d from 'fs';
|
|
4
|
-
import fs__default, { readFileSync } from 'fs';
|
|
4
|
+
import fs__default, { writeFileSync as writeFileSync$1, unlinkSync, readFileSync } from 'fs';
|
|
5
5
|
import { not, isEmpty as isEmpty$1, isNil, isNotNil, mergeDeepLeft, mergeAll } from 'ramda';
|
|
6
6
|
import require$$0$2 from 'util';
|
|
7
7
|
import { faker } from '@faker-js/faker';
|
|
@@ -125,8 +125,10 @@ const skipTest = {
|
|
|
125
125
|
const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) && process.env.SKIP_SETUP === "true"; };
|
|
126
126
|
// trims and replaces multiple whitespace characters in a string with a single space
|
|
127
127
|
const squish = (text) => text.trim().replace(/\s+/g, " ");
|
|
128
|
+
const toCamelCase = (string) => string.toLowerCase().replace(/( \w)/g, letter => letter[1].toUpperCase());
|
|
128
129
|
|
|
129
130
|
const COMMON_SELECTORS = {
|
|
131
|
+
copyButton: "copy-button",
|
|
130
132
|
spinner: ".neeto-ui-spinner",
|
|
131
133
|
subheaderText: "subheader-left",
|
|
132
134
|
alertTitle: "alert-title",
|
|
@@ -141,6 +143,7 @@ const COMMON_SELECTORS = {
|
|
|
141
143
|
paneHeader: "pane-header",
|
|
142
144
|
profileSidebar: "profile-section",
|
|
143
145
|
selectOption: (label) => `${hyphenize(label)}-select-option`,
|
|
146
|
+
radioLabel: (embedLabel) => `${hyphenize(embedLabel)}-radio-label`,
|
|
144
147
|
toastMessage: "toastr-message-container",
|
|
145
148
|
toastCloseButton: "toastr-close-button",
|
|
146
149
|
windowAlert: "#alert-box",
|
|
@@ -12247,6 +12250,210 @@ const i18nFixture = {
|
|
|
12247
12250
|
},
|
|
12248
12251
|
};
|
|
12249
12252
|
|
|
12253
|
+
const EMBED_SELECTORS = {
|
|
12254
|
+
iframe: (appName) => `#${appName}-iframe`,
|
|
12255
|
+
modal: (appName) => `#${appName}-modal`,
|
|
12256
|
+
close: (appName) => `#close-${appName}`,
|
|
12257
|
+
loader: (appName) => `#${appName}-loader`,
|
|
12258
|
+
inlineHeightInput: "inline-height-input-field",
|
|
12259
|
+
inlineWidthInput: "inline-width-input-field",
|
|
12260
|
+
inlineElementIdInput: "inline-element-id-input-field",
|
|
12261
|
+
codeBlock: "code-block",
|
|
12262
|
+
previewTab: "preview-tab",
|
|
12263
|
+
htmlTab: "html-tab",
|
|
12264
|
+
buttonTextInput: "button-text-input-field",
|
|
12265
|
+
buttonPositionSelectContainer: "button-position-select-value-container",
|
|
12266
|
+
buttonPositionSelectMenu: "button-position-select-menu",
|
|
12267
|
+
buttonColorLabel: "button-color-label",
|
|
12268
|
+
buttonTextColorLabel: "button-text-color-label",
|
|
12269
|
+
colorPickerTarget: "color-picker-target",
|
|
12270
|
+
colorpickerEditableInput: "colorpicker-editable-input",
|
|
12271
|
+
showIconCheckbox: "show-icon-checkbox",
|
|
12272
|
+
elementIdInput: "element-id-input-field",
|
|
12273
|
+
previewElementPopupButton: "preview-element-popup-button",
|
|
12274
|
+
};
|
|
12275
|
+
|
|
12276
|
+
const basicHTMLContent = (content) => `
|
|
12277
|
+
<!DOCTYPE html>
|
|
12278
|
+
<html lang="en">
|
|
12279
|
+
<head>
|
|
12280
|
+
<meta charset="UTF-8" />
|
|
12281
|
+
<meta name="viewport" content="width=device-width" />
|
|
12282
|
+
</head>
|
|
12283
|
+
<body>
|
|
12284
|
+
${content}
|
|
12285
|
+
</body>
|
|
12286
|
+
</html>`;
|
|
12287
|
+
const hexToRGB = (hex) => {
|
|
12288
|
+
let r = "", g = "", b = "";
|
|
12289
|
+
if (hex.length === 4) {
|
|
12290
|
+
r = `0x${hex[1]}${hex[1]}`;
|
|
12291
|
+
g = `0x${hex[2]}${hex[2]}`;
|
|
12292
|
+
b = `0x${hex[3]}${hex[3]}`;
|
|
12293
|
+
}
|
|
12294
|
+
else if (hex.length === 7) {
|
|
12295
|
+
r = `0x${hex[1]}${hex[2]}`;
|
|
12296
|
+
g = `0x${hex[3]}${hex[4]}`;
|
|
12297
|
+
b = `0x${hex[5]}${hex[6]}`;
|
|
12298
|
+
}
|
|
12299
|
+
return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
|
|
12300
|
+
};
|
|
12301
|
+
|
|
12302
|
+
class EmbedBase {
|
|
12303
|
+
constructor({ context, page, neetoPlaywrightUtilities, appName, }) {
|
|
12304
|
+
this.initializeEmbedPage = async ({ embedType, embedCode, customElementText = "Click here", }) => {
|
|
12305
|
+
this.embedTestPage = await this.context.newPage();
|
|
12306
|
+
this.embedTestPageType = embedType;
|
|
12307
|
+
const fileContent = basicHTMLContent(this.embedTestPageType === "elementClick"
|
|
12308
|
+
? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
|
|
12309
|
+
: embedCode);
|
|
12310
|
+
this.filePath = `tmp/${faker.word.noun()}.html`;
|
|
12311
|
+
writeFileSync$1(this.filePath, fileContent, "utf8");
|
|
12312
|
+
await this.embedTestPage.goto(`file://${Path.resolve(this.filePath)}`);
|
|
12313
|
+
await this.embedTestPage.waitForLoadState("load");
|
|
12314
|
+
this.embeddedFrame = this.embedTestPage.frameLocator(this.embedTestPageType === "inline"
|
|
12315
|
+
? "iframe"
|
|
12316
|
+
: EMBED_SELECTORS.iframe(this.appName));
|
|
12317
|
+
return this.embedTestPage;
|
|
12318
|
+
};
|
|
12319
|
+
this.closeEmbedModalAndPage = async () => {
|
|
12320
|
+
if (this.embedTestPageType !== "inline") {
|
|
12321
|
+
await this.embedTestPage
|
|
12322
|
+
.locator(EMBED_SELECTORS.close(this.appName))
|
|
12323
|
+
.click();
|
|
12324
|
+
await expect(this.embedTestPage.locator(EMBED_SELECTORS.modal(this.appName))).toBeHidden();
|
|
12325
|
+
}
|
|
12326
|
+
await this.embedTestPage.close();
|
|
12327
|
+
await this.context.close();
|
|
12328
|
+
unlinkSync(this.filePath);
|
|
12329
|
+
};
|
|
12330
|
+
this.clickOnPopupButton = async (popUpButtonSelectorOptions) => {
|
|
12331
|
+
const popUpButton = this.embedTestPage.getByRole(this.embedTestPageType === "floatingPopup" ? "button" : "link", popUpButtonSelectorOptions);
|
|
12332
|
+
await expect(popUpButton).toBeVisible();
|
|
12333
|
+
await popUpButton.click();
|
|
12334
|
+
await expect(this.embedTestPage.locator(EMBED_SELECTORS.loader(this.appName))).toBeHidden({
|
|
12335
|
+
timeout: 10000,
|
|
12336
|
+
});
|
|
12337
|
+
};
|
|
12338
|
+
this.copyEmbedScript = async ({ embedLabel }) => {
|
|
12339
|
+
await this.page
|
|
12340
|
+
.getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
|
|
12341
|
+
.check();
|
|
12342
|
+
await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
|
|
12343
|
+
return await this.page.evaluate(() => navigator.clipboard.readText());
|
|
12344
|
+
};
|
|
12345
|
+
this.selectEmbedType = async (embedLabel) => {
|
|
12346
|
+
await this.page.getByTestId(EMBED_SELECTORS.htmlTab).click();
|
|
12347
|
+
await this.page
|
|
12348
|
+
.getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
|
|
12349
|
+
.check();
|
|
12350
|
+
};
|
|
12351
|
+
this.verifyInlineCustomization = async ({ headingTestId, inlineEmbedInterceptParams, customizationOptions, }) => {
|
|
12352
|
+
const embedHeightPercentage = `${customizationOptions.embedHeight}%`;
|
|
12353
|
+
const embedWidthPercentage = `${customizationOptions.embedWidth}%`;
|
|
12354
|
+
await this.page
|
|
12355
|
+
.getByTestId(EMBED_SELECTORS.inlineHeightInput)
|
|
12356
|
+
.fill(customizationOptions.embedHeight);
|
|
12357
|
+
await this.page
|
|
12358
|
+
.getByTestId(EMBED_SELECTORS.inlineWidthInput)
|
|
12359
|
+
.fill(customizationOptions.embedWidth);
|
|
12360
|
+
await this.page
|
|
12361
|
+
.getByTestId(EMBED_SELECTORS.inlineElementIdInput)
|
|
12362
|
+
.fill(customizationOptions.embedDivContainerId);
|
|
12363
|
+
await this.expectMultipleTextsInCodeblock([
|
|
12364
|
+
RegExp(`<div .* id="${customizationOptions.embedDivContainerId}">`),
|
|
12365
|
+
`elementSelector: "#${customizationOptions.embedDivContainerId}"`,
|
|
12366
|
+
`height: "${embedHeightPercentage}"`,
|
|
12367
|
+
`width: "${embedWidthPercentage}"`,
|
|
12368
|
+
]);
|
|
12369
|
+
const inlineEmbedPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses(inlineEmbedInterceptParams);
|
|
12370
|
+
await this.previewTab.click();
|
|
12371
|
+
await inlineEmbedPromise;
|
|
12372
|
+
const iframe = this.page.locator("iframe");
|
|
12373
|
+
await iframe.waitFor({ state: "visible" });
|
|
12374
|
+
await expect(this.page.frameLocator("iframe").getByTestId(headingTestId)).toBeVisible({ timeout: 10000 });
|
|
12375
|
+
const iframeHeight = await iframe.evaluate(node => node.getAttribute("height"));
|
|
12376
|
+
const iframeWidth = await iframe.evaluate(node => node.getAttribute("width"));
|
|
12377
|
+
expect(iframeHeight).toStrictEqual(embedHeightPercentage);
|
|
12378
|
+
expect(iframeWidth).toStrictEqual(embedWidthPercentage);
|
|
12379
|
+
};
|
|
12380
|
+
this.verifyFloatingPopupCustomization = async (customizationOptions) => {
|
|
12381
|
+
await this.page
|
|
12382
|
+
.getByTestId(EMBED_SELECTORS.buttonTextInput)
|
|
12383
|
+
.fill(customizationOptions.buttonText);
|
|
12384
|
+
await this.page
|
|
12385
|
+
.getByTestId(EMBED_SELECTORS.buttonPositionSelectContainer)
|
|
12386
|
+
.click();
|
|
12387
|
+
await this.page
|
|
12388
|
+
.getByTestId(EMBED_SELECTORS.buttonPositionSelectMenu)
|
|
12389
|
+
.getByText(customizationOptions.buttonPosition)
|
|
12390
|
+
.click();
|
|
12391
|
+
await expect(this.page.getByTestId(EMBED_SELECTORS.buttonPositionSelectContainer)).toContainText(customizationOptions.buttonPosition);
|
|
12392
|
+
const buttonColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonColorLabel);
|
|
12393
|
+
await buttonColorLabel
|
|
12394
|
+
.getByTestId(EMBED_SELECTORS.colorPickerTarget)
|
|
12395
|
+
.click();
|
|
12396
|
+
await this.page
|
|
12397
|
+
.getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
|
|
12398
|
+
.getByRole("textbox")
|
|
12399
|
+
.fill(customizationOptions.buttonColorHex);
|
|
12400
|
+
const buttonTextColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonTextColorLabel);
|
|
12401
|
+
// This additional click is to close the previously opened color picker for buttonColor.
|
|
12402
|
+
await buttonTextColorLabel
|
|
12403
|
+
.getByTestId(EMBED_SELECTORS.colorPickerTarget)
|
|
12404
|
+
.click();
|
|
12405
|
+
await buttonTextColorLabel
|
|
12406
|
+
.getByTestId(EMBED_SELECTORS.colorPickerTarget)
|
|
12407
|
+
.click();
|
|
12408
|
+
await this.page
|
|
12409
|
+
.getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
|
|
12410
|
+
.getByRole("textbox")
|
|
12411
|
+
.fill(customizationOptions.buttonTextColorHex);
|
|
12412
|
+
await this.page.getByTestId(EMBED_SELECTORS.showIconCheckbox).click();
|
|
12413
|
+
await this.expectMultipleTextsInCodeblock([
|
|
12414
|
+
`btnColor: "${customizationOptions.buttonColorHex}"`,
|
|
12415
|
+
`btnTextColor: "${customizationOptions.buttonTextColorHex}"`,
|
|
12416
|
+
`btnPosition: "${toCamelCase(customizationOptions.buttonPosition)}"`,
|
|
12417
|
+
`btnText: "${customizationOptions.buttonText}"`,
|
|
12418
|
+
"showIcon: false",
|
|
12419
|
+
]);
|
|
12420
|
+
await this.previewTab.click();
|
|
12421
|
+
const floatingButton = this.page.getByRole("button", {
|
|
12422
|
+
name: customizationOptions.buttonText,
|
|
12423
|
+
});
|
|
12424
|
+
await expect(floatingButton).toHaveCSS("color", hexToRGB(customizationOptions.buttonTextColorHex));
|
|
12425
|
+
await expect(floatingButton).toHaveCSS("background-color", hexToRGB(customizationOptions.buttonColorHex));
|
|
12426
|
+
const classRegExp = customizationOptions.buttonPosition
|
|
12427
|
+
.toLocaleLowerCase()
|
|
12428
|
+
.replace(" ", ".*");
|
|
12429
|
+
await expect(floatingButton).toHaveClass(RegExp(classRegExp));
|
|
12430
|
+
await expect(floatingButton.locator("svg")).toBeHidden();
|
|
12431
|
+
};
|
|
12432
|
+
this.verifyElementClickCustomization = async (customizationOptions) => {
|
|
12433
|
+
await this.page
|
|
12434
|
+
.getByTestId(EMBED_SELECTORS.elementIdInput)
|
|
12435
|
+
.fill(customizationOptions.customId);
|
|
12436
|
+
await expect(this.codeBlock).toContainText(`elementSelector: "#${customizationOptions.customId}"`);
|
|
12437
|
+
await this.previewTab.click();
|
|
12438
|
+
await expect(this.page.getByTestId(EMBED_SELECTORS.previewElementPopupButton)).toBeVisible();
|
|
12439
|
+
await expect(this.page.locator(`#${customizationOptions.customId}`)).toBeVisible();
|
|
12440
|
+
};
|
|
12441
|
+
this.expectMultipleTextsInCodeblock = async (containTextOptions) => {
|
|
12442
|
+
const codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
|
|
12443
|
+
for (const containTextOption of containTextOptions) {
|
|
12444
|
+
await expect(codeBlock).toContainText(containTextOption);
|
|
12445
|
+
}
|
|
12446
|
+
};
|
|
12447
|
+
this.context = context;
|
|
12448
|
+
this.page = page;
|
|
12449
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
12450
|
+
this.appName = appName;
|
|
12451
|
+
this.t = getI18nInstance().t;
|
|
12452
|
+
this.codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
|
|
12453
|
+
this.previewTab = this.page.getByTestId(EMBED_SELECTORS.previewTab);
|
|
12454
|
+
}
|
|
12455
|
+
}
|
|
12456
|
+
|
|
12250
12457
|
const BASE_URL = "/api/v1";
|
|
12251
12458
|
const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
|
|
12252
12459
|
const ROUTES = {
|
|
@@ -146632,5 +146839,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
146632
146839
|
});
|
|
146633
146840
|
};
|
|
146634
146841
|
|
|
146635
|
-
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, updateCredentials, writeDataToFile };
|
|
146842
|
+
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
|
146636
146843
|
//# sourceMappingURL=index.js.map
|