From 4661f6ebccb81b1515bce3f9073e0e216bd2f546 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Avendano Date: Mon, 28 Oct 2024 16:43:10 -0400 Subject: [PATCH] FOUR-19778 Encrypted field does not have read-only mode --- src/components/renderer/form-masked-input.vue | 12 +++--- tests/e2e/specs/EncryptedField.spec.js | 42 ++++++++++++++++++- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/components/renderer/form-masked-input.vue b/src/components/renderer/form-masked-input.vue index 125797398..44c810a59 100644 --- a/src/components/renderer/form-masked-input.vue +++ b/src/components/renderer/form-masked-input.vue @@ -41,7 +41,7 @@ { // After conceal the value should be the same cy.get("[data-cy=preview-content] [name=form_input_1]").should("have.value", secretValue); }); -}); \ No newline at end of file + + it("Encrypted field in preview with 'readonly' property enabled", () => { + visitAndOpenAcordeon(); + dragFormInput(); + // Enable "readonly" mode + cy.get("[data-cy=inspector-readonly]").click(); + cy.get("[data-cy=accordion-Advanced]").click(); + // Enable encrypted + cy.get("[data-cy=inspector-encryptedConfig]") + .children() + .children(".custom-control") + .each((control) => { + // forced click over the control + control.children("input").trigger("click"); + }); + // Display available users/groups + cy.get('[data-cy="inspector-encryptedConfig"] .multiselect').click(); + // Select a group + cy.get('[data-cy="inspector-encryptedConfig"] #option-2-4').click(); + // Go to preview mode + enterPreviewMode(); + // Set initial data + cy.setPreviewDataInput('{"form_input_1":"Other value"}'); + // Click in "Conceal" with data + cy.get('[data-cy=preview-content] [name=form_input_1]').siblings('button').click(); + // After conceal should be keep the "readonly" mode + cy.get("[data-cy=preview-content] [name=form_input_1]").should("have.attr", "readonly"); + // After conceal the value should be different + cy.get("[data-cy=preview-content] [name=form_input_1]").should("have.not.value", secretValue); + // The value in data should be the uuid returned + cy.assertPreviewData({ + form_input_1: uuid, + }); + // Click in "Reveal" + cy.get('[data-cy=preview-content] [name=form_input_1]').siblings('button').click(); + // After conceal should be keep the "readonly" mode + cy.get("[data-cy=preview-content] [name=form_input_1]").should("have.attr", "readonly"); + // After conceal the value should be the same + cy.get("[data-cy=preview-content] [name=form_input_1]").should("have.value", secretValue); + }); +});