@bigbinary/neeto-playwright-commons 1.16.5 → 1.16.7

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
@@ -94,7 +94,7 @@ const THIRD_PARTY_ROUTES = {
94
94
  loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
95
95
  },
96
96
  zapier: {
97
- login: "https://zapier.com/app/login",
97
+ login: "https://zapier.com/",
98
98
  logOut: "https://zapier.com/logout",
99
99
  zapEditor: (zapId) => `https://zapier.com/editor/${zapId}`,
100
100
  },
@@ -416,6 +416,7 @@ const NEETO_EDITOR_SELECTORS = {
416
416
  imageUploadDeleteButton: "neeto-editor-image-menu-Delete",
417
417
  dynamicVariablesButton: "dynamic-variables-button",
418
418
  emojiContainer: "neeto-editor-emoji-picker",
419
+ characterCount: "neeto-editor-character-count",
419
420
  dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${variable}`,
420
421
  };
421
422
  const NEETO_TEXT_MODIFIER_SELECTORS = {
@@ -482,6 +483,7 @@ const NEETO_FILTERS_SELECTORS = {
482
483
  filtersEmailFilter: "neeto-filters-email-filter",
483
484
  paneModalCrossIcon: "neeto-filters-close-button",
484
485
  searchTermBlock: "neeto-filters-search-term-block",
486
+ categoriesFilter: "neeto-filters-categories-filter",
485
487
  neetoFiltersFilter: (filterName) => `neeto-filters-${hyphenize(filterName)}-filter`,
486
488
  filtersTermBlock: (filterType = "search-term") => `neeto-filters-${hyphenize(filterType)}-block`,
487
489
  };
@@ -588,6 +590,7 @@ const PROFILE_SECTION_SELECTORS = {
588
590
  profileSidebarCancelButton: "ntm-profile-cancel-button",
589
591
  profileAvatar: "profile-avatar",
590
592
  actionHeaderUserEmail: "floating-action-menu-header-user-email",
593
+ submitButton: "ntm-profile-submit-button",
591
594
  };
592
595
 
593
596
  const ROLES_SELECTORS = {
@@ -608,6 +611,9 @@ const ROLES_SELECTORS = {
608
611
  editRoleButton: "ntm-roles-table-edit-role-button",
609
612
  deleteRoleButton: "ntm-roles-table-delete-role-button",
610
613
  permissionCard: "ntm-roles-permission-card",
614
+ searchPermissionsInput: "ntm-search-permissions-input",
615
+ permissionDescription: "ntm-permission-category-description",
616
+ rolesEditButton: "ntm-roles-table-edit-role-button",
611
617
  };
612
618
 
613
619
  const SIGNUP_SELECTORS = {
@@ -768,6 +774,16 @@ const ZAPIER_SELECTORS = {
768
774
  sidebarFooter: "css=[class$=InAppSidebarFooter__footerWrapper]",
769
775
  contextualSideBar: "[data-testid='contextual-sidebar']",
770
776
  iconContainer: "[data-testid='iconContainer']",
777
+ deleteApiButton: "delete-apikey-button",
778
+ zapierSubLink: "zapier-sub-link",
779
+ };
780
+
781
+ const TABLE_SELECTORS = {
782
+ freezeUnfreezeButton: "freeze-unfreeze-column-menu-button",
783
+ ascendingButton: "ascending-column-menu-button",
784
+ descendingButton: "descending-column-menu-button",
785
+ hideButton: "hide-column-menu-button",
786
+ columnHeaderTitle: (columnName) => `${neetoCist.hyphenate(columnName)}-header-title`,
771
787
  };
772
788
 
773
789
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -3902,20 +3918,6 @@ class CustomCommands {
3902
3918
  const startTime = Date.now();
3903
3919
  return await this.recursiveMethod(callback, condition, timeout, startTime, 1);
3904
3920
  };
3905
- /**
3906
- * @deprecated Use verifyToast instead.
3907
- */
3908
- this.verifySuccessToast = async ({ message = "", closeAfterVerification = true, } = {}) => {
3909
- if (!ramda.isEmpty(message)) {
3910
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage("success"))).toContainText(message);
3911
- }
3912
- else {
3913
- await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍");
3914
- }
3915
- closeAfterVerification &&
3916
- (await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
3917
- await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
3918
- };
3919
3921
  this.verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10000, customPageContext = this.page, } = {}) => {
3920
3922
  const toastrCloseButton = customPageContext.getByTestId(COMMON_SELECTORS.toastCloseButton);
3921
3923
  if (!ramda.isEmpty(message)) {
@@ -21505,6 +21507,11 @@ const ZAPIER_WEB_TEXTS = {
21505
21507
  connectStagingApp: (appName) => `Connect ${appName} Staging`,
21506
21508
  zapierWorkflowTriggered: "Zapier Workflow Triggered",
21507
21509
  confirmPublishing: "Confirm Publishing",
21510
+ startFreeWithEmail: "Start free with email",
21511
+ appsByTitle: "Apps by title",
21512
+ logIn: "Log in",
21513
+ loginToYourAccount: "Log in to your account",
21514
+ deleteMessage: "Zapier API Keys are deleted successfully!",
21508
21515
  };
21509
21516
  const TOASTR_MESSAGES = {
21510
21517
  zapierApiKeyGenerated: "Zapier API key is generated successfully!",
@@ -21540,7 +21547,10 @@ const GOOGLE_LOGIN_TEXTS = {
21540
21547
  };
21541
21548
  const ENGAGE_TEXTS = { subscribe: "Subscribe" };
21542
21549
  const AUDIT_LOGS_TEXTS = { organizationRole: "Organization Role" };
21543
- const COMMON_TEXTS = { skipCleanup: "SKIP_CLEANUP", skipSetup: "SKIP_SETUP" };
21550
+ const COMMON_TEXTS = {
21551
+ skipCleanup: "SKIP_CLEANUP",
21552
+ skipSetup: "SKIP_SETUP",
21553
+ };
21544
21554
 
21545
21555
  /* eslint-disable playwright/require-top-level-describe */
21546
21556
  /* eslint-disable playwright/no-standalone-expect */
@@ -23499,18 +23509,16 @@ const initializeTotp = ({ issuer, secret, }) => {
23499
23509
 
23500
23510
  class IntegrationBase {
23501
23511
  constructor({ page, neetoPlaywrightUtilities, integration, connectHeader, connectedHeader, pageloaderTimeout, integrationRouteIndex, integrationRouteResponsesParams, }) {
23502
- this.disconnect = async (interceptMultipleResponsesParams = {}) => {
23512
+ this.disconnect = async (
23513
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23514
+ interceptMultipleResponsesParams = {}) => {
23503
23515
  await this.gotoIntegrationIndex();
23504
23516
  await this.clickOnIntegrationCard();
23505
23517
  await this.page.getByTestId(INTEGRATION_SELECTORS.disconnectButton).click();
23506
- const disconnectPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses({
23507
- times: 0,
23508
- ...interceptMultipleResponsesParams,
23509
- });
23510
23518
  await this.page
23511
23519
  .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
23512
23520
  .click();
23513
- await disconnectPromise;
23521
+ await this.neetoPlaywrightUtilities.verifyToast();
23514
23522
  };
23515
23523
  this.connect = async (skipGoTo) => {
23516
23524
  !skipGoTo && (await this.gotoIntegrationIndex());
@@ -23969,6 +23977,37 @@ class WebhooksPage {
23969
23977
  }
23970
23978
  }
23971
23979
 
23980
+ const simulateTypingWithDelay = async ({ field, value, delay = 500, }) => {
23981
+ const sliceLength = Math.floor(Math.random() * 5) + 10;
23982
+ const backspaceCount = Math.floor(Math.random() * 3) + 2;
23983
+ const textPart1 = value.slice(0, sliceLength);
23984
+ const textPart2 = value.slice(sliceLength - backspaceCount);
23985
+ await field.hover();
23986
+ await field.click({ delay: Math.floor(Math.random() * delay) + 700 });
23987
+ await field.pressSequentially(textPart1, {
23988
+ delay: Math.floor(Math.random() * delay) + 400,
23989
+ timeout: 30000,
23990
+ });
23991
+ for (let i = 0; i < backspaceCount; i++) {
23992
+ await field.press("Backspace", {
23993
+ delay: Math.floor(Math.random() * 1000) + 300,
23994
+ });
23995
+ }
23996
+ await field.pressSequentially(textPart2, {
23997
+ delay: Math.floor(Math.random() * delay) + 700,
23998
+ timeout: 45000,
23999
+ });
24000
+ };
24001
+ const simulateClickWithDelay = async ({ element, page, }) => {
24002
+ const locatorBoundingBox = await element.boundingBox();
24003
+ const clickX = locatorBoundingBox.x + locatorBoundingBox.width / 2 + 10;
24004
+ const clickY = locatorBoundingBox.y + locatorBoundingBox.height / 2 - 10;
24005
+ await element.hover();
24006
+ await page.mouse.click(clickX, clickY, {
24007
+ delay: Math.floor(Math.random() * 1000) + 1000,
24008
+ });
24009
+ };
24010
+
23972
24011
  class ZapierPage extends IntegrationBase {
23973
24012
  constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, mailerUtils, }) {
23974
24013
  super({
@@ -23983,16 +24022,41 @@ class ZapierPage extends IntegrationBase {
23983
24022
  name: ZAPIER_WEB_TEXTS.continue,
23984
24023
  exact: true,
23985
24024
  });
23986
- await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.login);
23987
- await this.zapierWebPage
23988
- .getByLabel(ZAPIER_WEB_TEXTS.email)
23989
- .pressSequentially(process.env.ZAPIER_LOGIN_EMAIL, { delay: 100 });
23990
- await this.continueButton.click();
23991
- await test$1.expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.welcomeText(process.env.ZAPIER_LOGIN_EMAIL))).toBeVisible();
23992
- await this.zapierWebPage
23993
- .getByLabel(ZAPIER_WEB_TEXTS.password)
23994
- .pressSequentially(process.env.ZAPIER_LOGIN_PASSWORD, { delay: 100 });
23995
- await this.continueButton.click();
24025
+ await zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.login);
24026
+ await test$1.expect(zapierWebPage.getByRole("link", {
24027
+ name: ZAPIER_WEB_TEXTS.startFreeWithEmail,
24028
+ })).toBeVisible();
24029
+ const loginLink = zapierWebPage.getByRole("link", {
24030
+ name: ZAPIER_WEB_TEXTS.logIn,
24031
+ });
24032
+ await simulateClickWithDelay({ element: loginLink, page: zapierWebPage });
24033
+ const emailField = zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.email);
24034
+ const passwordField = zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.password);
24035
+ const loginToYourAccountHeading = zapierWebPage.getByRole("heading", {
24036
+ name: ZAPIER_WEB_TEXTS.loginToYourAccount,
24037
+ });
24038
+ await test$1.expect(emailField).toBeVisible();
24039
+ await loginToYourAccountHeading.hover();
24040
+ await loginToYourAccountHeading.dblclick({
24041
+ delay: Math.floor(Math.random() * 1000) + 300,
24042
+ });
24043
+ await simulateTypingWithDelay({
24044
+ field: emailField,
24045
+ value: process.env.ZAPIER_LOGIN_EMAIL,
24046
+ });
24047
+ await simulateClickWithDelay({
24048
+ element: this.continueButton,
24049
+ page: zapierWebPage,
24050
+ });
24051
+ await test$1.expect(zapierWebPage.getByText(ZAPIER_WEB_TEXTS.welcomeText(process.env.ZAPIER_LOGIN_EMAIL))).toBeVisible();
24052
+ await simulateTypingWithDelay({
24053
+ field: passwordField,
24054
+ value: process.env.ZAPIER_LOGIN_PASSWORD,
24055
+ });
24056
+ await simulateClickWithDelay({
24057
+ element: this.continueButton,
24058
+ page: zapierWebPage,
24059
+ });
23996
24060
  };
23997
24061
  this.logoutFromZapier = async () => {
23998
24062
  await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.logOut, {
@@ -24115,7 +24179,9 @@ class ZapierPage extends IntegrationBase {
24115
24179
  this.skipIfTaskLimitIsExhausted = async () => {
24116
24180
  var _a;
24117
24181
  // Zapier provides 100 free task limit for free account; skip test if it's exhausted
24118
- await test$1.expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar)).toBeVisible({ timeout: 15000 });
24182
+ await this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar).hover({
24183
+ timeout: 30000,
24184
+ });
24119
24185
  await test$1.expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.sidebarFooter)).toBeVisible({ timeout: 10000 });
24120
24186
  if (await this.zapierWebPage
24121
24187
  .getByText(RegExp(ZAPIER_WEB_TEXTS.trialEndsRegExp))
@@ -24152,10 +24218,15 @@ class ZapierPage extends IntegrationBase {
24152
24218
  await this.verifyIntegrationStatus();
24153
24219
  return apiKey;
24154
24220
  };
24155
- this.disconnectAndVerify = async () => {
24156
- await this.disconnect({
24157
- times: 1,
24158
- responseUrl: API_ROUTES.integrations.zapier.api_keys,
24221
+ this.disconnectAndVerify = async (toastMessage = ZAPIER_WEB_TEXTS.deleteMessage) => {
24222
+ await this.gotoIntegrationIndex();
24223
+ await this.clickOnIntegrationCard();
24224
+ await this.page.getByTestId(INTEGRATION_SELECTORS.disconnectButton).click();
24225
+ await this.page
24226
+ .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
24227
+ .click();
24228
+ await this.neetoPlaywrightUtilities.verifyToast({
24229
+ message: toastMessage,
24159
24230
  });
24160
24231
  await this.verifyIntegrationStatus("disconnected");
24161
24232
  };
@@ -25450,81 +25521,6 @@ const initializeCredentials = (product) => {
25450
25521
  }
25451
25522
  };
25452
25523
 
25453
- const addMemberViaRequest = async ({ email, role = MEMBER_TEXTS.agent, appName, neetoPlaywrightUtilities, }) => {
25454
- let response;
25455
- await test$1.expect
25456
- .poll(async () => {
25457
- response = await neetoPlaywrightUtilities.apiRequest({
25458
- method: "post",
25459
- url: API_ROUTES.teamMembers.index,
25460
- body: {
25461
- user: {
25462
- emails: [email],
25463
- organization_role: role,
25464
- app_roles: [
25465
- { app_name: appName, active_role: role, is_enabled: true },
25466
- ],
25467
- },
25468
- },
25469
- });
25470
- return response === null || response === void 0 ? void 0 : response.status();
25471
- }, { timeout: 30000 })
25472
- .toBe(200);
25473
- const responseBodyBuffer = await (response === null || response === void 0 ? void 0 : response.body());
25474
- const { job_id: jobId } = JSON.parse(String(responseBodyBuffer));
25475
- await test$1.expect
25476
- .poll(async () => {
25477
- const jobResponse = await neetoPlaywrightUtilities.apiRequest({
25478
- url: API_ROUTES.teamMembers.creationStatus(jobId),
25479
- });
25480
- const responseBodyBuffer = await (jobResponse === null || jobResponse === void 0 ? void 0 : jobResponse.body());
25481
- const { is_completed: isCompleted } = JSON.parse(String(responseBodyBuffer));
25482
- return isCompleted;
25483
- }, { timeout: 30000 })
25484
- .toBe(true);
25485
- };
25486
- const editMemberViaRequest = async ({ email, firstName, lastName, newRole, neetoPlaywrightUtilities, }) => {
25487
- const response = await neetoPlaywrightUtilities.apiRequest({
25488
- method: "get",
25489
- url: API_ROUTES.teamMembers.index,
25490
- params: { search: email },
25491
- });
25492
- if (response) {
25493
- const responseBodyBuffer = await response.body();
25494
- const responseBody = JSON.parse(responseBodyBuffer.toString());
25495
- const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members[0];
25496
- await neetoPlaywrightUtilities.apiRequest({
25497
- method: "put",
25498
- url: API_ROUTES.teamMembers.show(memberDetails.id),
25499
- body: {
25500
- team: {
25501
- active: true,
25502
- first_name: firstName,
25503
- last_name: lastName,
25504
- organization_role: newRole,
25505
- },
25506
- },
25507
- });
25508
- }
25509
- };
25510
- const deactivateMemberViaRequest = ({ email, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
25511
- method: "patch",
25512
- url: API_ROUTES.teamMembers.bulkUpdate,
25513
- body: { users: { active: false, emails: [email] } },
25514
- });
25515
- const generateRandomTeamMembers = ({ count = 1, role = "standard" }) => neetoCist.dynamicArray(count, () => ({
25516
- firstName: faker.faker.person.firstName(),
25517
- lastName: faker.faker.person.lastName(),
25518
- email: faker.faker.internet.exampleEmail(),
25519
- role,
25520
- }));
25521
- const memberUtils = {
25522
- addMemberViaRequest,
25523
- editMemberViaRequest,
25524
- deactivateMemberViaRequest,
25525
- generateRandomTeamMembers,
25526
- };
25527
-
25528
25524
  const assertColumnHeaderVisibility = async ({ page, columnName, shouldBeVisible, }) => {
25529
25525
  const visibilityAssertion = shouldBeVisible ? "toBeVisible" : "toBeHidden";
25530
25526
  await test$1.expect(page.getByRole("columnheader", { name: columnName, exact: true }))[visibilityAssertion]();
@@ -25557,15 +25553,18 @@ const toggleColumnCheckboxAndVerifyVisibility = async ({ page, tableColumns, sho
25557
25553
  }
25558
25554
  };
25559
25555
  const verifyFreezeColumnAction = async (page, t) => {
25560
- var _a, _b;
25561
25556
  const columnHeader = page.getByRole("columnheader");
25562
25557
  const checkboxVisible = await columnHeader.getByRole("checkbox").isVisible();
25563
25558
  const columnOffset = checkboxVisible ? 1 : 0;
25564
- const freezeColumnButton = page.getByRole("button", {
25565
- name: (_a = t("neetoui.table.freezeColumn")) !== null && _a !== void 0 ? _a : "",
25559
+ const freezeColumnButton = page
25560
+ .getByTestId(TABLE_SELECTORS.freezeUnfreezeButton)
25561
+ .filter({
25562
+ hasText: t("neetoui.table.freezeColumn"),
25566
25563
  });
25567
- const unFreezeColumnButton = page.getByRole("button", {
25568
- name: (_b = t("neetoui.table.unFreezeColumn")) !== null && _b !== void 0 ? _b : "",
25564
+ const unFreezeColumnButton = page
25565
+ .getByTestId(TABLE_SELECTORS.freezeUnfreezeButton)
25566
+ .filter({
25567
+ hasText: t("neetoui.table.unFreezeColumn"),
25569
25568
  });
25570
25569
  const [columnHeaders, originalColumnNames] = await Promise.all([
25571
25570
  columnHeader.all(),
@@ -158033,37 +158032,6 @@ const hexToRGBA = (hex) => {
158033
158032
  return `rgba(${r}, ${g}, ${b}, ${a.toFixed(2)})`;
158034
158033
  };
158035
158034
 
158036
- const simulateTypingWithDelay = async ({ field, value, delay = 500, }) => {
158037
- const sliceLength = Math.floor(Math.random() * 5) + 10;
158038
- const backspaceCount = Math.floor(Math.random() * 3) + 2;
158039
- const textPart1 = value.slice(0, sliceLength);
158040
- const textPart2 = value.slice(sliceLength - backspaceCount);
158041
- await field.hover();
158042
- await field.click({ delay: Math.floor(Math.random() * delay) + 700 });
158043
- await field.pressSequentially(textPart1, {
158044
- delay: Math.floor(Math.random() * delay) + 400,
158045
- timeout: 30000,
158046
- });
158047
- for (let i = 0; i < backspaceCount; i++) {
158048
- await field.press("Backspace", {
158049
- delay: Math.floor(Math.random() * 1000) + 300,
158050
- });
158051
- }
158052
- await field.pressSequentially(textPart2, {
158053
- delay: Math.floor(Math.random() * delay) + 700,
158054
- timeout: 45000,
158055
- });
158056
- };
158057
- const simulateClickWithDelay = async ({ element, page, }) => {
158058
- const locatorBoundingBox = await element.boundingBox();
158059
- const clickX = locatorBoundingBox.x + locatorBoundingBox.width / 2 + 10;
158060
- const clickY = locatorBoundingBox.y + locatorBoundingBox.height / 2 - 10;
158061
- await element.hover();
158062
- await page.mouse.click(clickX, clickY, {
158063
- delay: Math.floor(Math.random() * 1000) + 1000,
158064
- });
158065
- };
158066
-
158067
158035
  var main$2 = {exports: {}};
158068
158036
 
158069
158037
  var name = "dotenv";
@@ -158750,6 +158718,7 @@ exports.SLACK_WEB_TEXTS = SLACK_WEB_TEXTS;
158750
158718
  exports.STORAGE_STATE = STORAGE_STATE;
158751
158719
  exports.SidebarSection = SidebarSection;
158752
158720
  exports.SlackPage = SlackPage;
158721
+ exports.TABLE_SELECTORS = TABLE_SELECTORS;
158753
158722
  exports.TAB_SELECTORS = TAB_SELECTORS;
158754
158723
  exports.TAGS_SELECTORS = TAGS_SELECTORS;
158755
158724
  exports.TEXT_MODIFIER_ROLES = TEXT_MODIFIER_ROLES;
@@ -158797,7 +158766,6 @@ exports.joinHyphenCase = joinHyphenCase;
158797
158766
  exports.joinString = joinString;
158798
158767
  exports.login = login;
158799
158768
  exports.loginWithoutSSO = loginWithoutSSO;
158800
- exports.memberUtils = memberUtils;
158801
158769
  exports.networkConditions = networkConditions;
158802
158770
  exports.networkThrottlingUsingCDP = networkThrottlingUsingCDP;
158803
158771
  exports.readFileSyncIfExists = readFileSyncIfExists;