@bigbinary/neeto-playwright-commons 1.26.3 → 1.26.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 CHANGED
@@ -3,6 +3,7 @@
3
3
  var neetoCist = require('@bigbinary/neeto-cist');
4
4
  var faker = require('@faker-js/faker');
5
5
  var require$$0$4 = require('fs');
6
+ var require$$0$5 = require('os');
6
7
  var path$1 = require('path');
7
8
  var test = require('@playwright/test');
8
9
  var playwrightI18nextFixture = require('playwright-i18next-fixture');
@@ -10,15 +11,14 @@ var require$$0$3 = require('util');
10
11
  var ramda = require('ramda');
11
12
  var child_process = require('child_process');
12
13
  var dayjs = require('dayjs');
13
- var require$$0$6 = require('stream');
14
+ var require$$0$7 = require('stream');
14
15
  var node_module = require('node:module');
15
- var require$$0$5 = require('buffer');
16
+ var require$$0$6 = require('buffer');
16
17
  var require$$1$2 = require('string_decoder');
17
- var require$$0$7 = require('crypto');
18
+ var require$$0$8 = require('crypto');
18
19
  var require$$1$3 = require('zlib');
19
- var require$$0$8 = require('assert');
20
+ var require$$0$9 = require('assert');
20
21
  var require$$0$a = require('tty');
21
- var require$$0$9 = require('os');
22
22
  var stealth$1 = require('puppeteer-extra-plugin-stealth');
23
23
  var require$$1$4 = require('events');
24
24
  var timezone = require('dayjs/plugin/timezone');
@@ -4996,6 +4996,8 @@ const NEETO_EDITOR_SELECTORS = {
4996
4996
  neetoEditorHighlightTextColor: (textColorIndex) => `neeto-editor-highlight-text-color-dot-${textColorIndex}`,
4997
4997
  neetoEditorHighlightBgColor: (bgColorIndex) => `neeto-editor-highlight-background-color-dot-${bgColorIndex}`,
4998
4998
  todoList: "[data-type='todoList']",
4999
+ commandListItem: (index) => `neeto-editor-command-list-item-${index}`,
5000
+ itemBlockHeading: "neeto-editor-command-list-item-block-heading",
4999
5001
  };
