@bigbinary/neeto-playwright-commons 1.8.38 → 1.8.40

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
@@ -172,6 +172,16 @@ const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserSt
172
172
  // trims and replaces multiple whitespace characters in a string with a single space
173
173
  const squish = (text) => text.trim().replace(/\s+/g, " ");
174
174
  const toCamelCase = (string) => string.toLowerCase().replace(/( \w)/g, letter => letter[1].toUpperCase());
175
+ const getByDataQA = ramda.curry((page, dataQa) => {
176
+ if (typeof dataQa === "string") {
177
+ // eslint-disable-next-line playwright/no-raw-locators
178
+ return page.locator(`[data-qa='${dataQa}']`);
179
+ }
180
+ // eslint-disable-next-line playwright/no-raw-locators
181
+ return page
182
+ .locator(`[data-qa='${dataQa[0]}']`)
183
+ .locator(`[data-qa='${dataQa[1]}']`);
184
+ });
175
185
 
176
186
  const COMMON_SELECTORS = {
177
187
  copyButton: "copy-button",
@@ -236,6 +246,7 @@ const COMMON_SELECTORS = {
236
246
  columnsDropdownContainer: "show/hide-columns-dropdown-container",
237
247
  columnsDropdownButton: "columns-dropdown-button",
238
248
  breadcrumbHeader: "header-breadcrumb",
249
+ header: "neeto-molecules-header",
239
250
  };
240
251
 
241
252
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -12584,6 +12595,10 @@ const SLACK_WEB_TEXTS = {
12584
12595
  signOut: "Sign out",
12585
12596
  allow: "Allow",
12586
12597
  loadingThread: "Loading thread",
12598
+ name: "Name",
12599
+ deleteThisChannel: "Delete this channel",
12600
+ permanentlyDeleteTheChannel: "Yes, permanently delete the channel",
12601
+ deleteChannel: "Delete channel",
12587
12602
  };
12588
12603
 
12589
12604
  const HELP_CENTER_SELECTORS = {
@@ -12932,6 +12947,21 @@ const SLACK_SELECTORS = {
12932
12947
  replyBar: "[data-qa='reply_bar']",
12933
12948
  markdownElement: "[data-qa='bk_markdown_element']",
12934
12949
  virtualListItem: "[data-qa='virtual-list-item']",
12950
+ channelItems: '[role="treeitem"][data-qa="virtual-list-item"]',
12951
+ };
12952
+ const SLACK_DATA_QA_SELECTORS = {
12953
+ sectionHeadingButton: "section_heading_button__channels",
12954
+ channelSectionSubmenuCreate: "channel_section_submenu_create",
12955
+ channelSectionMenuCreateChannel: "channel_section_menu__create_channel",
12956
+ skModalContent: "sk-modal-content",
12957
+ infiniteSpinner: "infinite-spinner",
12958
+ channelNameOptionsList: "channel-name-options-list",
12959
+ channelNameInput: "channel-name-input",
12960
+ createChannelNextButton: "create-channel-next-button",
12961
+ inviteToWorkspaceSkipButton: "invite_to_workspace_skip_button",
12962
+ menuItems: "menu_items",
12963
+ channelDetailsModal: "channel_details_modal",
12964
+ channelDetailsSettingsTab: "channel_details_settings_tab",
12935
12965
  };
12936
12966
 
12937
12967
  /* eslint-disable playwright/no-raw-locators */
@@ -12943,7 +12973,7 @@ class SlackPage extends IntegrationBase {
12943
12973
  integration: "slack",
12944
12974
  integrationRouteIndex,
12945
12975
  });
12946
- this.connectAndVerifyIntegration = async (redirectUrl, customSteps) => {
12976
+ this.connectAndVerifyIntegration = async (redirectUrl, customSteps, channelToConfigure = SLACK_DEFAULT_CHANNEL) => {
12947
12977
  await this.connect();
12948
12978
  await this.page
12949
12979
  .getByRole("button", {
@@ -12966,7 +12996,11 @@ class SlackPage extends IntegrationBase {
12966
12996
  teamName: currentWorkspace,
12967
12997
  }),
12968
12998
  })).toBeVisible();
12969
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.selectValueContainer)).toContainText(SLACK_DEFAULT_CHANNEL);
12999
+ await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
13000
+ value: channelToConfigure,
13001
+ selectValueContainer: COMMON_SELECTORS.selectValueContainer,
13002
+ selectMenu: COMMON_SELECTORS.dropdownMenu,
13003
+ });
12970
13004
  await this.page
