Skip to content
Snippets Groups Projects

CE-3633: Migrate dialogs

Merged Johanna Szepanski requested to merge CE-3633-migrate-dialogs into main
1 file
+ 8
6
Compare changes
  • Side-by-side
  • Inline
 
import "@testing-library/cypress";
import { composeStories } from "@storybook/react";
import { composeStories } from "@storybook/react";
 
import { mount } from "cypress/react";
import * as stories from "../../../stories/common/Dialog/Dialog.stories";
import * as stories from "../../../stories/common/Dialog/Dialog.stories";
const { BasicDialog, Confirmation, DangerActionDialog } =
const { BasicDialog, Confirmation, DangerActionDialog } =
@@ -6,14 +8,14 @@ const { BasicDialog, Confirmation, DangerActionDialog } =
@@ -6,14 +8,14 @@ const { BasicDialog, Confirmation, DangerActionDialog } =
describe("SimpleDialog", () => {
describe("SimpleDialog", () => {
it("should close on clicking close", () => {
it("should close on clicking close", () => {
cy.mount(<BasicDialog />);
mount(<BasicDialog />);
cy.findByText(/some title/i).should("exist");
cy.findByText(/some title/i).should("exist");
cy.findByRole("button", { name: /close/i }).click();
cy.findByRole("button", { name: /close/i }).click();
cy.findByText(/some title/i).should("not.exist");
cy.findByText(/some title/i).should("not.exist");
});
});
it("should close on escape", () => {
it("should close on escape", () => {
cy.mount(<BasicDialog />);
mount(<BasicDialog />);
cy.findByText(/some title/i)
cy.findByText(/some title/i)
.should("exist")
.should("exist")
@@ -26,7 +28,7 @@ const closedText = "You closed the dialog!";
@@ -26,7 +28,7 @@ const closedText = "You closed the dialog!";
describe("ConfirmationDialog", () => {
describe("ConfirmationDialog", () => {
it("should close on clicking close icon", () => {
it("should close on clicking close icon", () => {
cy.mount(<Confirmation />);
mount(<Confirmation />);
cy.findByText(/some title/i).should("exist");
cy.findByText(/some title/i).should("exist");
cy.findByRole("button", { name: /close/i }).click();
cy.findByRole("button", { name: /close/i }).click();
@@ -34,7 +36,7 @@ describe("ConfirmationDialog", () => {
@@ -34,7 +36,7 @@ describe("ConfirmationDialog", () => {
cy.findByText(closedText).should("exist");
cy.findByText(closedText).should("exist");
});
});
it("should close on escape", () => {
it("should close on escape", () => {
cy.mount(<Confirmation />);
mount(<Confirmation />);
cy.findByText(/some title/i)
cy.findByText(/some title/i)
.should("exist")
.should("exist")
@@ -43,7 +45,7 @@ describe("ConfirmationDialog", () => {
@@ -43,7 +45,7 @@ describe("ConfirmationDialog", () => {
cy.findByText(closedText).should("exist");
cy.findByText(closedText).should("exist");
});
});
it("should close and when clicking cancel", () => {
it("should close and when clicking cancel", () => {
cy.mount(<Confirmation />);
mount(<Confirmation />);
cy.findByText(/some title/i).should("exist");
cy.findByText(/some title/i).should("exist");
cy.findByRole("button", { name: /cancel/i }).click();
cy.findByRole("button", { name: /cancel/i }).click();
@@ -54,7 +56,7 @@ describe("ConfirmationDialog", () => {
@@ -54,7 +56,7 @@ describe("ConfirmationDialog", () => {
describe("DangerActionDialog", () => {
describe("DangerActionDialog", () => {
const mountDangerActionDialog = () => {
const mountDangerActionDialog = () => {
cy.mount(<DangerActionDialog />);
mount(<DangerActionDialog />);
cy.contains("Open Danger Action Dialog").click();
cy.contains("Open Danger Action Dialog").click();
};
};
Loading