@bigbinary/neeto-playwright-commons 1.22.19 → 1.22.21

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
@@ -9,6 +9,7 @@ var ramda = require('ramda');
9
9
  var neetoCist = require('@bigbinary/neeto-cist');
10
10
  var child_process = require('child_process');
11
11
  var faker = require('@faker-js/faker');
12
+ var dayjs = require('dayjs');
12
13
  var Stream$4 = require('stream');
13
14
  var require$$0$4 = require('node:buffer');
14
15
  var require$$0$3 = require('buffer');
@@ -24,7 +25,6 @@ var zlib$5 = require('zlib');
24
25
  var require$$0$7 = require('assert');
25
26
  var require$$3$1 = require('querystring');
26
27
  var require$$4$3 = require('timers');
27
- var dayjs = require('dayjs');
28
28
  var require$$0$9 = require('tty');
29
29
  var require$$0$8 = require('os');
30
30
  var stealth$1 = require('puppeteer-extra-plugin-stealth');
@@ -3531,6 +3531,32 @@ const EMPTY_STORAGE_STATE = {
3531
3531
  storageState: { cookies: [], origins: [] },
3532
3532
  };
3533
3533
 
3534
+ const generateStagingData = (product = "invoice") => {
3535
+ const jobCompletionIndex = process.env.JOB_COMPLETION_INDEX;
3536
+ const dateTimeString = dayjs().format("DDMM-HHmm-ssSSS");
3537
+ const timestamp = jobCompletionIndex
3538
+ ? `${dateTimeString}-${jobCompletionIndex}`
3539
+ : dateTimeString;
3540
+ const firstName = "André";
3541
+ const lastName = "O'Reilly";
3542
+ const otpBypassKey = process.env.OTP_BYPASS_KEY;
3543
+ const stagingOrganization = `cpt-${product}-${timestamp}`;
3544
+ return {
3545
+ firstName,
3546
+ lastName,
3547
+ otp: 111111,
3548
+ domain: `neeto${product}.net`,
3549
+ currentUserName: IS_STAGING_ENV
3550
+ ? joinString(firstName, lastName)
3551
+ : CREDENTIALS.name,
3552
+ businessName: stagingOrganization,
3553
+ subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
3554
+ email: IS_STAGING_ENV
3555
+ ? `cpt${otpBypassKey}+${product}+${timestamp}@bigbinary.com`
3556
+ : CREDENTIALS.email,
3557
+ };
3558
+ };
3559
+
3534
3560
  /* eslint-disable playwright/no-skipped-test */
3535
3561
  const execCommand = (command) => child_process.execSync(command)
3536
3562
  .toString("utf-8")
@@ -3638,11 +3664,12 @@ const getListCount = async ({ page, countSelector, }) => {
3638
3664
  };
3639
3665
  const getGlobalUserProps = async (page) => (await page.evaluate(() => window.globalProps.user));
3640
3666
  const getClipboardContent = (page) => page.evaluate(() => navigator.clipboard.readText());
3667
+ const grantClipboardPermissions = (context) => context.grantPermissions(["clipboard-read", "clipboard-write"]);
3641
3668
  const getFullUrl = (path) => shouldSkipCustomDomainSetup() ? path : `${process.env.BASE_URL}${path}`;
