@bigbinary/neeto-playwright-commons 1.21.3 → 1.21.4
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 +65 -12
- package/index.cjs.js.map +1 -1
- package/index.d.ts +11 -1
- package/index.js +65 -12
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -485,7 +485,9 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
485
485
|
editorMenuWrapper: "neeto-editor-fixed-menu-wrapper",
|
|
486
486
|
editorMediaUploaderTab: "neeto-editor-media-uploader-local-tab",
|
|
487
487
|
dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${joinHyphenCase(variable)}`,
|
|
488
|
-
neetoEditorFixedMenuFontSize:
|
|
488
|
+
neetoEditorFixedMenuFontSize: "neeto-editor-fixed-menu-font-size-option",
|
|
489
|
+
highlightText: (textColorIndex) => `--neeto-editor-highlight-text-${textColorIndex}`,
|
|
490
|
+
highlightBg: (bgColorIndex) => `--neeto-editor-highlight-bg-${bgColorIndex}`,
|
|
489
491
|
};
|
|
490
492
|
const NEETO_TEXT_MODIFIER_SELECTORS = {
|
|
491
493
|
strike: optionSelector("strike"),
|
|
@@ -192018,7 +192020,6 @@ const EXPANDED_FONT_SIZE = {
|
|
|
192018
192020
|
const TEXT_MODIFIER_TAGS = {
|
|
192019
192021
|
underline: "u",
|
|
192020
192022
|
strike: "s",
|
|
192021
|
-
highlight: "mark",
|
|
192022
192023
|
};
|
|
192023
192024
|
const TEXT_MODIFIER_ROLES = {
|
|
192024
192025
|
bold: "strong",
|
|
@@ -192041,6 +192042,7 @@ class EditorPage {
|
|
|
192041
192042
|
this.imageUrl = "https://picsum.photos/200/300";
|
|
192042
192043
|
this.videoUrl = "https://youtu.be/jNQXAC9IVRw";
|
|
192043
192044
|
this.cannedResponseSuccessMessage = "";
|
|
192045
|
+
this.highlighterCount = 1;
|
|
192044
192046
|
this.cleanString = (selector = "") => (selector === null || selector === void 0 ? void 0 : selector.replace("neeto-editor-fixed-menu-", "").replace("-option", "")) ||
|
|
192045
192047
|
"";
|
|
192046
192048
|
this.fixedMenuOptions = async () => {
|
|
@@ -192133,6 +192135,57 @@ class EditorPage {
|
|
|
192133
192135
|
await textModifierSelector.click();
|
|
192134
192136
|
return [{ key: modifierKey, value: randomText }];
|
|
192135
192137
|
};
|
|
192138
|
+
this.openHighlighterContainer = (isButtonInMoreMenu) => test$1.expect(async () => {
|
|
192139
|
+
isButtonInMoreMenu && (await this.moreMenuSelector.click());
|
|
192140
|
+
await this.editorWrapper
|
|
192141
|
+
.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS["highlight"])
|
|
192142
|
+
.locator("svg")
|
|
192143
|
+
.click();
|
|
192144
|
+
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5000 });
|
|
192145
|
+
}).toPass({ timeout: 30000 });
|
|
192146
|
+
this.focusText = (textLocator) => {
|
|
192147
|
+
const platform = require$$0$8.platform();
|
|
192148
|
+
return test$1.expect(async () => {
|
|
192149
|
+
await textLocator.click();
|
|
192150
|
+
platform === "darwin"
|
|
192151
|
+
? await this.page.keyboard.press("Meta+ArrowRight")
|
|
192152
|
+
: await this.page.keyboard.press("End");
|
|
192153
|
+
await test$1.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
|
|
192154
|
+
timeout: 5000,
|
|
192155
|
+
});
|
|
192156
|
+
}).toPass({ timeout: 20000 });
|
|
192157
|
+
};
|
|
192158
|
+
this.highlightText = async (isButtonInMoreMenu, colorIndex) => {
|
|
192159
|
+
const randomText = await this.fillRandomText();
|
|
192160
|
+
await this.openHighlighterContainer(isButtonInMoreMenu);
|
|
192161
|
+
const colorPallete = this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer());
|
|
192162
|
+
await colorPallete
|
|
192163
|
+
.locator(`[style*="(${NEETO_EDITOR_SELECTORS.highlightText(colorIndex)})"]` //TODO: Use data-cy once https://github.com/bigbinary/neeto-editor-nano/issues/784 resolves
|
|
192164
|
+
)
|
|
192165
|
+
.click();
|
|
192166
|
+
await this.openHighlighterContainer(isButtonInMoreMenu);
|
|
192167
|
+
await colorPallete
|
|
192168
|
+
.locator(`[style*="(${NEETO_EDITOR_SELECTORS.highlightBg(colorIndex)})"]`) //TODO: Use data-cy once https://github.com/bigbinary/neeto-editor-nano/issues/784 resolves
|
|
192169
|
+
.click();
|
|
192170
|
+
const highlightedText = this.contentField.getByText(randomText);
|
|
192171
|
+
await this.focusText(highlightedText);
|
|
192172
|
+
const textStyle = await highlightedText.getAttribute("style");
|
|
192173
|
+
test$1.expect(textStyle).toContain(NEETO_EDITOR_SELECTORS.highlightText(colorIndex));
|
|
192174
|
+
test$1.expect(textStyle).toContain(NEETO_EDITOR_SELECTORS.highlightBg(colorIndex));
|
|
192175
|
+
return randomText;
|
|
192176
|
+
};
|
|
192177
|
+
this.verifyTextHighlighter = async (isButtonInMoreMenu, highlighterCount = this.highlighterCount) => {
|
|
192178
|
+
const highlightedKeyValuePairs = [];
|
|
192179
|
+
for (let colorIdx = 1; colorIdx <= highlighterCount; colorIdx++) {
|
|
192180
|
+
await this.moveCursorAtBottom();
|
|
192181
|
+
const randomText = await this.highlightText(isButtonInMoreMenu, colorIdx);
|
|
192182
|
+
highlightedKeyValuePairs.push({
|
|
192183
|
+
key: `highlight-${colorIdx}`,
|
|
192184
|
+
value: randomText,
|
|
192185
|
+
});
|
|
192186
|
+
}
|
|
192187
|
+
return highlightedKeyValuePairs;
|
|
192188
|
+
};
|
|
192136
192189
|
this.verifyListModifiers = async (modifier, isButtonInMoreMenu) => {
|
|
192137
192190
|
const modifierKey = modifier;
|
|
192138
192191
|
const listModifierSelector = this.editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
|
|
@@ -192358,7 +192411,7 @@ class EditorPage {
|
|
|
192358
192411
|
codeBlock: isButtonInMoreMenu => this.verifyTextModifiers("codeBlock", isButtonInMoreMenu),
|
|
192359
192412
|
underline: isButtonInMoreMenu => this.verifyTextDeskModifier("underline", isButtonInMoreMenu),
|
|
192360
192413
|
strike: isButtonInMoreMenu => this.verifyTextDeskModifier("strike", isButtonInMoreMenu),
|
|
192361
|
-
highlight: isButtonInMoreMenu => this.
|
|
192414
|
+
highlight: isButtonInMoreMenu => this.verifyTextHighlighter(isButtonInMoreMenu),
|
|
192362
192415
|
bulletList: isButtonInMoreMenu => this.verifyListModifiers("bulletList", isButtonInMoreMenu),
|
|
192363
192416
|
orderedList: isButtonInMoreMenu => this.verifyListModifiers("orderedList", isButtonInMoreMenu),
|
|
192364
192417
|
link: isButtonInMoreMenu => this.verifyEditorLinkButton(this.linkUrl, isButtonInMoreMenu),
|
|
@@ -192378,7 +192431,7 @@ class EditorPage {
|
|
|
192378
192431
|
isButtonInMoreMenu,
|
|
192379
192432
|
}),
|
|
192380
192433
|
};
|
|
192381
|
-
this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, cannedResponseSuccessMessage, } = {}) => {
|
|
192434
|
+
this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, highlighterCount, cannedResponseSuccessMessage, } = {}) => {
|
|
192382
192435
|
const fixedMenuButtons = await this.fixedMenuOptions();
|
|
192383
192436
|
let moreMenuButtons = [];
|
|
192384
192437
|
(await this.moreMenuSelector.isVisible()) &&
|
|
@@ -192388,6 +192441,7 @@ class EditorPage {
|
|
|
192388
192441
|
this.videoPath = videoPath || this.videoPath;
|
|
192389
192442
|
this.imageUrl = imageUrl || this.imageUrl;
|
|
192390
192443
|
this.videoUrl = videoUrl || this.videoUrl;
|
|
192444
|
+
this.highlighterCount = highlighterCount || this.highlighterCount;
|
|
192391
192445
|
this.cannedResponseSuccessMessage = cannedResponseSuccessMessage;
|
|
192392
192446
|
const keysAndValues = [];
|
|
192393
192447
|
for (const button of [...fixedMenuButtons, ...moreMenuButtons]) {
|
|
@@ -192415,7 +192469,7 @@ class EditorPage {
|
|
|
192415
192469
|
do {
|
|
192416
192470
|
randomText = faker.faker.lorem.word(10);
|
|
192417
192471
|
} while (this.wordsUsedInEditor.includes(randomText));
|
|
192418
|
-
await this.contentField.
|
|
192472
|
+
await this.contentField.focus();
|
|
192419
192473
|
await this.moveCursorAtBottom();
|
|
192420
192474
|
await this.page.keyboard.type(randomText);
|
|
192421
192475
|
this.wordsUsedInEditor.push(randomText);
|
|
@@ -193031,13 +193085,12 @@ class ApiKeysPage {
|
|
|
193031
193085
|
await this.page
|
|
193032
193086
|
.getByTestId(COMMON_SELECTORS.checkboxInput("never-expires"))
|
|
193033
193087
|
.uncheck();
|
|
193034
|
-
|
|
193088
|
+
const expiryDateInput = this.page
|
|
193035
193089
|
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
193036
|
-
.getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput)
|
|
193037
|
-
|
|
193038
|
-
|
|
193039
|
-
await
|
|
193040
|
-
await this.page.getByText(expiryDate, { exact: true }).click();
|
|
193090
|
+
.getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput);
|
|
193091
|
+
await expiryDateInput.click();
|
|
193092
|
+
await expiryDateInput.pressSequentially(expiryDate);
|
|
193093
|
+
await expiryDateInput.blur();
|
|
193041
193094
|
}
|
|
193042
193095
|
await this.page.getByTestId(COMMON_SELECTORS.saveChangesButton).click();
|
|
193043
193096
|
await this.neetoPlaywrightUtilities.verifyToast();
|
|
@@ -195403,7 +195456,7 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
195403
195456
|
geolocation: { latitude: 18.553187, longitude: 73.948313 }, // BB Pune office
|
|
195404
195457
|
permissions: ["geolocation"],
|
|
195405
195458
|
launchOptions: {
|
|
195406
|
-
args: ["--js-flags=--max-old-space-size=
|
|
195459
|
+
args: ["--js-flags=--max-old-space-size=6144"],
|
|
195407
195460
|
},
|
|
195408
195461
|
...useOverrides,
|
|
195409
195462
|
},
|