From 6df43f5d9ee73964ea38ac181a4cb06f622165e0 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelca Date: Fri, 25 Oct 2024 11:48:19 -0400 Subject: [PATCH 1/3] FOUR-19767: Clipboard isn't cleared after add a new control --- src/components/vue-form-builder.vue | 4 ++++ src/mixins/Clipboard.js | 1 + 2 files changed, 5 insertions(+) diff --git a/src/components/vue-form-builder.vue b/src/components/vue-form-builder.vue index 02f7cd400..f0b0c56c6 100644 --- a/src/components/vue-form-builder.vue +++ b/src/components/vue-form-builder.vue @@ -127,6 +127,7 @@ v-if="isClipboardPage(tabPage)" variant="link" @click="clearClipboard" + class="no-text-transform" > {{ $t('Clear All') }} @@ -1745,4 +1746,7 @@ $side-bar-font-size: 0.875rem; cursor: not-allowed; /* Cambia el cursor cuando se pasa por encima */ pointer-events: all; /* Permite que el pseudo-elemento reciba eventos del ratón */ } +.no-text-transform { + text-transform: none; +} diff --git a/src/mixins/Clipboard.js b/src/mixins/Clipboard.js index 077729ff2..2b2f3ca63 100644 --- a/src/mixins/Clipboard.js +++ b/src/mixins/Clipboard.js @@ -144,6 +144,7 @@ export default { } ); if (confirm) { + this.clipboardPage.items = []; this.$store.dispatch("clipboardModule/clearClipboard"); this.$root.$emit('update-clipboard'); } From 5894bd070ba75c3019a093b67077f70ea0bc68fd Mon Sep 17 00:00:00 2001 From: Rodrigo Quelca Date: Fri, 25 Oct 2024 11:48:52 -0400 Subject: [PATCH 2/3] add clear all test --- tests/e2e/specs/ClipboardTabClearAll.spec.js | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/e2e/specs/ClipboardTabClearAll.spec.js diff --git a/tests/e2e/specs/ClipboardTabClearAll.spec.js b/tests/e2e/specs/ClipboardTabClearAll.spec.js new file mode 100644 index 000000000..f1150be73 --- /dev/null +++ b/tests/e2e/specs/ClipboardTabClearAll.spec.js @@ -0,0 +1,38 @@ +describe("Clipboard Page and clear all", () => { + + + + it("Verify that the controls created in the clipboard page were removed with clear all option", () => { + // Clear local storage + cy.clearLocalStorage(); + cy.visit("/"); + cy.openAcordeonByLabel("Input Fields"); + + cy.get("[data-test=page-dropdown").click(); + cy.get("[data-test=clipboard]").should("exist").click({ force: true }); + // Step 1: Dragging controls to screen drop zone + cy.get("[data-cy=controls-FormInput]").drag("[data-cy=editor-content]", { position: "bottom" }); + cy.get("[data-cy=controls-FormSelectList]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormButton]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormTextArea]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormDatePicker]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormCheckbox]").drag("[data-cy=screen-element-container]", { position: "top" }); + + + cy.get('[data-cy="screen-element-container"]') + .children() + .should('have.length', 6); + cy.contains('button', 'Clear All').click(); + cy.contains('button', 'Cancel').click(); + cy.get('[data-cy="screen-element-container"]') + .children() + .should('have.length', 6); + cy.contains('button', 'Clear All').click(); + cy.contains('button', 'Confirm').click(); + + cy.get('[data-cy="editor-content"]') + .children() + .should('have.length', 0); + }); + +}); \ No newline at end of file From e64284c9fce3fa5775eb8e600be59faf084eb60d Mon Sep 17 00:00:00 2001 From: Rodrigo Quelca Date: Fri, 25 Oct 2024 11:54:28 -0400 Subject: [PATCH 3/3] improve test --- tests/e2e/specs/ClipboardTabClearAll.spec.js | 44 +++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tests/e2e/specs/ClipboardTabClearAll.spec.js b/tests/e2e/specs/ClipboardTabClearAll.spec.js index f1150be73..561d1ac0b 100644 --- a/tests/e2e/specs/ClipboardTabClearAll.spec.js +++ b/tests/e2e/specs/ClipboardTabClearAll.spec.js @@ -1,16 +1,20 @@ -describe("Clipboard Page and clear all", () => { +describe("Clipboard Page and Clear All Functionality", () => { - - - it("Verify that the controls created in the clipboard page were removed with clear all option", () => { - // Clear local storage + it("should remove all controls in the clipboard page when 'Clear All' is confirmed", () => { + // Clear local storage to ensure a clean test environment cy.clearLocalStorage(); + + // Visit the home page cy.visit("/"); + + // Open the 'Input Fields' accordion section cy.openAcordeonByLabel("Input Fields"); - - cy.get("[data-test=page-dropdown").click(); + + // Navigate to the clipboard page + cy.get("[data-test=page-dropdown]").click(); cy.get("[data-test=clipboard]").should("exist").click({ force: true }); - // Step 1: Dragging controls to screen drop zone + + // Step 1: Dragging controls to the screen drop zone in the clipboard cy.get("[data-cy=controls-FormInput]").drag("[data-cy=editor-content]", { position: "bottom" }); cy.get("[data-cy=controls-FormSelectList]").drag("[data-cy=screen-element-container]", { position: "top" }); cy.get("[data-cy=controls-FormButton]").drag("[data-cy=screen-element-container]", { position: "top" }); @@ -18,21 +22,21 @@ describe("Clipboard Page and clear all", () => { cy.get("[data-cy=controls-FormDatePicker]").drag("[data-cy=screen-element-container]", { position: "top" }); cy.get("[data-cy=controls-FormCheckbox]").drag("[data-cy=screen-element-container]", { position: "top" }); - - cy.get('[data-cy="screen-element-container"]') - .children() - .should('have.length', 6); + // Verify that all controls have been successfully added + cy.get('[data-cy="screen-element-container"]').children().should('have.length', 6); + + // Step 2: Attempt to clear all controls but cancel the action cy.contains('button', 'Clear All').click(); cy.contains('button', 'Cancel').click(); - cy.get('[data-cy="screen-element-container"]') - .children() - .should('have.length', 6); + + // Ensure controls are still present after canceling + cy.get('[data-cy="screen-element-container"]').children().should('have.length', 6); + + // Step 3: Confirm clearing all controls cy.contains('button', 'Clear All').click(); cy.contains('button', 'Confirm').click(); - cy.get('[data-cy="editor-content"]') - .children() - .should('have.length', 0); + // Validate that all controls have been removed + cy.get('[data-cy="editor-content"]').children().should('have.length', 0); }); - -}); \ No newline at end of file +});