@bigbinary/neeto-playwright-commons 1.13.15 → 1.14.1

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 CHANGED
@@ -472,6 +472,7 @@ const NEETO_FILTERS_SELECTORS = {
472
472
  paneModalCrossIcon: "neeto-filters-close-button",
473
473
  searchTermBlock: "neeto-filters-search-term-block",
474
474
  neetoFiltersFilter: (filterName) => `neeto-filters-${hyphenize(filterName)}-filter`,
475
+ filtersTermBlock: (filterType = "search-term") => `neeto-filters-${hyphenize(filterType)}-block`,
475
476
  };
476
477
 
477
478
  const HELP_CENTER_SELECTORS = {
@@ -4043,6 +4044,21 @@ class CustomCommands {
4043
4044
  await customPageContext.mouse.move(0, 0);
4044
4045
  await test$1.expect(tooltipBox).toBeHidden();
4045
4046
  };
4047
+ this.verifySearchTermBlock = async (searchTerm) => {
4048
+ const filtersSearchTermBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.filtersTermBlock());
4049
+ if (searchTerm) {
4050
+ const textContent = await (filtersSearchTermBlock === null || filtersSearchTermBlock === void 0 ? void 0 : filtersSearchTermBlock.textContent());
4051
+ (textContent === null || textContent === void 0 ? void 0 : textContent.includes(".."))
4052
+ ? await this.verifyTooltip({
4053
+ triggerElement: filtersSearchTermBlock,
4054
+ content: searchTerm,
4055
+ })
4056
+ : await test$1.expect(filtersSearchTermBlock).toContainText(searchTerm);
4057
+ }
4058
+ else {
4059
+ await test$1.expect(filtersSearchTermBlock).toBeHidden();
4060
+ }
4061
+ };
4046
4062
  this.page = page;
4047
4063
  this.responses = [];
4048
4064
  this.request = request;
@@ -12127,7 +12143,7 @@ class MailerUtils {
12127
12143
  const { ids } = await this.queryEmail(messageSearchCriteria, listMessagesFilterCriteria);
12128
12144
  return this.getEmails(ids);
12129
12145
  };
12130
- this.findMessage = async (messageSearchCriteria = {}, { timeout = 10000, receivedAfter = dateTimeOneHourAgo(), } = {}, shouldThrowErrorOnTimeout = true) => {
12146
+ this.findMessage = async (messageSearchCriteria = {}, { timeout = 10000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
12131
12147
  const ids = (await this.neetoPlaywrightUtilities.executeRecursively({
12132
12148
  callback: async () => {
12133
12149
  const { ids } = await this.queryEmail(messageSearchCriteria, {
@@ -12139,7 +12155,7 @@ class MailerUtils {
12139
12155
  const { total } = await this.queryEmail(messageSearchCriteria, {
12140
12156
  receivedAfter,
12141
12157
  });
12142
- return total > 0;
12158
+ return total >= expectedEmailCount;
12143
12159
  },
12144
12160
  timeout,
12145
12161
  }));
@@ -12150,8 +12166,11 @@ class MailerUtils {
12150
12166
  }
12151
12167
  return (await this.getEmails(ids))[0];
12152
12168
  };
12153
- this.findOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
12154
- const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter });
12169
+ this.findOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), expectedEmailCount = 1, }) => {
12170
+ if (!this.accountId) {
12171
+ await this.fastmailApi.authorizeAndSetAccountId();
12172
+ }
12173
+ const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
12155
12174
  return codes === null || codes === void 0 ? void 0 : codes[0];
12156
12175
  };
