Skip to content

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

701 B
Raw Blame
// eslint-disable-next-line metabase/no-direct-helper-import
import { H } from "e2e/support";

export const tryToCreateApiKeyViaModal = ({
  name,
  group,
}: {
  name: string;
  group: string | RegExp;
}) => {
  cy.findByTestId("api-keys-settings-header")
    .button(/create an api key/i)
    .click();
  H.modal().within(() => {
    cy.findByLabelText(/Key name/).type(name);
    cy.findByLabelText(/group/i).click();
  });

  H.selectDropdown()
    .findByRole("option", {
      name: group,
      // Workaround for Mantine bug where the dropdown is hidden while the modal is open
      hidden: true,
    })
    .click();

  H.modal().button("Create").click();

  return cy.wait("@createKey");
};