12971
13005
  .getByRole("button", { name: this.t("neetoSlack.common.continue") })
12972
13006
  .click();
@@ -12989,11 +13023,14 @@ class SlackPage extends IntegrationBase {
12989
13023
  await this.disconnect();
12990
13024
  await this.verifyIntegrationStatus("disconnected");
12991
13025
  };
12992
- this.updateConfigureSlackChannel = async ({ newSlackChannel = "random", interceptMultipleResponsesParams = {}, }) => {
13026
+ this.updateConfigureSlackChannel = async ({ newSlackChannel = "random", interceptMultipleResponsesParams = {}, refreshInterceptMultipleResponsesParams = {}, refreshChannelList = false, }) => {
12993
13027
  await this.page.getByTestId(INTEGRATION_SELECTORS.manageButton).click();
12994
13028
  await this.page
12995
13029
  .getByRole("button", { name: this.t("neetoSlack.common.edit") })
12996
13030
  .click();
13031
+ if (refreshChannelList) {
13032
+ await this.clickOnChannelListRefreshButton(refreshInterceptMultipleResponsesParams);
13033
+ }
12997
13034
  await this.page.getByTestId(COMMON_SELECTORS.selectContainer).click();
12998
13035
  await this.page
12999
13036
  .getByTestId(COMMON_SELECTORS.dropdownMenu)
@@ -13008,25 +13045,41 @@ class SlackPage extends IntegrationBase {
13008
13045
  .click();
13009
13046
  await savePromise;
13010
13047
  };
13011
- this.loginToSlackWebapp = async (slackWebappPage) => {
13048
+ this.clickOnChannelListRefreshButton = async (refreshInterceptMultipleResponsesParams) => {
13049
+ const refreshChannelPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13050
+ times: 0,
13051
+ ...refreshInterceptMultipleResponsesParams,
13052
+ });
13053
+ await this.page
13054
+ .getByRole("button", {
13055
+ name: this.t("neetoSlack.slack.channelListRefreshButton"),
13056
+ })
13057
+ .click();
13058
+ await refreshChannelPromise;
13059
+ };
13060
+ this.loginToSlackWebapp = async (slackWebappPage, customCredentials) => {
13012
13061
  this.slackWebappPage = slackWebappPage;
13013
- if (ramda.isNotNil(process.env.SLACK_WORKSPACE) &&
13014
- ramda.isNotNil(process.env.SLACK_LOGIN_PASSWORD) &&
13015
- ramda.isNotNil(process.env.SLACK_LOGIN_EMAIL)) {
13016
- await slackWebappPage.goto(THIRD_PARTY_ROUTES.slack.loginWithPassword(process.env.SLACK_WORKSPACE));
13062
+ this.slackWebappPageDataQa = getByDataQA(this.slackWebappPage);
13063
+ const slackWorkspace = (customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.workspace) || process.env.SLACK_WORKSPACE;
13064
+ const slackLoginPassword = (customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.loginPassword) || process.env.SLACK_LOGIN_PASSWORD;
13065
+ const slackLoginEmail = (customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.loginEmail) || process.env.SLACK_LOGIN_EMAIL;
13066
+ if (ramda.isNotNil(slackWorkspace) &&
13067
+ ramda.isNotNil(slackLoginPassword) &&
13068
+ ramda.isNotNil(slackLoginEmail)) {
13069
+ await slackWebappPage.goto(THIRD_PARTY_ROUTES.slack.loginWithPassword(slackWorkspace));
13017
13070
  await slackWebappPage
13018
13071
  .locator(SLACK_SELECTORS.loginEmail)
13019
- .pressSequentially(process.env.SLACK_LOGIN_EMAIL, { delay: 10 });
13072
+ .pressSequentially(slackLoginEmail, { delay: 10 });
13020
13073
  await slackWebappPage
13021
13074
  .locator(SLACK_SELECTORS.loginPassword)
13022
- .pressSequentially(process.env.SLACK_LOGIN_PASSWORD, { delay: 10 });
13075
+ .pressSequentially(slackLoginPassword, { delay: 10 });
13023
13076
  await slackWebappPage.locator(SLACK_SELECTORS.signInButton).click();
13024
13077
  await slackWebappPage
13025
13078
  .locator(SLACK_SELECTORS.redirectOpenInBrowser)
13026
13079
  .click();
13027
13080
  }
13028
13081
  else {
13029
- throw new Error("ENV variable SLACK_LOGIN_EMAIL or SLACK_LOGIN_PASSWORD or SLACK_WORKSPACE is not defined. Please add the API key to use this fixture.");
13082
+ throw new Error("ENV variable SLACK_LOGIN_EMAIL or SLACK_LOGIN_PASSWORD or SLACK_WORKSPACE is not defined.");
13030
13083
  }
13031
13084
  };
13032
13085
  this.logoutFromSlackWebApp = async () => {
@@ -13045,6 +13098,49 @@ class SlackPage extends IntegrationBase {
13045
13098
  .locator(SLACK_SELECTORS.virtualListItem, { hasText: slackChannel })
13046
13099
  .click();
13047
13100
  };
13101
+ this.createNewSlackChannel = async ({ channelName, kind = "public", }) => {
13102
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.sectionHeadingButton).click();
13103
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelSectionSubmenuCreate).click();
13104
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelSectionMenuCreateChannel).click();
13105
+ await test$1.expect(this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.skModalContent)).toBeVisible();
13106
+ await test$1.expect(this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.infiniteSpinner)).toBeHidden();
13107
+ await test$1.expect(this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelNameOptionsList)).toBeHidden({ timeout: 5000 });
13108
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.skModalContent)
13109
+ .getByText(SLACK_WEB_TEXTS.name, { exact: true })
13110
+ .click();
13111
+ await this.slackWebappPageDataQa([
13112
+ SLACK_DATA_QA_SELECTORS.skModalContent,
13113
+ SLACK_DATA_QA_SELECTORS.channelNameInput,
13114
+ ]).pressSequentially(channelName);
13115
+ await test$1.expect(this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.infiniteSpinner)).toBeHidden();
13116
+ await test$1.expect(this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.createChannelNextButton)).toBeEnabled();
13117
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.createChannelNextButton).click();
13118
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.skModalContent)
13119
+ .getByRole("radio", { name: kind })
13120
+ .check();
13121
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.createChannelNextButton).click();
13122
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.inviteToWorkspaceSkipButton).click();
13123
+ };
13124
+ this.deleteSlackChannel = async (channel) => {
13125
+ const channelItem = this.slackWebappPage.locator(SLACK_SELECTORS.channelItems, { hasText: channel });
13126
+ await channelItem.click({ button: "right" });
13127
+ await this.slackWebappPageDataQa([
13128
+ SLACK_DATA_QA_SELECTORS.menuItems,
13129
+ SLACK_DATA_QA_SELECTORS.channelDetailsModal,
13130
+ ]).click();
13131
+ await test$1.expect(this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelDetailsModal)).toBeVisible();
13132
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelDetailsSettingsTab).click();
13133
+ await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.skModalContent)
13134
+ .getByRole("button", { name: SLACK_WEB_TEXTS.deleteThisChannel })
13135
+ .click();
13136
+ await this.slackWebappPage
13137
+ .getByLabel(SLACK_WEB_TEXTS.permanentlyDeleteTheChannel)
13138
+ .check();
13139
+ await this.slackWebappPage
13140
+ .getByRole("button", { name: SLACK_WEB_TEXTS.deleteChannel })
13141
+ .click();
13142
+ await test$1.expect(channelItem).toBeHidden();
13143
+ };
13048
13144
  }