12157
12176
  this.generateRandomEmail = () => faker.faker.internet.email({
@@ -24269,6 +24288,7 @@ const LIST_MODIFIER_TAGS = {
24269
24288
 
24270
24289
  class EditorPage {
24271
24290
  constructor(page, neetoPlaywrightUtilities, editorWrapper) {
24291
+ this.wordsUsedInEditor = [];
24272
24292
  this.linkUrl = faker.faker.internet.url();
24273
24293
  this.filePath = "../../../e2e/assets/images/BigBinary.png";
24274
24294
  this.imageUrl = "https://picsum.photos/200/300";
@@ -24291,48 +24311,88 @@ class EditorPage {
24291
24311
  };
24292
24312
  this.moreMenuOptions = async () => {
24293
24313
  await this.moreMenuSelector.click();
24294
- const moreMenuButtons = await this.page
24295
- .getByTestId(COMMON_SELECTORS.dropdownContainer)
24296
- .getByRole("button")
24297
- .all();
24298
- return Promise.all(moreMenuButtons.map(async (button) => {
24314
+ const dropdownContainer = this.page.getByTestId(COMMON_SELECTORS.dropdownContainer);
24315
+ const moreMenuButtons = await dropdownContainer.getByRole("button").all();
24316
+ const moreMenuButtonLocators = Promise.all(moreMenuButtons.map(async (button) => {
24299
24317
  const dataCy = await button.getAttribute("data-cy");
24300
24318
  return this.cleanString(dataCy);
24301
24319
  }));
24320
+ await this.moreMenuSelector.click();
24321
+ // eslint-disable-next-line playwright/no-standalone-expect
24322
+ await test$1.expect(dropdownContainer).toBeHidden();
24323
+ return moreMenuButtonLocators;
24302
24324
  };
24303
24325
  this.verifyFontSize = async () => {
24326
+ const fontsAndTexts = [];
24304
24327
  const fontSizeDropdown = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.fontSize);
24305
- await fontSizeDropdown.click();
24306
24328
  const fontSize = Object.keys(FONT_SIZE_SELECTORS);
24307
24329
  for (const font of fontSize) {
24308
24330
  const fontKey = font;
24331
+ const randomText = await this.fillRandomText();
24332
+ await fontSizeDropdown.click();
24309
24333
  await this.editorWrapper
24310
24334
  .getByTestId(FONT_SIZE_SELECTORS[fontKey])
24311
24335
  .click();
24312
- await test$1.expect(this.contentField.getByRole("heading", { level: Number(font.slice(1)) })).toBeVisible();
24313
- await fontSizeDropdown.click();
24336
+ await test$1.expect(this.contentField.getByRole("heading", {
24337
+ level: Number(font.slice(1)),
24338
+ name: randomText,
24339
+ })).toBeVisible();
24340
+ fontsAndTexts.push({
24341
+ key: fontKey,
24342
+ value: randomText,
24343
+ });
24314
24344
  }
24345
+ return fontsAndTexts;
24315
24346
  };
24316
- this.verifyTextModifiers = async (modifier) => {
24347
+ this.verifyTextModifiers = async (modifier, isButtonInMoreMenu) => {
24317
24348
  const modifierKey = modifier;
24318
24349
  const textModifierRole = TEXT_MODIFIER_ROLES[modifierKey];
24350
+ const randomText = await this.fillRandomText();
24319
24351
  const textModifierSelector = this.editorWrapper.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
24352
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24320
24353
  await textModifierSelector.click();
24321
- await test$1.expect(this.contentField.getByRole(textModifierRole)).toBeVisible();
24354
+ await test$1.expect(this.contentField
24355
+ .getByRole(textModifierRole)
24356
+ .filter({ hasText: randomText })).toBeVisible();
24357
+ await this.moveCursorAtBottom();
24358
+ await this.page.keyboard.press("Enter");
24359
+ if (modifierKey !== "codeBlock") {
24360
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24361
+ await textModifierSelector.click();
24362
+ }
24363
+ return [{ key: modifierKey, value: randomText }];
24322
24364
  };
24323
- this.verifyTextDeskModifier = async (modifier) => {
24365
+ this.verifyTextDeskModifier = async (modifier, isButtonInMoreMenu) => {
24324
24366
  const modifierKey = modifier;
24325
24367
  const textModifierSelector = this.editorWrapper.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
24368
+ const randomText = await this.fillRandomText();
24369
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24326
24370
  await textModifierSelector.click();
24327
- await test$1.expect(this.contentField.locator(TEXT_MODIFIER_TAGS[modifierKey])).toBeVisible();
24371
+ await test$1.expect(this.contentField
24372
+ .locator(TEXT_MODIFIER_TAGS[modifierKey])
24373
+ .filter({ hasText: randomText })).toBeVisible();
24374
+ await this.moveCursorAtBottom();
24375
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24376
+ await textModifierSelector.click();
24377
+ return [{ key: modifierKey, value: randomText }];
24328
24378
  };
24329
- this.verifyListModifiers = async (modifier) => {
24379
+ this.verifyListModifiers = async (modifier, isButtonInMoreMenu) => {
24330
24380
  const modifierKey = modifier;
24331
24381
  const listModifierSelector = this.editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
24382
+ const randomText = await this.fillRandomText();
24383
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24384
+ await listModifierSelector.click();
24385
+ await test$1.expect(this.contentField
24386
+ .locator(LIST_MODIFIER_TAGS[modifierKey])
24387
+ .filter({ hasText: randomText })).toBeVisible();
24388
+ await this.moveCursorAtBottom();
24389
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24332
24390
  await listModifierSelector.click();
24333
- await test$1.expect(this.contentField.locator(LIST_MODIFIER_TAGS[modifierKey])).toBeVisible();
24391
+ return [{ key: modifierKey, value: randomText }];
24334
24392
  };
24335
- this.verifyEditorLinkButton = async (linkUrl) => {
24393
+ this.verifyEditorLinkButton = async (linkUrl, isButtonInMoreMenu) => {
24394
+ const randomText = await this.fillRandomText();
24395
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24336
24396
  await this.editorLinkButton.click();
24337
24397
  await this.page
24338
24398
  .getByTestId(NEETO_EDITOR_SELECTORS.addLinkUrlInput)
@@ -24342,10 +24402,12 @@ class EditorPage {
24342
24402
  .click();
24343
24403
  const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
24344
24404
  await test$1.expect(this.contentField.getByRole(linkRole)).toBeVisible();
24345
- await this.page.getByTestId(NEETO_EDITOR_SELECTORS.unlinkButton).click();
24405
+ await this.moveCursorAtBottom();
24406
+ return [{ key: "link", value: randomText }];
24346
24407
  };
24347
- this.verifyEditorAttachmentsButton = async (filePath) => {
24408
+ this.verifyEditorAttachmentsButton = async (filePath, isButtonInMoreMenu, shouldRemoveAttachment = false) => {
24348
24409
  const fileUploaderPromise = this.page.waitForEvent("filechooser");
24410
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24349
24411
  await this.editorAttachmentsButton.click();
24350
24412
  const fileUploader = await fileUploaderPromise;
24351
24413
  const imagePath = Path__namespace.join(__dirname, filePath);
@@ -24354,18 +24416,22 @@ class EditorPage {
24354
24416
  responseUrl: ROUTES.attachment,
24355
24417
  });
24356
24418
  await test$1.expect(this.attachmentPreview).toBeVisible();
24357
- await this.attachmentPreview
24358
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
24359
- .click();
24360
- await this.page
24361
- .getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreviewDeleteButton)
24362
- .click();
24363
- await this.page
24364
- .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
24365
- .click();
24366
- await test$1.expect(this.attachmentPreview).toBeHidden({ timeout: 10000 });
24419
+ if (shouldRemoveAttachment) {
24420
+ await this.attachmentPreview
24421
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
24422
+ .click();
24423
+ await this.page
24424
+ .getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreviewDeleteButton)
24425
+ .click();
24426
+ await this.page
24427
+ .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
24428
+ .click();
24429
+ await test$1.expect(this.attachmentPreview).toBeHidden({ timeout: 10000 });
24430
+ }
24431
+ return [{ key: "attachments", value: filePath }];
24367
24432
  };
24368
- this.verifyImageUploadOption = async ({ imageUrl, filePath, }) => {
24433
+ this.verifyImageUploadOption = async ({ imageUrl, filePath, isButtonInMoreMenu, shouldRemoveImage = false, }) => {
24434
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24369
24435
  await this.imageUploadOption.click();
24370
24436
  const fileUploaderPromise = this.page.waitForEvent("filechooser");
24371
24437
  await this.page
@@ -24380,8 +24446,7 @@ class EditorPage {
24380
24446
  await test$1.expect(this.imageWrapper).toBeHidden({
24381
24447
  timeout: 15000,
24382
24448
  });
24383
- (await this.imageUploadOption.isHidden()) &&
24384
- (await this.moreMenuSelector.click());
24449
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24385
24450
  await this.imageUploadOption.click();
24386
24451
  await this.page
24387
24452
  .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkButton)
@@ -24393,13 +24458,19 @@ class EditorPage {
24393
24458
  .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkSubmitButton)
24394
24459
  .click();
24395
24460
  await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
24396
- await this.imageWrapper.getByTestId(COMMON_SELECTORS.dropdownIcon).click();
24397
- await this.imageUploadDeleteButton.click();
24398
- await test$1.expect(this.imageWrapper).toBeHidden({
24399
- timeout: 15000,
24400
- });
24461
+ if (shouldRemoveImage) {
24462
+ await this.imageWrapper
24463
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
24464
+ .click();
24465
+ await this.imageUploadDeleteButton.click();
24466
+ await test$1.expect(this.imageWrapper).toBeHidden({
24467
+ timeout: 15000,
24468
+ });
24469
+ }
24470
+ return [{ key: "image-upload", value: imageUrl }];
24401
24471
  };
24402
- this.verifyCannedResponseOption = async (cannedResponseSuccessMessage) => {
24472
+ this.verifyCannedResponseOption = async (isButtonInMoreMenu, cannedResponseSuccessMessage) => {
24473
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24403
24474
  await this.cannedResponseOption.click();
24404
24475
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader)).toContainText(DESCRIPTION_EDITOR_TEXTS.cannedResponseHeader);
24405
24476
  await this.page
@@ -24412,23 +24483,32 @@ class EditorPage {
24412
24483
  await this.neetoPlaywrightUtilities.verifyToast({
24413
24484
  message: cannedResponseSuccessMessage,
24414
24485
  });
24486
+ return [
24487
+ { key: "canned-responses", value: cannedResponseSuccessMessage },
24488
+ ];
24415
24489
  };
24416
- this.verifyVideoEmbedOption = async (videoUrl) => {
24490
+ this.verifyVideoEmbedOption = async (videoUrl, isButtonInMoreMenu, shouldRemoveVideo = false) => {
24491
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24417
24492
  await this.videoEmbedOption.click();
24418
24493
  await this.videoEmbedInput.fill(videoUrl);
24419
24494
  await this.page
24420
24495
  .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedSubmit)
24421
24496
  .click();
24422
24497
  await test$1.expect(this.videoWrapperSelector).toBeVisible({ timeout: 15000 });
24423
- await this.videoWrapperSelector
24424
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
24425
- .click();
24426
- await this.imageUploadDeleteButton.click();
24427
- await test$1.expect(this.videoWrapperSelector).toBeHidden({
24428
- timeout: 15000,
24429
- });
24498
+ if (shouldRemoveVideo) {
24499
+ await this.videoWrapperSelector
24500
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
24501
+ .click();
24502
+ await this.imageUploadDeleteButton.click();
24503
+ await test$1.expect(this.videoWrapperSelector).toBeHidden({
24504
+ timeout: 15000,
24505
+ });
24506
+ }
24507
+ return [{ key: "video-embed", value: videoUrl }];
24430
24508
  };
24431
- this.verifyEmojiSelector = async () => {
24509
+ this.verifyEmojiSelector = async (isButtonInMoreMenu) => {
24510
+ const emoji = "👍";
24511
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
24432
24512
  await this.emojiSelector.click();
24433
24513
  const emojiContainer = this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer);
24434
24514
  await test$1.expect(emojiContainer).toBeVisible({
@@ -24438,8 +24518,9 @@ class EditorPage {
24438
24518
  .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
24439
24519
  .fill(EMOJI_LABEL);
24440
24520
  await this.page.keyboard.press("Enter");
24441
- await test$1.expect(this.contentField).toContainText("👍");
24521
+ await test$1.expect(this.contentField).toContainText(emoji);
24442
24522
  await this.page.keyboard.press("Escape");
24523
+ return [{ key: "emoji", value: emoji }];
24443
24524
  };
24444
24525
  this.verifyDynamicVariables = async (dynamicVariables) => {
24445
24526
  for (const { key, value } of dynamicVariables) {
@@ -24452,62 +24533,72 @@ class EditorPage {
24452
24533
  }
24453
24534
  };
24454
24535
  this.buttonsAndVerifications = {
24455
- "font-size": this.verifyFontSize,
24456
- emoji: this.verifyEmojiSelector,
24457
- bold: () => this.verifyTextModifiers("bold"),
24458
- italic: () => this.verifyTextModifiers("italic"),
24459
- code: () => this.verifyTextModifiers("code"),
24460
- blockquote: () => this.verifyTextModifiers("blockquote"),
24461
- codeBlock: () => this.verifyTextModifiers("codeBlock"),
24462
- underline: () => this.verifyTextDeskModifier("underline"),
24463
- strike: () => this.verifyTextDeskModifier("strike"),
24464
- highlight: () => this.verifyTextDeskModifier("highlight"),
24465
- bulletList: () => this.verifyListModifiers("bulletList"),
24466
- orderedList: () => this.verifyListModifiers("orderedList"),
24467
- link: () => this.verifyEditorLinkButton(this.linkUrl),
24468
- attachments: () => this.verifyEditorAttachmentsButton(this.filePath),
24469
- "image-upload": () => this.verifyImageUploadOption({
24536
+ "font-size": () => this.verifyFontSize(),
24537
+ emoji: isButtonInMoreMenu => this.verifyEmojiSelector(isButtonInMoreMenu),
24538
+ bold: isButtonInMoreMenu => this.verifyTextModifiers("bold", isButtonInMoreMenu),
24539
+ italic: isButtonInMoreMenu => this.verifyTextModifiers("italic", isButtonInMoreMenu),
24540
+ code: isButtonInMoreMenu => this.verifyTextModifiers("code", isButtonInMoreMenu),
24541
+ blockquote: isButtonInMoreMenu => this.verifyTextModifiers("blockquote", isButtonInMoreMenu),
24542
+ codeBlock: isButtonInMoreMenu => this.verifyTextModifiers("codeBlock", isButtonInMoreMenu),
24543
+ underline: isButtonInMoreMenu => this.verifyTextDeskModifier("underline", isButtonInMoreMenu),
24544
+ strike: isButtonInMoreMenu => this.verifyTextDeskModifier("strike", isButtonInMoreMenu),
24545
+ highlight: isButtonInMoreMenu => this.verifyTextDeskModifier("highlight", isButtonInMoreMenu),
24546
+ bulletList: isButtonInMoreMenu => this.verifyListModifiers("bulletList", isButtonInMoreMenu),
24547
+ orderedList: isButtonInMoreMenu => this.verifyListModifiers("orderedList", isButtonInMoreMenu),
24548
+ link: isButtonInMoreMenu => this.verifyEditorLinkButton(this.linkUrl, isButtonInMoreMenu),
24549
+ attachments: isButtonInMoreMenu => this.verifyEditorAttachmentsButton(this.filePath, isButtonInMoreMenu),
24550
+ "image-upload": isButtonInMoreMenu => this.verifyImageUploadOption({
24470
24551
  imageUrl: this.imageUrl,
24471
24552
  filePath: this.filePath,
24553
+ isButtonInMoreMenu,
24472
24554
  }),
24473
- "canned-responses": this.verifyCannedResponseOption,
24474
- "video-embed": () => this.verifyVideoEmbedOption(this.videoUrl),
24555
+ "canned-responses": isButtonInMoreMenu => this.verifyCannedResponseOption(isButtonInMoreMenu),
24556
+ "video-embed": isButtonInMoreMenu => this.verifyVideoEmbedOption(this.videoUrl, isButtonInMoreMenu),
24475
24557
  };
24476
- this.verifyDescriptionEditor = async ({ text, dynamicVariables, linkUrl, filePath, imageUrl, videoUrl, cannedResponseSuccessMessage, }) => {
24558
+ this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, filePath, imageUrl, videoUrl, cannedResponseSuccessMessage, } = {}) => {
24477
24559
  const fixedMenuButtons = await this.fixedMenuOptions();
24478
24560
  let moreMenuButtons = [];
24479
24561
  (await this.moreMenuSelector.isVisible()) &&
24480
24562
  (moreMenuButtons = await this.moreMenuOptions());
24481
- const needToSkipDisabling = [
24482
- "link",
24483
- "attachments",
24484
- "image-upload",
24485
- "canned-responses",
24486
- "video-embed",
24487
- "emoji",
24488
- ];
24489
24563
  this.linkUrl = linkUrl || this.linkUrl;
24490
24564
  this.filePath = filePath || this.filePath;
24491
24565
  this.imageUrl = imageUrl || this.imageUrl;
24492
24566
  this.videoUrl = videoUrl || this.videoUrl;
24493
24567
  this.cannedResponseSuccessMessage = cannedResponseSuccessMessage;
24494
- await this.contentField.fill(text);
24495
- for (const button of fixedMenuButtons) {
24496
- await this.contentField.click({ clickCount: 3 });
24497
- await this.buttonsAndVerifications[button]();
24498
- !needToSkipDisabling.includes(button) &&
24499
- (await this.editorWrapper.getByTestId(optionSelector(button)).click());
24500
- }
24501
- for (const button of moreMenuButtons) {
24502
- await this.contentField.click({ clickCount: 3 });
24503
- await this.moreMenuSelector.click();
24504
- await this.buttonsAndVerifications[button]();
24505
- if (!needToSkipDisabling.includes(button)) {
24506
- await this.moreMenuSelector.click();
24507
- await this.editorWrapper.getByTestId(optionSelector(button)).click();
24508
- }
24568
+ const keysAndValues = [];
24569
+ for (const button of [...fixedMenuButtons, ...moreMenuButtons]) {
24570
+ const isMoreMenuButton = moreMenuButtons.includes(button);
24571
+ const keyValuesForButton = await this.buttonsAndVerifications[button](isMoreMenuButton);
24572
+ keysAndValues.push(...keyValuesForButton);
24509
24573
  }
24510
24574
  dynamicVariables && (await this.verifyDynamicVariables(dynamicVariables));
24575
+ return keysAndValues;
24576
+ };
24577
+ this.moveCursorAtBottom = async () => {
24578
+ const platform = require$$0$2.platform();
24579
+ if (platform === "darwin") {
24580
+ await this.page.keyboard.press("Meta+ArrowRight");
24581
+ await this.page.keyboard.press("Meta+ArrowDown");
24582
+ }
24583
+ else {
24584
+ await this.page.keyboard.press("End");
24585
+ await this.page.keyboard.press("PageDown");
24586
+ }
24587
+ await this.page.keyboard.press("Enter");
24588
+ };
24589
+ this.fillRandomText = async () => {
24590
+ let randomText;
24591
+ do {
24592
+ randomText = faker.faker.lorem.word(10);
24593
+ } while (this.wordsUsedInEditor.includes(randomText));
24594
+ await this.contentField.click();
24595
+ await this.moveCursorAtBottom();
24596
+ await this.page.keyboard.type(randomText);
24597
+ this.wordsUsedInEditor.push(randomText);
24598
+ const randomTextLocator = this.contentField.getByText(randomText);
24599
+ await randomTextLocator.scrollIntoViewIfNeeded();
24600
+ await randomTextLocator.click({ clickCount: 3 });
24601
+ return randomText;
24511
24602
  };
24512
24603
  this.page = page;
24513
24604
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;