@bigbinary/neeto-playwright-commons 3.2.0 → 3.2.1

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",
@@ -119481,6 +119483,7 @@ class SlackPage extends IntegrationBase {
119481
119483
  allowButton;
119482
119484
  callbackUrl;
119483
119485
  currentWorkspace;
119486
+ slackApi;
119484
119487
  constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }) {
119485
119488
  super({
119486
119489
  page,
@@ -119491,6 +119494,7 @@ class SlackPage extends IntegrationBase {
119491
119494
  this.allowButton = this.page.getByRole("button", {
119492
119495
  name: SLACK_WEB_TEXTS.allow,
119493
119496
  });
119497
+ this.slackApi = new SlackApi(this.neetoPlaywrightUtilities);
119494
119498
  }
119495
119499
  setupCloseHandlers = async (slackWebappPage = this.page) => {
119496
119500
  const slackWebappPageDataQa = getByDataQA(slackWebappPage);
@@ -119675,6 +119679,12 @@ class SlackPage extends IntegrationBase {
119675
119679
  await nextButton.click();
119676
119680
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.inviteToWorkspaceSkipButton).click();
119677
119681
  };
119682
+ /**
119683
+ * @deprecated Use {@link SlackPage.archiveChannelViaAPI} instead. This flow
119684
+ * drives the Slack web UI to permanently delete a channel and is brittle;
119685
+ * `archiveChannelViaAPI` archives via the Slack Web API (requires
119686
+ * `SLACK_BOT_TOKEN`).
119687
+ */
119678
119688
  deleteSlackChannel = async (channel) => {
119679
119689
  const channelItem = this.slackWebappPage.locator(SLACK_SELECTORS.channelItems, { hasText: channel });
119680
119690
  await channelItem.click({ button: "right" });
@@ -119695,6 +119705,12 @@ class SlackPage extends IntegrationBase {
119695
119705
  .click();
119696
119706
  await test.expect(channelItem).toBeHidden();
119697
119707
  };
119708
+ archiveChannelViaAPI = async (name) => {
119709
+ const response = await this.slackApi.listChannels();
119710
+ const { channels } = (await response?.json());
119711
+ const channel = neetoCist.findBy({ name }, channels);
119712
+ channel?.id && (await this.slackApi.archiveChannel(channel.id));
119713
+ };
119698
119714
  }
119699
119715
 
119700
119716
  class WebhooksPage {
@@ -126746,6 +126762,7 @@ const definePlaywrightConfig = (overrides) => {
126746
126762
  name: PROJECT_NAMES.productionHealth,
126747
126763
  testDir: "./e2e/health",
126748
126764
  testMatch: "production.health.ts",
126765
+ retries: IS_CI ? 3 : 0,
126749
126766
  use: {
126750
126767
  ...test.devices["Desktop Chrome"],
126751
126768
  baseURL: process.env.PLAYWRIGHT_PRODUCTION_BASE_URL,