Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.0 KB
Raw Blame
import { modal, popover } from "e2e/support/helpers/e2e-ui-elements-helpers";

export const sharingMenuButton = () => cy.findByTestId("sharing-menu-button");
export const sharingMenu = () => cy.findByTestId("sharing-menu");

export const openSharingMenu = (menuItemText?: string) => {
  sharingMenuButton().click();
  if (menuItemText) {
    sharingMenu().findByText(menuItemText).click();
  }
};

export const removeNotificationHandlerChannel = (channel: string) => {
  modal()
    .findByTestId("alert-configured-channel")
    .findByText(channel)
    .closest('[data-testid="channel-block"]')
    .findByTestId("remove-channel-button")
    .click();
};

export const addNotificationHandlerChannel = (
  channel: string,
  { hasNoChannelsAdded = false }: { hasNoChannelsAdded?: boolean } = {},
) => {
  if (hasNoChannelsAdded) {
    modal().findByText("Add a destination").should("be.visible").click();
  } else {
    modal().findByText("Add another destination").should("be.visible").click();
  }

  popover().findByText(channel).click();
};