From 5bb926d6ed4492cafeeb0e2d596482ce8a2176a5 Mon Sep 17 00:00:00 2001 From: Paul Li Date: Fri, 1 Apr 2022 04:07:22 +0800 Subject: [PATCH] feat: Internal property to detect changes in form -- Fix on the wrong widget name in RichTextEditor_spec.js -- Replace selectors so that Cypress can interact with UI in Select_spec.js --- .../FormWidgets/RichTextEditor_spec.js | 2 +- .../FormWidgets/Select_spec.js | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/RichTextEditor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/RichTextEditor_spec.js index c1d6248768..c43a0b0a1a 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/RichTextEditor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/RichTextEditor_spec.js @@ -132,7 +132,7 @@ describe("RichTextEditor Widget Functionality", function() { cy.openPropertyPane("textwidget"); cy.updateCodeInput( ".t--property-control-text", - `{{RichTextEditor1.isDirty}}`, + `{{RichtextEditor.isDirty}}`, ); // Change defaultText cy.openPropertyPane("richtexteditorwidget"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Select_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Select_spec.js index 4bba9edb7c..d3e373dedb 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Select_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Select_spec.js @@ -1,24 +1,29 @@ const explorer = require("../../../../locators/explorerlocators.json"); +const commonlocators = require("../../../../locators/commonlocators.json"); +const formWidgetsPage = require("../../../../locators/FormWidgets.json"); +const widgetLocators = require("../../../../locators/Widgets.json"); const widgetName = "selectwidget"; describe("Select widget", () => { - it("1. DragDrop Select/Text widgets", () => { + it("1. Drag and drop Select/Text widgets", () => { cy.get(explorer.addWidget).click(); cy.dragAndDropToCanvas(widgetName, { x: 300, y: 300 }); cy.get(`.t--widget-${widgetName}`).should("exist"); cy.dragAndDropToCanvas("textwidget", { x: 300, y: 500 }); + }); + it("2. Check isDirty meta property", () => { cy.openPropertyPane("textwidget"); cy.updateCodeInput(".t--property-control-text", `{{Select1.isDirty}}`); // Check if initial value of isDirty is false cy.get(".t--widget-textwidget").should("contain", "false"); // Interact with UI - cy.get( - `.t--widget-${widgetName} .bp3-popover-target > div > .bp3-button`, - ).click(); - cy.get(`.bp3-popover-content ul.bp3-menu li`) - .first() - .click(); + cy.get(formWidgetsPage.selectWidget) + .find(widgetLocators.dropdownSingleSelect) + .click({ force: true }); + cy.get(commonlocators.singleSelectWidgetMenuItem) + .contains("Blue") + .click({ force: true }); // Check if isDirty is set to true cy.get(".t--widget-textwidget").should("contain", "true"); // Change defaultOptionValue property