@bigbinary/neeto-playwright-commons 2.1.4 → 2.1.5
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 +59 -42
- package/index.cjs.js.map +1 -1
- package/index.d.ts +15 -0
- package/index.js +59 -42
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -6266,17 +6266,14 @@ class CustomCommands {
|
|
|
6266
6266
|
await test.expect(locator).toBeChecked({ checked: shouldBeChecked });
|
|
6267
6267
|
}).toPass({ timeout: 15_000 });
|
|
6268
6268
|
moveCursorAtBottom = async () => {
|
|
6269
|
-
const
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
await this.page.keyboard.press("End");
|
|
6276
|
-
await this.page.keyboard.press("PageDown");
|
|
6277
|
-
}
|
|
6269
|
+
const isMacOS = require$$0$5.platform() === "darwin";
|
|
6270
|
+
const rightArrowKey = isMacOS ? "Meta+ArrowRight" : "End";
|
|
6271
|
+
const downArrowKey = isMacOS ? "Meta+ArrowDown" : "PageDown";
|
|
6272
|
+
await this.page.keyboard.press(rightArrowKey);
|
|
6273
|
+
await this.page.keyboard.press(rightArrowKey);
|
|
6274
|
+
await this.page.keyboard.press(downArrowKey);
|
|
6278
6275
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
6279
|
-
await this.page.waitForTimeout(
|
|
6276
|
+
await this.page.waitForTimeout(150); // Adding some delay for DOM to react
|
|
6280
6277
|
await this.page.keyboard.press("Enter");
|
|
6281
6278
|
};
|
|
6282
6279
|
}
|
|
@@ -118876,7 +118873,7 @@ class HelpAndProfilePage {
|
|
|
118876
118873
|
test.expect(bodyElement).not.toHaveClass(THEMES_TEXTS.lightThemeClass),
|
|
118877
118874
|
]);
|
|
118878
118875
|
await test.expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer).filter({
|
|
118879
|
-
has: this.page.getByTestId(PROFILE_SECTION_SELECTORS.
|
|
118876
|
+
has: this.page.getByTestId(PROFILE_SECTION_SELECTORS.profileExpandMenuBtn),
|
|
118880
118877
|
})).toHaveScreenshot(expectedScreenshot, { maxDiffPixelRatio: 0.1 });
|
|
118881
118878
|
});
|
|
118882
118879
|
};
|
|
@@ -119899,7 +119896,7 @@ class EditorPage {
|
|
|
119899
119896
|
calloutSelector;
|
|
119900
119897
|
videoUploadOption;
|
|
119901
119898
|
todoListSelector;
|
|
119902
|
-
filePath = "../../../e2e/assets/images/
|
|
119899
|
+
filePath = "../../../e2e/assets/images/sample.png";
|
|
119903
119900
|
videoPath = "../../../e2e/assets/files/sample.mp4";
|
|
119904
119901
|
linkUrl = faker.faker.internet.url();
|
|
119905
119902
|
imageUrl = "https://picsum.photos/200/300";
|
|
@@ -119964,10 +119961,9 @@ class EditorPage {
|
|
|
119964
119961
|
};
|
|
119965
119962
|
verifyFontSize = async () => {
|
|
119966
119963
|
const fontsAndTexts = [];
|
|
119967
|
-
|
|
119968
|
-
|
|
119969
|
-
|
|
119970
|
-
await fontSizeDropdownButton.click();
|
|
119964
|
+
await this.page
|
|
119965
|
+
.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize)
|
|
119966
|
+
.click();
|
|
119971
119967
|
const headingButtons = await this.page
|
|
119972
119968
|
.getByTestId(COMMON_SELECTORS.dropdownContainer)
|
|
119973
119969
|
.getByRole("button")
|
|
@@ -119989,10 +119985,7 @@ class EditorPage {
|
|
|
119989
119985
|
level: Number(headingLevel?.slice(1)),
|
|
119990
119986
|
name: randomText,
|
|
119991
119987
|
})).toBeVisible();
|
|
119992
|
-
fontsAndTexts.push({
|
|
119993
|
-
key: fontKey,
|
|
119994
|
-
value: randomText,
|
|
119995
|
-
});
|
|
119988
|
+
fontsAndTexts.push({ key: fontKey, value: randomText });
|
|
119996
119989
|
}
|
|
119997
119990
|
return fontsAndTexts;
|
|
119998
119991
|
};
|
|
@@ -120035,18 +120028,13 @@ class EditorPage {
|
|
|
120035
120028
|
.click();
|
|
120036
120029
|
await test.expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5_000 });
|
|
120037
120030
|
}).toPass({ timeout: 30_000 });
|
|
120038
|
-
focusText = (textLocator) => {
|
|
120039
|
-
|
|
120040
|
-
|
|
120041
|
-
|
|
120042
|
-
|
|
120043
|
-
|
|
120044
|
-
|
|
120045
|
-
await test.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
|
|
120046
|
-
timeout: 5_000,
|
|
120047
|
-
});
|
|
120048
|
-
}).toPass({ timeout: 20_000 });
|
|
120049
|
-
};
|
|
120031
|
+
focusText = (textLocator) => test.expect(async () => {
|
|
120032
|
+
await textLocator.click();
|
|
120033
|
+
await this.page.keyboard.press(require$$0$5.platform() === "darwin" ? "Meta+ArrowRight" : "End");
|
|
120034
|
+
await test.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
|
|
120035
|
+
timeout: 5_000,
|
|
120036
|
+
});
|
|
120037
|
+
}).toPass({ timeout: 20_000 });
|
|
120050
120038
|
highlightText = async (isButtonInMoreMenu, colorIndex) => {
|
|
120051
120039
|
const randomText = await this.fillRandomText();
|
|
120052
120040
|
await this.openHighlighterContainer(isButtonInMoreMenu);
|
|
@@ -120145,9 +120133,7 @@ class EditorPage {
|
|
|
120145
120133
|
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
120146
120134
|
.click();
|
|
120147
120135
|
await this.uploadDeleteButton.click();
|
|
120148
|
-
await test.expect(this.imageWrapper).toBeHidden({
|
|
120149
|
-
timeout: 15_000,
|
|
120150
|
-
});
|
|
120136
|
+
await test.expect(this.imageWrapper).toBeHidden({ timeout: 15_000 });
|
|
120151
120137
|
}
|
|
120152
120138
|
return [{ key: "image-upload", value: imagePath }];
|
|
120153
120139
|
};
|
|
@@ -120193,9 +120179,7 @@ class EditorPage {
|
|
|
120193
120179
|
isButtonInMoreMenu && (await this.moreMenuSelector.click());
|
|
120194
120180
|
await this.emojiSelector.click();
|
|
120195
120181
|
const emojiContainer = this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer);
|
|
120196
|
-
await test.expect(emojiContainer).toBeVisible({
|
|
120197
|
-
timeout: 10_000,
|
|
120198
|
-
});
|
|
120182
|
+
await test.expect(emojiContainer).toBeVisible({ timeout: 10_000 });
|
|
120199
120183
|
await emojiContainer
|
|
120200
120184
|
.getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
|
|
120201
120185
|
.fill(EMOJI_LABEL);
|
|
@@ -120259,9 +120243,7 @@ class EditorPage {
|
|
|
120259
120243
|
.getByTestId(COMMON_SELECTORS.dropdownIcon)
|
|
120260
120244
|
.click();
|
|
120261
120245
|
await this.uploadDeleteButton.click();
|
|
120262
|
-
await test.expect(this.imageWrapper).toBeHidden({
|
|
120263
|
-
timeout: 15_000,
|
|
120264
|
-
});
|
|
120246
|
+
await test.expect(this.imageWrapper).toBeHidden({ timeout: 15_000 });
|
|
120265
120247
|
}
|
|
120266
120248
|
return [{ key: "video-upload", value: this.videoPath }];
|
|
120267
120249
|
};
|
|
@@ -120354,9 +120336,44 @@ class EditorPage {
|
|
|
120354
120336
|
this.wordsUsedInEditor.push(randomText);
|
|
120355
120337
|
const randomTextLocator = this.contentField.getByText(randomText);
|
|
120356
120338
|
await randomTextLocator.scrollIntoViewIfNeeded();
|
|
120357
|
-
await randomTextLocator.
|
|
120339
|
+
const box = await randomTextLocator.boundingBox();
|
|
120340
|
+
await randomTextLocator.click({
|
|
120341
|
+
clickCount: 3,
|
|
120342
|
+
...(box && { position: { x: box.width * 0.99, y: box.height / 2 } }),
|
|
120343
|
+
});
|
|
120358
120344
|
return randomText;
|
|
120359
120345
|
};
|
|
120346
|
+
verifyDescriptionPreview = (previewLocator, keyValuePairs) => Promise.all(keyValuePairs.flatMap(({ key, value }) => {
|
|
120347
|
+
const elementReplacement = {
|
|
120348
|
+
bold: "strong",
|
|
120349
|
+
italic: "em",
|
|
120350
|
+
underline: "u",
|
|
120351
|
+
link: "a",
|
|
120352
|
+
strike: "s",
|
|
120353
|
+
bulletList: "ul li",
|
|
120354
|
+
orderedList: "ol li",
|
|
120355
|
+
codeBlock: "pre",
|
|
120356
|
+
emoji: "span",
|
|
120357
|
+
};
|
|
120358
|
+
if (key.includes("highlight")) {
|
|
120359
|
+
const highlightIndex = key.split("-")[1];
|
|
120360
|
+
return test.expect(previewLocator.locator(`span[style*="background-color: var(${NEETO_EDITOR_SELECTORS.highlightBg(Number(highlightIndex))})"][style*="color: var(${NEETO_EDITOR_SELECTORS.highlightText(Number(highlightIndex))})"]`, { hasText: value })).toBeVisible();
|
|
120361
|
+
}
|
|
120362
|
+
if (key === "todoList") {
|
|
120363
|
+
return test.expect(previewLocator.locator(NEETO_EDITOR_SELECTORS.todoList, {
|
|
120364
|
+
hasText: value,
|
|
120365
|
+
})).toBeVisible();
|
|
120366
|
+
}
|
|
120367
|
+
const replacement = elementReplacement?.[key] ?? key;
|
|
120368
|
+
if (value === undefined) {
|
|
120369
|
+
return test.expect(
|
|
120370
|
+
// eslint-disable-next-line playwright/no-nth-methods
|
|
120371
|
+
previewLocator.locator(replacement).first()).toBeVisible();
|
|
120372
|
+
}
|
|
120373
|
+
return test.expect(previewLocator.locator(key === "image-upload"
|
|
120374
|
+
? `img[src*="sample"]`
|
|
120375
|
+
: `${replacement}:has-text("${value}")`)).toBeVisible();
|
|
120376
|
+
}));
|
|
120360
120377
|
verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, highlighterCount, cannedResponseSuccessMessage, } = {}) => {
|
|
120361
120378
|
this.linkUrl = linkUrl || this.linkUrl;
|
|
120362
120379
|
this.filePath = filePath || this.filePath;
|