Skip to content
Snippets Groups Projects
Commit 31202346 authored by Johanna Szepanski's avatar Johanna Szepanski
Browse files

migrated dialog test

parent 68477fd2
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !217. Comments created here will be created in the context of that merge request.
import "@testing-library/cypress";
import { composeStories } from "@storybook/react";
import { mount } from "cypress/react";
import * as stories from "../../../stories/common/Dialog/Dialog.stories";
const { BasicDialog, Confirmation, DangerActionDialog } =
......@@ -6,14 +8,14 @@ const { BasicDialog, Confirmation, DangerActionDialog } =
describe("SimpleDialog", () => {
it("should close on clicking close", () => {
cy.mount(<BasicDialog />);
mount(<BasicDialog />);
cy.findByText(/some title/i).should("exist");
cy.findByRole("button", { name: /close/i }).click();
cy.findByText(/some title/i).should("not.exist");
});
it("should close on escape", () => {
cy.mount(<BasicDialog />);
mount(<BasicDialog />);
cy.findByText(/some title/i)
.should("exist")
......@@ -26,7 +28,7 @@ const closedText = "You closed the dialog!";
describe("ConfirmationDialog", () => {
it("should close on clicking close icon", () => {
cy.mount(<Confirmation />);
mount(<Confirmation />);
cy.findByText(/some title/i).should("exist");
cy.findByRole("button", { name: /close/i }).click();
......@@ -34,7 +36,7 @@ describe("ConfirmationDialog", () => {
cy.findByText(closedText).should("exist");
});
it("should close on escape", () => {
cy.mount(<Confirmation />);
mount(<Confirmation />);
cy.findByText(/some title/i)
.should("exist")
......@@ -43,7 +45,7 @@ describe("ConfirmationDialog", () => {
cy.findByText(closedText).should("exist");
});
it("should close and when clicking cancel", () => {
cy.mount(<Confirmation />);
mount(<Confirmation />);
cy.findByText(/some title/i).should("exist");
cy.findByRole("button", { name: /cancel/i }).click();
......@@ -54,7 +56,7 @@ describe("ConfirmationDialog", () => {
describe("DangerActionDialog", () => {
const mountDangerActionDialog = () => {
cy.mount(<DangerActionDialog />);
mount(<DangerActionDialog />);
cy.contains("Open Danger Action Dialog").click();
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment