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"); + }); });