13049
13145
  }
13050
13146
 
@@ -147084,6 +147180,7 @@ exports.PROJECT_TRANSLATIONS_PATH = PROJECT_TRANSLATIONS_PATH;
147084
147180
  exports.ROLES_SELECTORS = ROLES_SELECTORS;
147085
147181
  exports.ROUTES = ROUTES;
147086
147182
  exports.SIGNUP_SELECTORS = SIGNUP_SELECTORS;
147183
+ exports.SLACK_DATA_QA_SELECTORS = SLACK_DATA_QA_SELECTORS;
147087
147184
  exports.SLACK_DEFAULT_CHANNEL = SLACK_DEFAULT_CHANNEL;
147088
147185
  exports.SLACK_SELECTORS = SLACK_SELECTORS;
147089
147186
  exports.SLACK_WEB_TEXTS = SLACK_WEB_TEXTS;
@@ -147101,6 +147198,7 @@ exports.definePlaywrightConfig = definePlaywrightConfig;
147101
147198
  exports.executeWithThrottledResources = executeWithThrottledResources;
147102
147199
  exports.extractSubdomainFromError = extractSubdomainFromError;
147103
147200
  exports.generateStagingData = generateStagingData;
147201
+ exports.getByDataQA = getByDataQA;
147104
147202
  exports.getGlobalUserState = getGlobalUserState;
147105
147203
  exports.headerUtils = headerUtils;
147106
147204
  exports.hyphenize = hyphenize;