5000
5002
  const NEETO_TEXT_MODIFIER_SELECTORS = {
5001
5003
  strike: optionSelector("strike"),
@@ -5217,6 +5219,7 @@ const ROLES_SELECTORS = {
5217
5219
  roleCell: (roleName) => `${neetoCist.hyphenate(roleName)}-role-cell`,
5218
5220
  tablePermissionCheckbox: "ntm-roles-table-permission-checkbox",
5219
5221
  descriptionInputError: "description-input-error",
5222
+ permissionSubCategoryCard: (index) => `ntm-roles-permission-sub-category-card-${index}`,
5220
5223
  };
5221
5224
 
5222
5225
  const SIGNUP_SELECTORS = {
@@ -5874,6 +5877,20 @@ class CustomCommands {
5874
5877
  isChecked !== shouldBeChecked && (await locator.click());
5875
5878
  await test.expect(locator).toBeChecked({ checked: shouldBeChecked });
5876
5879
  }).toPass({ timeout: 15000 });
5880
+ this.moveCursorAtBottom = async () => {
5881
+ const platform = require$$0$5.platform();
5882
+ if (platform === "darwin") {
5883
+ await this.page.keyboard.press("Meta+ArrowRight");
5884
+ await this.page.keyboard.press("Meta+ArrowDown");
5885
+ }
5886
+ else {
5887
+ await this.page.keyboard.press("End");
5888
+ await this.page.keyboard.press("PageDown");
5889
+ }
5890
+ // eslint-disable-next-line playwright/no-wait-for-timeout
5891
+ await this.page.waitForTimeout(100); // Adding some delay for DOM to react
5892
+ await this.page.keyboard.press("Enter");
5893
+ };
5877
5894
  this.page = page;
5878
5895
  this.responses = [];
5879
5896
  this.request = request;
@@ -5900,7 +5917,7 @@ function requireSafer () {
5900
5917
  if (hasRequiredSafer) return safer_1;
5901
5918
  hasRequiredSafer = 1;
5902
5919
 
5903
- var buffer = require$$0$5;
5920
+ var buffer = require$$0$6;
5904
5921
  var Buffer = buffer.Buffer;
5905
5922
 
5906
5923
  var safer = {};
@@ -27541,7 +27558,7 @@ function requireMimeNode () {
27541
27558
  const libmime = requireLibmime();
27542
27559
  const libqp = requireLibqp();
27543
27560
  const libbase64 = requireLibbase64();
27544
- const PassThrough = require$$0$6.PassThrough;
27561
+ const PassThrough = require$$0$7.PassThrough;
27545
27562
  const pathlib = path$1;
27546
27563
 
27547
27564
  class MimeNode {
@@ -27810,7 +27827,7 @@ function requireMessageSplitter () {
27810
27827
  if (hasRequiredMessageSplitter) return messageSplitter;
27811
27828
  hasRequiredMessageSplitter = 1;
27812
27829
 
27813
- const Transform = require$$0$6.Transform;
27830
+ const Transform = require$$0$7.Transform;
27814
27831
  const MimeNode = requireMimeNode();
27815
27832
 
27816
27833
  const MAX_HEAD_SIZE = 1 * 1024 * 1024;
@@ -28240,7 +28257,7 @@ function requireMessageJoiner () {
28240
28257
  if (hasRequiredMessageJoiner) return messageJoiner;
28241
28258
  hasRequiredMessageJoiner = 1;
28242
28259
 
28243
- const Transform = require$$0$6.Transform;
28260
+ const Transform = require$$0$7.Transform;
28244
28261
 
28245
28262
  class MessageJoiner extends Transform {
28246
28263
  constructor() {
@@ -28280,7 +28297,7 @@ function requireFlowedDecoder () {
28280
28297
 
28281
28298
  // Helper class to rewrite nodes with specific mime type
28282
28299
 
28283
- const Transform = require$$0$6.Transform;
28300
+ const Transform = require$$0$7.Transform;
28284
28301
  const libmime = requireLibmime();
28285
28302
 
28286
28303
  /**
@@ -28343,7 +28360,7 @@ function requireNodeRewriter () {
28343
28360
 
28344
28361
  // Helper class to rewrite nodes with specific mime type
28345
28362
 
28346
- const Transform = require$$0$6.Transform;
28363
+ const Transform = require$$0$7.Transform;
28347
28364
  const FlowedDecoder = requireFlowedDecoder();
28348
28365
 
28349
28366
  /**
@@ -28545,7 +28562,7 @@ function requireNodeStreamer () {
28545
28562
 
28546
28563
  // Helper class to rewrite nodes with specific mime type
28547
28564
 
28548
- const Transform = require$$0$6.Transform;
28565
+ const Transform = require$$0$7.Transform;
28549
28566
  const FlowedDecoder = requireFlowedDecoder();
28550
28567
 
28551
28568
  /**
@@ -28672,7 +28689,7 @@ function requireChunkedPassthrough () {
28672
28689
  if (hasRequiredChunkedPassthrough) return chunkedPassthrough;
28673
28690
  hasRequiredChunkedPassthrough = 1;
28674
28691
 
28675
- const { Transform } = require$$0$6;
28692
+ const { Transform } = require$$0$7;
28676
28693
 
28677
28694
  class ChunkedPassthrough extends Transform {
28678
28695
  constructor(options = {}) {
@@ -29568,8 +29585,8 @@ function requireStreamHash () {
29568
29585
  if (hasRequiredStreamHash) return streamHash;
29569
29586
  hasRequiredStreamHash = 1;
29570
29587
 
29571
- const crypto = require$$0$7;
29572
- const Transform = require$$0$6.Transform;
29588
+ const crypto = require$$0$8;
29589
+ const Transform = require$$0$7.Transform;
29573
29590
 
29574
29591
  class StreamHash extends Transform {
29575
29592
  constructor(attachment, algo) {
@@ -51952,7 +51969,7 @@ function requireMailParser () {
51952
51969
  const mailsplit = requireMailsplit();
51953
51970
  const libmime = requireLibmime();
51954
51971
  const addressparser = requireAddressparser();
51955
- const Transform = require$$0$6.Transform;
51972
+ const Transform = require$$0$7.Transform;
51956
51973
  const Splitter = mailsplit.Splitter;
51957
51974
  const ChunkedPassthrough = mailsplit.ChunkedPassthrough;
51958
51975
  const punycode = require$$4$2;
@@ -66506,7 +66523,7 @@ function requireChunkstream () {
66506
66523
  hasRequiredChunkstream = 1;
66507
66524
 
66508
66525
  let util = require$$0$3;
66509
- let Stream = require$$0$6;
66526
+ let Stream = require$$0$7;
66510
66527
 
66511
66528
  let ChunkStream = (chunkstream.exports = function () {
66512
66529
  Stream.call(this);
@@ -68475,7 +68492,7 @@ function requirePackerAsync () {
68475
68492
  hasRequiredPackerAsync = 1;
68476
68493
 
68477
68494
  let util = require$$0$3;
68478
- let Stream = require$$0$6;
68495
+ let Stream = require$$0$7;
68479
68496
  let constants = requireConstants$4();
68480
68497
  let Packer = requirePacker();
68481
68498
 
@@ -68536,11 +68553,11 @@ function requireSyncInflate () {
68536
68553
  hasRequiredSyncInflate = 1;
68537
68554
  (function (module, exports) {
68538
68555
 
68539
- let assert = require$$0$8.ok;
68556
+ let assert = require$$0$9.ok;
68540
68557
  let zlib = require$$1$3;
68541
68558
  let util = require$$0$3;
68542
68559
 
68543
- let kMaxLength = require$$0$5.kMaxLength;
68560
+ let kMaxLength = require$$0$6.kMaxLength;
68544
68561
 
68545
68562
  function Inflate(opts) {
68546
68563
  if (!(this instanceof Inflate)) {
@@ -68997,7 +69014,7 @@ function requirePng () {
68997
69014
  hasRequiredPng = 1;
68998
69015
 
68999
69016
  let util = require$$0$3;
69000
- let Stream = require$$0$6;
69017
+ let Stream = require$$0$7;
69001
69018
  let Parser = requireParserAsync();
69002
69019
  let Packer = requirePackerAsync();
69003
69020
  let PNGSync = requirePngSync();
@@ -104718,7 +104735,7 @@ var hasRequiredSupportsColor;
104718
104735
  function requireSupportsColor () {
104719
104736
  if (hasRequiredSupportsColor) return supportsColor_1;
104720
104737
  hasRequiredSupportsColor = 1;
104721
- const os = require$$0$9;
104738
+ const os = require$$0$5;
104722
104739
  const hasFlag = requireHasFlag();
104723
104740
 
104724
104741
  const env = process.env;
@@ -106189,7 +106206,7 @@ function requirePath () {
106189
106206
  hasRequiredPath = 1;
106190
106207
  Object.defineProperty(path, "__esModule", { value: true });
106191
106208
  path.convertPosixPathToPattern = path.convertWindowsPathToPattern = path.convertPathToPattern = path.escapePosixPath = path.escapeWindowsPath = path.escape = path.removeLeadingDotSegment = path.makeAbsolute = path.unixify = void 0;
106192
- const os = require$$0$9;
106209
+ const os = require$$0$5;
106193
106210
  const path$2 = path$1;
106194
106211
  const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
106195
106212
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
@@ -106456,7 +106473,7 @@ function requireGlobParent () {
106456
106473
 
106457
106474
  var isGlob = requireIsGlob();
106458
106475
  var pathPosixDirname = path$1.posix.dirname;
106459
- var isWin32 = require$$0$9.platform() === 'win32';
106476
+ var isWin32 = require$$0$5.platform() === 'win32';
106460
106477
 
106461
106478
  var slash = '/';
106462
106479
  var backslash = /\\/g;
@@ -110849,7 +110866,7 @@ function requireMerge2 () {
110849
110866
  * Copyright (c) 2014-2020 Teambition
110850
110867
  * Licensed under the MIT license.
110851
110868
  */
110852
- const Stream = require$$0$6;
110869
+ const Stream = require$$0$7;
110853
110870
  const PassThrough = Stream.PassThrough;
110854
110871
  const slice = Array.prototype.slice;
110855
110872
 
@@ -112341,7 +112358,7 @@ function requireStream$2 () {
112341
112358
  if (hasRequiredStream$2) return stream$2;
112342
112359
  hasRequiredStream$2 = 1;
112343
112360
  Object.defineProperty(stream$2, "__esModule", { value: true });
112344
- const stream_1 = require$$0$6;
112361
+ const stream_1 = require$$0$7;
112345
112362
  const async_1 = requireAsync$3();
112346
112363
  class StreamProvider {
112347
112364
  constructor(_root, _settings) {
@@ -112593,7 +112610,7 @@ function requireStream$1 () {
112593
112610
  if (hasRequiredStream$1) return stream$1;
112594
112611
  hasRequiredStream$1 = 1;
112595
112612
  Object.defineProperty(stream$1, "__esModule", { value: true });
112596
- const stream_1 = require$$0$6;
112613
+ const stream_1 = require$$0$7;
112597
112614
  const fsStat = requireOut$3();
112598
112615
  const fsWalk = requireOut$1();
112599
112616
  const reader_1 = requireReader();
@@ -113111,7 +113128,7 @@ function requireStream () {
113111
113128
  if (hasRequiredStream) return stream;
113112
113129
  hasRequiredStream = 1;
113113
113130
  Object.defineProperty(stream, "__esModule", { value: true });
113114
- const stream_1 = require$$0$6;
113131
+ const stream_1 = require$$0$7;
113115
113132
  const stream_2 = requireStream$1();
113116
113133
  const provider_1 = requireProvider();
113117
113134
  class ProviderStream extends provider_1.default {
@@ -113238,7 +113255,7 @@ function requireSettings () {
113238
113255
  Object.defineProperty(exports, "__esModule", { value: true });
113239
113256
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
113240
113257
  const fs = require$$0$4;
113241
- const os = require$$0$9;
113258
+ const os = require$$0$5;
113242
113259
  /**
113243
113260
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
113244
113261
  * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
@@ -117188,6 +117205,183 @@ const LIST_MODIFIER_TAGS = {
117188
117205
  orderedList: "ol",
117189
117206
  };
117190
117207
 
117208
+ class SlashCommandEditorPage {
117209
+ constructor(page, neetoPlaywrightUtilities, editorWrapper) {
117210
+ this.wordsUsedInEditor = [];
117211
+ this.filePath = "../../../e2e/assets/images/BigBinary.png";
117212
+ this.linkUrl = faker.faker.internet.url();
117213
+ this.imageUrl = "https://picsum.photos/200/300";
117214
+ this.openSlashCommands = async () => {
117215
+ await this.editorWrapper
117216
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
117217
+ .focus();
117218
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117219
+ await this.page.keyboard.press("/");
117220
+ await test.expect(this.page.locator(".neeto-editor-slash-commands__wrapper") //TODO: use data-testid once https://github.com/neetozone/neeto-editor/issues/1704 resolves
117221
+ ).toBeVisible();
117222
+ };
117223
+ this.slashCommandsOptions = async () => {
117224
+ await this.openSlashCommands();
117225
+ const slashCommandButtonTexts = await this.page
117226
+ .getByTestId(NEETO_EDITOR_SELECTORS.itemBlockHeading)
117227
+ .allInnerTexts();
117228
+ return slashCommandButtonTexts;
117229
+ };
117230
+ this.verifyFontSize = async (fontSize) => {
117231
+ const randomText = await this.fillRandomText();
117232
+ if (fontSize === "normal") {
117233
+ await test.expect(this.contentField.getByRole("paragraph").filter({ hasText: randomText })).toBeVisible();
117234
+ }
117235
+ else {
117236
+ await test.expect(this.contentField.getByRole("heading", {
117237
+ level: Number(fontSize),
117238
+ name: randomText,
117239
+ })).toBeVisible();
117240
+ return [{ key: `h${fontSize}`, value: randomText }];
117241
+ }
117242
+ };
117243
+ this.verifyTextModifiers = async (modifier) => {
117244
+ const modifierKey = modifier;
117245
+ const textModifierRole = TEXT_MODIFIER_ROLES[modifierKey];
117246
+ const randomText = await this.fillRandomText();
117247
+ await test.expect(this.contentField
117248
+ .getByRole(textModifierRole)
117249
+ .filter({ hasText: randomText })).toBeVisible();
117250
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117251
+ modifierKey === "codeBlock" && (await this.page.keyboard.press("Enter"));
117252
+ return [{ key: modifierKey, value: randomText }];
117253
+ };
117254
+ this.verifyTextDeskModifier = async (modifier) => {
117255
+ const modifierKey = modifier;
117256
+ const randomText = await this.fillRandomText();
117257
+ await test.expect(this.contentField
117258
+ .locator(TEXT_MODIFIER_TAGS[modifierKey])
117259
+ .filter({ hasText: randomText })).toBeVisible();
117260
+ return [{ key: modifierKey, value: randomText }];
117261
+ };
117262
+ this.verifyListModifiers = async (modifier) => {
117263
+ const modifierKey = modifier;
117264
+ const randomText = await this.fillRandomText();
117265
+ await test.expect(this.contentField
117266
+ .locator(LIST_MODIFIER_TAGS[modifierKey])
117267
+ .filter({ hasText: randomText })).toBeVisible();
117268
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117269
+ return [{ key: modifierKey, value: randomText }];
117270
+ };
117271
+ this.verifyEditorLinkButton = async (linkUrl) => {
117272
+ const randomText = this.getRandomText();
117273
+ await this.page
117274
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkTextField)
117275
+ .fill(randomText);
117276
+ await this.page
117277
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkUrlInput)
117278
+ .fill(linkUrl);
117279
+ await this.page
117280
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkDoneButton)
117281
+ .click();
117282
+ await test.expect(this.contentField.getByRole("link")).toBeVisible();
117283
+ return [{ key: "link", value: randomText }];
117284
+ };
117285
+ this.verifyEmojiSelector = async () => {
117286
+ const emoji = "👍";
117287
+ const emojiContainer = this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer);
117288
+ await test.expect(emojiContainer).toBeVisible({
117289
+ timeout: 10000,
117290
+ });
117291
+ await emojiContainer
117292
+ .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
117293
+ .fill(EMOJI_LABEL);
117294
+ await this.page.keyboard.press("Enter");
117295
+ await test.expect(this.contentField).toContainText(emoji);
117296
+ return [{ key: "emoji", value: emoji }];
117297
+ };
117298
+ this.verifyImageUploadOption = async (filePath, shouldRemoveImage = false) => {
117299
+ await test.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.restrictionMessage)).toBeVisible();
117300
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
117301
+ await this.page
117302
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.browseText)
117303
+ .click();
117304
+ const fileUploader = await fileUploaderPromise;
117305
+ const imagePath = path__namespace.join(__dirname, filePath);
117306
+ await fileUploader.setFiles(imagePath);
117307
+ await test.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
117308
+ if (shouldRemoveImage) {
117309
+ await this.imageWrapper
117310
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
117311
+ .click();
117312
+ await this.uploadDeleteButton.click();
117313
+ await test.expect(this.imageWrapper).toBeHidden({
117314
+ timeout: 15000,
117315
+ });
117316
+ }
117317
+ return [{ key: "image-upload", value: imagePath }];
117318
+ };
117319
+ this.verifyDividerModifier = () => test.expect(this.contentField.locator("hr")).toBeVisible();
117320
+ this.slashCommandsAndVerifications = {
117321
+ normalText: () => this.verifyFontSize("normal"),
117322
+ heading1: () => this.verifyFontSize(1),
117323
+ heading2: () => this.verifyFontSize(2),
117324
+ heading3: () => this.verifyFontSize(3),
117325
+ heading4: () => this.verifyFontSize(4),
117326
+ heading5: () => this.verifyFontSize(5),
117327
+ bold: () => this.verifyTextModifiers("bold"),
117328
+ italic: () => this.verifyTextModifiers("italic"),
117329
+ blockQuote: () => this.verifyTextModifiers("blockquote"),
117330
+ codeBlock: () => this.verifyTextModifiers("codeBlock"),
117331
+ underline: () => this.verifyTextDeskModifier("underline"),
117332
+ numberedList: () => this.verifyListModifiers("orderedList"),
117333
+ bulletList: () => this.verifyListModifiers("bulletList"),
117334
+ link: () => this.verifyEditorLinkButton(this.linkUrl),
117335
+ image: () => this.verifyImageUploadOption(this.filePath),
117336
+ emoji: () => this.verifyEmojiSelector(),
117337
+ divider: () => this.verifyDividerModifier(),
117338
+ };
117339
+ this.getRandomText = () => {
117340
+ let randomText;
117341
+ do {
117342
+ randomText = faker.faker.lorem.word(10);
117343
+ } while (this.wordsUsedInEditor.includes(randomText));
117344
+ return randomText;
117345
+ };
117346
+ this.fillRandomText = async () => {
117347
+ const randomText = this.getRandomText();
117348
+ await this.page.keyboard.type(randomText);
117349
+ this.wordsUsedInEditor.push(randomText);
117350
+ const randomTextLocator = this.contentField.getByText(randomText);
117351
+ await randomTextLocator.scrollIntoViewIfNeeded();
117352
+ return randomText;
117353
+ };
117354
+ this.verifySlashCommandEditor = async ({ linkUrl, filePath, imageUrl, } = {}) => {
117355
+ this.linkUrl = linkUrl || this.linkUrl;
117356
+ this.filePath = filePath || this.filePath;
117357
+ this.imageUrl = imageUrl || this.imageUrl;
117358
+ const slashCommandButtonTexts = await this.slashCommandsOptions();
117359
+ const keysAndValues = [];
117360
+ for (const [index, buttonText] of slashCommandButtonTexts.entries()) {
117361
+ await this.openSlashCommands();
117362
+ await this.page
117363
+ .getByTestId(NEETO_EDITOR_SELECTORS.commandListItem(index))
117364
+ .click();
117365
+ const keyValuesForButton = await this.slashCommandsAndVerifications[toCamelCase(buttonText)](index);
117366
+ keyValuesForButton && keysAndValues.push(...keyValuesForButton);
117367
+ }
117368
+ return keysAndValues;
117369
+ };
117370
+ this.page = page;
117371
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
117372
+ this.t = playwrightI18nextFixture.getI18nInstance().t;
117373
+ this.editorWrapper = this.page;
117374
+ if (editorWrapper)
117375
+ this.editorWrapper = editorWrapper;
117376
+ this.editorLinkButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.linkOption);
117377
+ this.imageWrapper = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageWrapper);
117378
+ this.uploadDeleteButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadDeleteButton);
117379
+ this.imageUploadOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
117380
+ this.emojiSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.emojiOption);
117381
+ this.contentField = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField);
117382
+ }
117383
+ }
117384
+
117191
117385
  class EditorPage {
117192
117386
  constructor(page, neetoPlaywrightUtilities, editorWrapper) {
117193
117387
  this.wordsUsedInEditor = [];
@@ -117201,8 +117395,6 @@ class EditorPage {
117201
117395
  this.cleanString = (selector = "") => (selector === null || selector === void 0 ? void 0 : selector.replace("neeto-editor-fixed-menu-", "").replace("-option", "")) ||
117202
117396
  "";
117203
117397
  this.fixedMenuOptions = async () => {
117204
- (await this.fixedMenuArrowSelector.isVisible()) &&
117205
- (await this.fixedMenuArrowSelector.click());
117206
117398
  const fixedMenuButtons = await this.editorWrapper
117207
117399
  .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
117208
117400
  .getByRole("button")
@@ -117267,7 +117459,7 @@ class EditorPage {
117267
117459
  await test.expect(this.contentField
117268
117460
  .getByRole(textModifierRole)
117269
117461
  .filter({ hasText: randomText })).toBeVisible();
117270
- await this.moveCursorAtBottom();
117462
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117271
117463
  await this.page.keyboard.press("Enter");
117272
117464
  if (modifierKey !== "codeBlock") {
117273
117465
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
@@ -117284,7 +117476,7 @@ class EditorPage {
117284
117476
  await test.expect(this.contentField
117285
117477
  .locator(TEXT_MODIFIER_TAGS[modifierKey])
117286
117478
  .filter({ hasText: randomText })).toBeVisible();
117287
- await this.moveCursorAtBottom();
117479
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117288
117480
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
117289
117481
  await textModifierSelector.click();
117290
117482
  return [{ key: modifierKey, value: randomText }];
@@ -117298,7 +117490,7 @@ class EditorPage {
117298
117490
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5000 });
117299
117491
  }).toPass({ timeout: 30000 });
117300
117492
  this.focusText = (textLocator) => {
117301
- const platform = require$$0$9.platform();
117493
+ const platform = require$$0$5.platform();
117302
117494
  return test.expect(async () => {
117303
117495
  await textLocator.click();
117304
117496
  platform === "darwin"
@@ -117330,7 +117522,7 @@ class EditorPage {
117330
117522
  this.verifyTextHighlighter = async (isButtonInMoreMenu, highlighterCount = this.highlighterCount) => {
117331
117523
  const highlightedKeyValuePairs = [];
117332
117524
  for (let colorIdx = 1; colorIdx <= highlighterCount; colorIdx++) {
117333
- await this.moveCursorAtBottom();
117525
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117334
117526
  const randomText = await this.highlightText(isButtonInMoreMenu, colorIdx);
117335
117527
  highlightedKeyValuePairs.push({
117336
117528
  key: `highlight-${colorIdx}`,
@@ -117348,7 +117540,7 @@ class EditorPage {
117348
117540
  await test.expect(this.contentField
117349
117541
  .locator(LIST_MODIFIER_TAGS[modifierKey])
117350
117542
  .filter({ hasText: randomText })).toBeVisible();
117351
- await this.moveCursorAtBottom();
117543
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117352
117544
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
117353
117545
  await listModifierSelector.click();
117354
117546
  return [{ key: modifierKey, value: randomText }];
@@ -117365,7 +117557,7 @@ class EditorPage {
117365
117557
  .click();
117366
117558
  const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
117367
117559
  await test.expect(this.contentField.getByRole(linkRole)).toBeVisible();
117368
- await this.moveCursorAtBottom();
117560
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117369
117561
  return [{ key: "link", value: randomText }];
117370
117562
  };
117371
117563
  this.verifyEditorAttachmentsButton = async (filePath, isButtonInMoreMenu, shouldRemoveAttachment = false) => {
@@ -117535,7 +117727,7 @@ class EditorPage {
117535
117727
  await test.expect(this.contentField.locator(NEETO_EDITOR_SELECTORS.todoList, {
117536
117728
  hasText: randomText,
117537
117729
  })).toBeVisible();
117538
- await this.moveCursorAtBottom();
117730
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117539
117731
  return [{ key: "todoList", value: randomText }];
117540
117732
  };
117541
117733
  this.verifyDynamicVariables = async (dynamicVariables) => {
@@ -117554,7 +117746,7 @@ class EditorPage {
117554
117746
  const calloutTypes = ["default", "info", "warning", "error", "success"];
117555
117747
  const calloutContentField = this.contentField.locator(NEETO_EDITOR_SELECTORS.calloutContent);
117556
117748
  const calloutTypeOption = this.page.locator(NEETO_EDITOR_SELECTORS.calloutTypeOption);
117557
- await this.moveCursorAtBottom();
117749
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117558
117750
  for (const [index, type] of calloutTypes.entries()) {
117559
117751
  await this.calloutSelector.click();
117560
117752
  const calloutType = calloutTypeOption.filter({ hasText: type });
@@ -117569,7 +117761,7 @@ class EditorPage {
117569
117761
  // The index is important here as it determines which callout content field to interact with
117570
117762
  // eslint-disable-next-line playwright/no-nth-methods
117571
117763
  await test.expect(calloutContentField.nth(index)).toContainText(randomText);
117572
- await this.moveCursorAtBottom();
117764
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117573
117765
  }
117574
117766
  return [{ key: "callout" }];
117575
117767
  };
@@ -117605,11 +117797,21 @@ class EditorPage {
117605
117797
  }),
117606
117798
  todoList: isButtonInMoreMenu => this.verifyTodoListSelector(isButtonInMoreMenu),
117607
117799
  };
117800
+ this.fillRandomText = async () => {
117801
+ let randomText;
117802
+ do {
117803
+ randomText = faker.faker.lorem.word(10);
117804
+ } while (this.wordsUsedInEditor.includes(randomText));
117805
+ await this.contentField.focus();
117806
+ await this.neetoPlaywrightUtilities.moveCursorAtBottom();
117807
+ await this.page.keyboard.type(randomText);
117808
+ this.wordsUsedInEditor.push(randomText);
117809
+ const randomTextLocator = this.contentField.getByText(randomText);
117810
+ await randomTextLocator.scrollIntoViewIfNeeded();
117811
+ await randomTextLocator.click({ clickCount: 3 });
117812
+ return randomText;
117813
+ };
117608
117814
  this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, highlighterCount, cannedResponseSuccessMessage, } = {}) => {
117609
- const fixedMenuButtons = await this.fixedMenuOptions();
117610
- let moreMenuButtons = [];
117611
- (await this.moreMenuSelector.isVisible()) &&
117612
- (moreMenuButtons = await this.moreMenuOptions());
117613
117815
  this.linkUrl = linkUrl || this.linkUrl;
117614
117816
  this.filePath = filePath || this.filePath;
117615
117817
  this.videoPath = videoPath || this.videoPath;
@@ -117617,50 +117819,36 @@ class EditorPage {
117617
117819
  this.videoUrl = videoUrl || this.videoUrl;
117618
117820
  this.highlighterCount = highlighterCount || this.highlighterCount;
117619
117821
  this.cannedResponseSuccessMessage = cannedResponseSuccessMessage;
117822
+ await test.expect(this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toBeVisible();
117823
+ const isFixedMenuTypeEditor = await this.editorWrapper
117824
+ .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
117825
+ .isVisible();
117826
+ const keysAndValues = isFixedMenuTypeEditor
117827
+ ? await this.editorWithFixedMenuButtons()
117828
+ : await this.slashCommandEditorPage.verifySlashCommandEditor();
117829
+ dynamicVariables && (await this.verifyDynamicVariables(dynamicVariables));
117830
+ return keysAndValues;
117831
+ };
117832
+ this.editorWithFixedMenuButtons = async () => {
117833
+ const fixedMenuButtons = await this.fixedMenuOptions();
117834
+ let moreMenuButtons = [];
117835
+ (await this.moreMenuSelector.isVisible()) &&
117836
+ (moreMenuButtons = await this.moreMenuOptions());
117620
117837
  const keysAndValues = [];
117621
117838
  for (const button of [...fixedMenuButtons, ...moreMenuButtons]) {
117622
117839
  const isMoreMenuButton = moreMenuButtons.includes(button);
117623
117840
  const keyValuesForButton = await this.buttonsAndVerifications[button](isMoreMenuButton);
117624
117841
  keysAndValues.push(...keyValuesForButton);
117625
117842
  }
117626
- dynamicVariables && (await this.verifyDynamicVariables(dynamicVariables));
117627
117843
  return keysAndValues;
117628
117844
  };
117629
- this.moveCursorAtBottom = async () => {
117630
- const platform = require$$0$9.platform();
117631
- if (platform === "darwin") {
117632
- await this.page.keyboard.press("Meta+ArrowRight");
117633
- await this.page.keyboard.press("Meta+ArrowDown");
117634
- }
117635
- else {
117636
- await this.page.keyboard.press("End");
117637
- await this.page.keyboard.press("PageDown");
117638
- }
117639
- // eslint-disable-next-line playwright/no-wait-for-timeout
117640
- await this.page.waitForTimeout(100); // Adding some delay for DOM to react
117641
- await this.page.keyboard.press("Enter");
117642
- };
117643
- this.fillRandomText = async () => {
117644
- let randomText;
117645
- do {
117646
- randomText = faker.faker.lorem.word(10);
117647
- } while (this.wordsUsedInEditor.includes(randomText));
117648
- await this.contentField.focus();
117649
- await this.moveCursorAtBottom();
117650
- await this.page.keyboard.type(randomText);
117651
- this.wordsUsedInEditor.push(randomText);
117652
- const randomTextLocator = this.contentField.getByText(randomText);
117653
- await randomTextLocator.scrollIntoViewIfNeeded();
117654
- await randomTextLocator.click({ clickCount: 3 });
117655
- return randomText;
117656
- };
117657
117845
  this.page = page;
117658
117846
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
117847
+ this.slashCommandEditorPage = new SlashCommandEditorPage(page, neetoPlaywrightUtilities, editorWrapper);
117659
117848
  this.t = playwrightI18nextFixture.getI18nInstance().t;
117660
117849
  this.editorWrapper = this.page;
117661
117850
  if (editorWrapper)
117662
117851
  this.editorWrapper = editorWrapper;
117663
- this.fixedMenuArrowSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuArrow);
117664
117852
  this.editorLinkButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.linkOption);
117665
117853
  this.attachmentPreview = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreview);
117666
117854
  this.editorAttachmentsButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.editorAttachmentsButton);
@@ -118689,12 +118877,12 @@ class RolesPage {
118689
118877
  const [{ roleId }, { roleId: secondaryRoleId }] = await Promise.all([roleName, secondaryRoleName].map(this.getRoleIdAndOrganizationId));
118690
118878
  return this.roleApis.deleteRole(roleId, secondaryRoleId);
118691
118879
  };
118692
- this.addRoleViaUI = async ({ roleName, permissions }) => {
118880
+ this.addRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
118693
118881
  await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
118694
118882
  await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
118695
- await this.selectAndSubmitPermissions(permissions);
118883
+ await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
118696
118884
  };
118697
- this.editRoleViaUI = async ({ roleName, permissions }) => {
118885
+ this.editRoleViaUI = async ({ roleName, permissions, parentPermission = "", hierarchyLevelOfPermissions = 2, }) => {
118698
118886
  await this.page
118699
118887
  .getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
118700
118888
  .filter({ hasText: roleName })
@@ -118702,11 +118890,20 @@ class RolesPage {
118702
118890
  .click();
118703
118891
  await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
118704
118892
  await test.expect(this.page.getByTestId(ROLES_SELECTORS.updateRolePaneHeading)).toBeVisible();
118705
- await this.selectAndSubmitPermissions(permissions);
118893
+ await this.selectAndSubmitPermissions(permissions, parentPermission, hierarchyLevelOfPermissions);
118706
118894
  };
118707
- this.selectAndSubmitPermissions = async (permissions) => {
118895
+ this.selectAndSubmitPermissions = async (permissions, parentPermission = "", hierarchyLevelOfPermissions = 2) => {
118896
+ const parentPermissionSelector = parentPermission
118897
+ ? this.page
118898
+ .getByTestId(ROLES_SELECTORS.permissionSubCategoryCard(hierarchyLevelOfPermissions - 1))
118899
+ .filter({ hasText: parentPermission })
118900
+ : this.page;
118901
+ parentPermission &&
118902
+ (await parentPermissionSelector
118903
+ .getByTestId(COMMON_SELECTORS.customCheckboxLabel(parentPermission))
118904
+ .click({ force: true }));
118708
118905
  for (const permission of permissions) {
118709
- await this.page
118906
+ await parentPermissionSelector
118710
118907
  .getByTestId(COMMON_SELECTORS.customCheckboxLabel(permission))
118711
118908
  .click({ force: true }); // Used force: true because disabling the parent permission disables the child permissions means the checkboxes label become disable
118712
118909
  }
@@ -123618,8 +123815,8 @@ function requireMain$1 () {
123618
123815
  hasRequiredMain$1 = 1;
123619
123816
  const fs = require$$0$4;
123620
123817
  const path = path$1;
123621
- const os = require$$0$9;
123622
- const crypto = require$$0$7;
123818
+ const os = require$$0$5;
123819
+ const crypto = require$$0$8;
123623
123820
  const packageJson = require$$4;
123624
123821
 
123625
123822
  const version = packageJson.version;