@bigbinary/neeto-playwright-commons 3.2.0 → 3.2.2

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
@@ -639,6 +639,8 @@ class SlackApi {
639
639
  fetchMessages = (channelId, unixTimestamp) => this.apiRequest("history", { channel: channelId, oldest: unixTimestamp });
640
640
  createChannel = (channelName) => this.apiRequest("create", { name: channelName });
641
641
  addUser = (channelId, userId) => this.apiRequest("invite", { channel: channelId, users: userId });
642
+ listChannels = () => this.apiRequest("list", { exclude_archived: 1, limit: 1000 });
643
+ archiveChannel = (channelId) => this.apiRequest("archive", { channel: channelId });
642
644
  mockChannelDeleted = (channelId) => this.neetoPlaywrightUtilities.apiRequest({
643
645
  url: "/neeto_slack/api/v1/testing/webhooks",
644
646
  method: "post",
@@ -6069,7 +6071,7 @@ class CustomCommands {
6069
6071
  const startTime = Date.now();
6070
6072
  return await this.recursiveMethod(callback, condition, timeout, startTime, 1);
6071
6073
  };
6072
- verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10_000, customPageContext = this.page, } = {}) => {
6074
+ verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10_000, toastCloseTimeout = 10_000, customPageContext = this.page, } = {}) => {
6073
6075
  // React-toastify does not support adding data-* attributes to toast DOM elements: https://github.com/fkhadra/react-toastify/issues/1106
6074
6076
  const toastrLocator = customPageContext
6075
6077
  .locator(COMMON_SELECTORS.neetoUiToastr)
@@ -6090,7 +6092,9 @@ class CustomCommands {
6090
6092
  await customPageContext.evaluate(button => {
6091
6093
  button.dispatchEvent(new Event("click", { bubbles: true }));
6092
6094
  }, buttonHandle);
6093
- await test.expect(toastrCloseButton).toBeHidden({ timeout: 10_000 });
6095
+ await test.expect(toastrCloseButton).toBeHidden({
6096
+ timeout: toastCloseTimeout,
6097
+ });
6094
6098
  }
6095
6099
  };
6096
6100
  waitForPageLoad = async ({ visibilityTimeout = 35_000, customPageContext = this.page, waitForOption = "serial", } = {}) => {
@@ -119481,6 +119485,7 @@ class SlackPage extends IntegrationBase {
119481
119485
  allowButton;
119482
119486
  callbackUrl;
119483
119487
  currentWorkspace;
119488
+ slackApi;
119484
119489
  constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }) {
119485
119490
  super({
119486
119491
  page,
@@ -119491,6 +119496,7 @@ class SlackPage extends IntegrationBase {
119491
119496
  this.allowButton = this.page.getByRole("button", {
119492
119497
  name: SLACK_WEB_TEXTS.allow,
119493
119498
  });
119499
+ this.slackApi = new SlackApi(this.neetoPlaywrightUtilities);
119494
119500
  }
119495
119501
  setupCloseHandlers = async (slackWebappPage = this.page) => {
119496
119502
  const slackWebappPageDataQa = getByDataQA(slackWebappPage);
@@ -119675,6 +119681,12 @@ class SlackPage extends IntegrationBase {
119675
119681
  await nextButton.click();
119676
119682
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.inviteToWorkspaceSkipButton).click();
119677
119683
  };
119684
+ /**
119685
+ * @deprecated Use {@link SlackPage.archiveChannelViaAPI} instead. This flow
119686
+ * drives the Slack web UI to permanently delete a channel and is brittle;
119687
+ * `archiveChannelViaAPI` archives via the Slack Web API (requires
119688
+ * `SLACK_BOT_TOKEN`).
119689
+ */
119678
119690
  deleteSlackChannel = async (channel) => {
119679
119691
  const channelItem = this.slackWebappPage.locator(SLACK_SELECTORS.channelItems, { hasText: channel });
119680
119692
  await channelItem.click({ button: "right" });
@@ -119695,6 +119707,12 @@ class SlackPage extends IntegrationBase {
119695
119707
  .click();
119696
119708
  await test.expect(channelItem).toBeHidden();
119697
119709
  };
119710
+ archiveChannelViaAPI = async (name) => {
119711
+ const response = await this.slackApi.listChannels();
119712
+ const { channels } = (await response?.json());
119713
+ const channel = neetoCist.findBy({ name }, channels);
119714
+ channel?.id && (await this.slackApi.archiveChannel(channel.id));
119715
+ };
119698
119716
  }
119699
119717
 
119700
119718
  class WebhooksPage {
@@ -126746,6 +126764,7 @@ const definePlaywrightConfig = (overrides) => {
126746
126764
  name: PROJECT_NAMES.productionHealth,
126747
126765
  testDir: "./e2e/health",
126748
126766
  testMatch: "production.health.ts",
126767
+ retries: IS_CI ? 3 : 0,
126749
126768
  use: {
126750
126769
  ...test.devices["Desktop Chrome"],
126751
126770
  baseURL: process.env.PLAYWRIGHT_PRODUCTION_BASE_URL,