3642
3669
  const globalShortcuts = (t) => [
3643
3670
  {
3644
3671
  description: t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
3645
- sequence: "shift+/",
3672
+ sequence: "ctrl+/",
3646
3673
  },
3647
3674
  {
3648
3675
  description: t("neetoMolecules.keyboardShortcuts.global.close"),
@@ -3658,6 +3685,11 @@ const globalShortcuts = (t) => [
3658
3685
  },
3659
3686
  ];
3660
3687
  const generatePhoneNumber = () => `${"+91"} 9${faker.faker.string.numeric(4)} ${faker.faker.string.numeric(5)}`;
3688
+ const initializeTestData = (product) => {
3689
+ const credentials = generateStagingData(product.toLowerCase());
3690
+ const baseURL = `https://${credentials.subdomainName}.${credentials.domain}`;
3691
+ return { credentials, baseURL };
3692
+ };
3661
3693
 
3662
3694
  const optionSelector = (option) => `neeto-editor-fixed-menu-${option}-option`;
3663
3695
  const fixedMenuSelector = (selector) => `neeto-editor-fixed-menu-${selector}`;
@@ -4223,6 +4255,8 @@ const mimeTypeMap = {
4223
4255
  jpeg: "image/jpeg",
4224
4256
  png: "image/png",
4225
4257
  gif: "image/gif",
4258
+ ico: "image/x-icon",
4259
+ svg: "image/svg+xml",
4226
4260
  };
4227
4261
  const fillRandomBytes = (byteArray) => {
4228
4262
  const CHUNK_SIZE = 65536; //Maximum allowed per call by crypto.getRandomValues.
@@ -179803,32 +179837,6 @@ const commands = {
179803
179837
  },
179804
179838
  };
179805
179839
 
179806
- const generateStagingData = (product = "invoice") => {
179807
- const jobCompletionIndex = process.env.JOB_COMPLETION_INDEX;
179808
- const dateTimeString = dayjs().format("DDMM-HHmm-ssSSS");
179809
- const timestamp = jobCompletionIndex
179810
- ? `${dateTimeString}-${jobCompletionIndex}`
179811
- : dateTimeString;
179812
- const firstName = "André";
179813
- const lastName = "O'Reilly";
179814
- const otpBypassKey = process.env.OTP_BYPASS_KEY;
179815
- const stagingOrganization = `cpt-${product}-${timestamp}`;
179816
- return {
179817
- firstName,
179818
- lastName,
179819
- otp: 111111,
179820
- domain: `neeto${product}.net`,
179821
- currentUserName: IS_STAGING_ENV
179822
- ? joinString(firstName, lastName)
179823
- : CREDENTIALS.name,
179824
- businessName: stagingOrganization,
179825
- subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
179826
- email: IS_STAGING_ENV
179827
- ? `cpt${otpBypassKey}+${product}+${timestamp}@bigbinary.com`
179828
- : CREDENTIALS.email,
179829
- };
179830
- };
179831
-
179832
179840
  var src = {exports: {}};
179833
179841
 
179834
179842
  var browser$1 = {exports: {}};
@@ -189158,18 +189166,6 @@ const ORGANIZATION_TEXTS = {
189158
189166
  class HelpAndProfilePage {
189159
189167
  constructor({ page, neetoPlaywrightUtilities, chatApiBaseURL, kbDocsBaseURL, changelogBaseURL, }) {
189160
189168
  this.hoverOnBody = () => this.page.locator("body").hover();
189161
- /**
189162
- * @deprecated This method is deprecated. Use openHelpCenter instead.
189163
- */
189164
- this.openHelpCenterV2 = async () => {
189165
- await test$1.expect(async () => {
189166
- await this.hoverOnBody();
189167
- const floatingActionMenuButton = this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton);
189168
- await floatingActionMenuButton.scrollIntoViewIfNeeded();
189169
- await floatingActionMenuButton.hover();
189170
- await test$1.expect(this.page.getByTestId(HELP_CENTER_SELECTORS.chatButton)).toBeVisible();
189171
- }).toPass({ timeout: 15000 });
189172
- };
189173
189169
  this.openHelpCenter = async () => {
189174
189170
  await test$1.expect(async () => {
189175
189171
  await this.hoverOnBody();
@@ -189225,7 +189221,7 @@ class HelpAndProfilePage {
189225
189221
  * @deprecated This method is deprecated. Use openAndVerifyHelpArticles instead.
189226
189222
  */
189227
189223
  this.openAndVerifyHelpArticlesV2 = async () => {
189228
- await test$1.test.step("1: Open Help Center links", this.openHelpCenterV2);
189224
+ await test$1.test.step("1: Open Help Center links", this.openHelpCenter);
189229
189225
  await test$1.test.step("2: Open and verify help articles link", async () => {
189230
189226
  const helpArticlesPromise = this.page.waitForEvent("popup");
189231
189227
  await this.page
@@ -189310,26 +189306,8 @@ class HelpAndProfilePage {
189310
189306
  * @deprecated This method is deprecated. Use openAndVerifyKeyboardShortcutsPane instead.
189311
189307
  */
189312
189308
  this.openAndVerifyKeyboardShortcutsPaneV2 = async (productShortcuts, osPlatform = "windows") => {
189313
- const globalShortcuts = [
189314
- {
189315
- description: this.t("neetoMolecules.keyboardShortcuts.global.openKeyboardShortcutsPane"),
189316
- sequence: "shift+/",
189317
- },
189318
- {
189319
- description: this.t("neetoMolecules.keyboardShortcuts.global.close"),
189320
- sequence: "esc",
189321
- },
189322
- {
189323
- description: this.t("neetoMolecules.keyboardShortcuts.global.submitForm"),
189324
- sequence: "ctrl+enter",
189325
- },
189326
- {
189327
- description: this.t("neetoMolecules.keyboardShortcuts.global.openProductSwitcher"),
189328
- sequence: "ctrl+e",
189329
- },
189330
- ];
189331
- const shortcuts = [...globalShortcuts, ...productShortcuts];
189332
- await test$1.test.step("1: Open Help Center", this.openHelpCenterV2);
189309
+ const shortcuts = [...globalShortcuts(this.t), ...productShortcuts];
189310
+ await test$1.test.step("1: Open Help Center", this.openHelpCenter);
189333
189311
  await test$1.test.step("2: Open and close keyboard shortcuts from UI", async () => {
189334
189312
  await this.page
189335
189313
  .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
@@ -189359,34 +189337,35 @@ class HelpAndProfilePage {
189359
189337
  });
189360
189338
  };
189361
189339
  this.openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
189340
+ const keyboardShortcutsPane = this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane);
189341
+ const keyItem = this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem);
189342
+ const openKeyboardShortcut = osPlatform === "mac" ? "Meta+/" : "Control+/";
189362
189343
  const shortcuts = [...globalShortcuts(this.t), ...productShortcuts];
189344
+ const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
189363
189345
  await test$1.test.step("1: Open Help Center", this.openHelpCenter);
189364
189346
  await test$1.test.step("2: Open and close keyboard shortcuts from UI", async () => {
189365
189347
  await this.page
189366
189348
  .getByTestId(HELP_CENTER_SELECTORS.keyboardShortcutButton)
189367
189349
  .click();
189368
- await test$1.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
189350
+ await test$1.expect(keyboardShortcutsPane).not.toHaveCSS("width", "1px");
189369
189351
  await this.page
189370
189352
  .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.closePaneButton)
189371
189353
  .click();
189372
- await test$1.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
189354
+ await test$1.expect(keyboardShortcutsPane).toHaveCSS("width", "1px");
189373
189355
  });
189374
189356
  await test$1.test.step("3: Open and close keyboard shortcuts through shortcut", async () => {
189375
- await this.page.keyboard.press("Shift+/");
189376
- await test$1.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
189357
+ await this.page.keyboard.press(openKeyboardShortcut);
189358
+ await test$1.expect(keyboardShortcutsPane).not.toHaveCSS("width", "1px");
189377
189359
  await this.page.keyboard.press("Escape");
189378
- await test$1.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).toHaveCSS("width", "1px");
189360
+ await test$1.expect(keyboardShortcutsPane).toHaveCSS("width", "1px");
189379
189361
  });
189380
189362
  await test$1.test.step("4: Verify all displayed keyboard shortcuts", async () => {
189381
- await this.page.keyboard.press("Shift+/");
189382
- await test$1.expect(this.page.getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.keyboardShortcutsPane)).not.toHaveCSS("width", "1px");
189383
- await test$1.expect(this.page
189384
- .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
189385
- .locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description));
189386
- const formattedSequences = shortcuts.map(shortcut => this.formatKeyboardShortcut(shortcut.sequence, osPlatform));
189387
- await test$1.expect(this.page
189388
- .getByTestId(KEYBOARD_SHORTCUTS_SELECTORS.hotKeyItem)
189389
- .locator("div")).toHaveText(formattedSequences);
189363
+ await this.page.keyboard.press(openKeyboardShortcut);
189364
+ await test$1.expect(keyboardShortcutsPane).not.toHaveCSS("width", "1px");
189365
+ await Promise.all([
189366
+ test$1.expect(keyItem.locator("p")).toHaveText(shortcuts.map(shortcut => shortcut.description)),
189367
+ test$1.expect(keyItem.locator("div")).toHaveText(formattedSequences),
189368
+ ]);
189390
189369
  });
189391
189370
  };
189392
189371
  /**
@@ -189397,7 +189376,7 @@ class HelpAndProfilePage {
189397
189376
  const searchQueryPartial = productName.slice(0, 4).toLowerCase();
189398
189377
  const searchQueryFull = productName.toLowerCase();
189399
189378
  await test$1.test.step("1: Verify hovering over app switcher opens the app switcher drawer", () => test$1.expect(async () => {
189400
- await this.openHelpCenterV2();
189379
+ await this.openHelpCenter();
189401
189380
  await this.page.getByTestId(COMMON_SELECTORS.appSwitcherButton).hover();
189402
189381
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.appSwitcherWrapper)).toBeVisible();
189403
189382
  }).toPass({ timeout: 45000 }));
@@ -189454,7 +189433,7 @@ class HelpAndProfilePage {
189454
189433
  this.verifyLogoutV2 = async () => {
189455
189434
  if (shouldSkipSetupAndTeardown())
189456
189435
  return;
189457
- await test$1.test.step("1: Open Help center and verify", this.openHelpCenterV2);
189436
+ await test$1.test.step("1: Open Help center and verify", this.openHelpCenter);
189458
189437
  await test$1.test.step("2: Click logout and verify", async () => {
189459
189438
  await this.page
189460
189439
  .getByTestId(PROFILE_SECTION_SELECTORS.logoutButton)
@@ -189515,7 +189494,7 @@ class HelpAndProfilePage {
189515
189494
  linkTestId: PROFILE_SECTION_SELECTORS.manageBillingAndSubscriptionsButton,
189516
189495
  });
189517
189496
  });
189518
- await test$1.test.step("3: Open Help center and verify", this.openHelpCenterV2);
189497
+ await test$1.test.step("3: Open Help center and verify", this.openHelpCenter);
189519
189498
  await test$1.test.step("4: Open My organization link and verify", async () => {
189520
189499
  await this.page
189521
189500
  .getByTestId(PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton)
@@ -192988,12 +192967,15 @@ class TeamMembers {
192988
192967
  await test$1.expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
192989
192968
  };
192990
192969
  this.toggleMemberColumns = async ({ columns = [], bulkAction, }) => {
192991
- await this.page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
192970
+ await test$1.expect(async () => {
192971
+ await this.page
192972
+ .getByTestId(COMMON_SELECTORS.columnsDropdownButton)
192973
+ .click();
192974
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.columnsSearchInput)).toBeVisible();
192975
+ }).toPass({ timeout: 15000 });
192992
192976
  if (neetoCist.isPresent(bulkAction)) {
192993
192977
  await this.page
192994
- .getByRole("button", {
192995
- name: bulkAction === "hide" ? "Hide All" : "Show All",
192996
- })
192978
+ .getByTestId(COMMON_SELECTORS.columnVisibilityBtn(bulkAction === "hide" ? "hide-all" : "reset"))
192997
192979
  .click();
192998
192980
  }
192999
192981
  else {
@@ -193001,9 +192983,13 @@ class TeamMembers {
193001
192983
  await this.page
193002
192984
  .getByTestId(COMMON_SELECTORS.columnsSearchInput)
193003
192985
  .fill(column);
193004
- await this.page
193005
- .getByTestId(MEMBER_SELECTORS.checkboxLabel(column))
193006
- .click();
192986
+ const columnCheckbox = this.page
192987
+ .getByTestId(COMMON_SELECTORS.nuiCheckboxContainer)
192988
+ .filter({ hasText: column })
192989
+ .getByTestId(MEMBER_SELECTORS.columnCheckBox);
192990
+ const isChecked = await columnCheckbox.isChecked();
192991
+ await columnCheckbox.click();
192992
+ await test$1.expect(columnCheckbox).toBeChecked({ checked: !isChecked });
193007
192993
  }
193008
192994
  }
193009
192995
  await this.page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
@@ -193780,6 +193766,32 @@ const networkConditions = {
193780
193766
  },
193781
193767
  };
193782
193768
 
193769
+ const FILE_FORMATS = {
193770
+ csv: "csv",
193771
+ avi: "avi",
193772
+ doc: "doc",
193773
+ docx: "docx",
193774
+ flv: "flv",
193775
+ html: "html",
193776
+ mp3: "mp3",
193777
+ mp4: "mp4",
193778
+ mpg: "mpg",
193779
+ pdf: "pdf",
193780
+ rtf: "rtf",
193781
+ txt: "txt",
193782
+ webm: "webm",
193783
+ xls: "xls",
193784
+ xlsx: "xlsx",
193785
+ wma: "wma",
193786
+ zip: "zip",
193787
+ jpg: "jpg",
193788
+ jpeg: "jpeg",
193789
+ png: "png",
193790
+ ico: "ico",
193791
+ svg: "svg",
193792
+ gif: "gif",
193793
+ };
193794
+
193783
193795
  const PHONE_NUMBER_FORMATS = [
193784
193796
  { name: "Afghanistan", code: "+93", format: "70#######", flag: "🇦🇫" },
193785
193797
  { name: "Aland", code: "+358", format: "5####", flag: "🇦🇽" },
@@ -198824,6 +198836,7 @@ exports.ENVIRONMENT = ENVIRONMENT;
198824
198836
  exports.EXPANDED_FONT_SIZE = EXPANDED_FONT_SIZE;
198825
198837
  exports.EditorPage = EditorPage;
198826
198838
  exports.EmbedBase = EmbedBase;
198839
+ exports.FILE_FORMATS = FILE_FORMATS;
198827
198840
  exports.FONT_SIZE_SELECTORS = FONT_SIZE_SELECTORS;
198828
198841
  exports.GLOBAL_TRANSLATIONS_PATTERN = GLOBAL_TRANSLATIONS_PATTERN;
198829
198842
  exports.GOOGLE_ANALYTICS_SELECTORS = GOOGLE_ANALYTICS_SELECTORS;
@@ -198929,12 +198942,14 @@ exports.getGlobalUserState = getGlobalUserState;
198929
198942
  exports.getImagePathAndName = getImagePathAndName;
198930
198943
  exports.getListCount = getListCount;
198931
198944
  exports.globalShortcuts = globalShortcuts;
198945
+ exports.grantClipboardPermissions = grantClipboardPermissions;
198932
198946
  exports.headerUtils = headerUtils;
198933
198947
  exports.hexToRGB = hexToRGB;
198934
198948
  exports.hexToRGBA = hexToRGBA;
198935
198949
  exports.hyphenize = hyphenize;
198936
198950
  exports.i18nFixture = i18nFixture;
198937
198951
  exports.initializeCredentials = initializeCredentials;
198952
+ exports.initializeTestData = initializeTestData;
198938
198953
  exports.initializeTotp = initializeTotp;
198939
198954
  exports.isGithubIssueOpen = isGithubIssueOpen;
198940
198955
  exports.joinHyphenCase = joinHyphenCase;