From 766cc94cd1899e063d1c358d9b871c95d6887035 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 21 Feb 2023 22:37:10 +0530 Subject: [PATCH] test: undo/redo UI test --- cypress/integration/form_builder.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cypress/integration/form_builder.js b/cypress/integration/form_builder.js index a02febedc1..85d7ef91e0 100644 --- a/cypress/integration/form_builder.js +++ b/cypress/integration/form_builder.js @@ -273,4 +273,29 @@ context("Form Builder", () => { .find(".msgprint") .should("contain", "cannot be hidden and mandatory without any default value"); }); + + it("Undo/Redo", () => { + cy.visit(`/app/form-builder/${doctype_name}`); + + // click on second tab + cy.get(".tabs .tab:last").click(); + + let first_column = ".tab-content.active .section-columns-container:first .column:first"; + let first_field = first_column + " .field:first"; + let label = "div[title='Double click to edit label'] span:first"; + + // drag the first field to second position + cy.get(first_field).drag(first_column + " .field:nth-child(2)", { + target: { x: 100, y: 10 }, + }); + cy.get(first_field).find(label).should("have.text", "Check"); + + // undo + cy.get("body").type("{ctrl}z"); + cy.get(first_field).find(label).should("have.text", "Data"); + + // redo + cy.get("body").type("{ctrl}{shift}z"); + cy.get(first_field).find(label).should("have.text", "Check"); + }); });