From 015f5424f61d4b61b7b4e6c29d6223ff9224f1c4 Mon Sep 17 00:00:00 2001 From: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:18:00 +0530 Subject: [PATCH] test: Cypress | SetWidget property validations + CI Stabilize (#28626) ## Description - This PR includes [Set widget property Scenarios](https://github.com/appsmithorg/TestSmith/issues/2409) script - entityExplorer.RenameEntityFromExplorer() improved - jsEditor.CreateJSObject() improved **Flaky fixes below spces:** - ClientSide/JSObject/JSObjectMutation_spec.ts - Widgets/Form/FormWidget_Select_TreeSelect_spec.js - ClientSide/BugTests/Bug27817_Spec.ts - ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts - ClientSide/SettingsPane/EmbedSettings_spec.ts - /Widgets/Sliders/CategorySlider_spec.ts - Widgets/Select/RTL_support.ts - Widgets/TableV2/Edge_case_spec.js - Git/GitSync/SwitchBranches_spec.js - Widgets/Modal/Modal_spec.ts - MySQL_Datatypes/Basic_Spec.ts - Binding/TableTextPagination_spec.js - /GitSync/DeleteBranch_spec.js - /Sliders/NumberSlider_spec.ts #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress CI runs ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed --- .../ClientSide/BugTests/Bug27817_Spec.ts | 6 +- .../Git/GitSync/DeleteBranch_spec.js | 1 + .../ClientSide/JSObject/Bug9585_spec.ts | 2 - .../JSObject/JSObjectMutation_spec.ts | 2 +- .../ClientSide/SetProperty/SetOptions_Spec.ts | 386 ++++++++++++++++++ .../WidgetPropertySetters2_spec.ts | 110 ++++- .../Form/FormWidget_Select_TreeSelect_spec.js | 11 +- .../ClientSide/Widgets/Modal/Modal_spec.ts | 5 +- .../Multiselect/Multi_Select_Tree_spec.js | 37 +- .../ClientSide/Widgets/Select/RTL_support.ts | 4 - .../Widgets/Sliders/CategorySlider_spec.ts | 4 +- .../Widgets/Sliders/NumberSlider_spec.ts | 2 +- .../Widgets/TableV2/Edge_case_spec.js | 1 + ...elect_TreeSelect_MultiSelect_Empty_spec.ts | 10 +- .../TreeSelect/Single_Select_Tree_spec.ts | 42 +- .../Widgets/TreeSelect/Tree_Select_spec.ts | 12 +- .../JSFunctionExecution_spec.ts | 1 + .../ServerSide/MySQL_Datatypes/Basic_Spec.ts | 3 +- .../cypress/support/Objects/FeatureFlags.ts | 1 + .../cypress/support/Pages/AggregateHelper.ts | 3 + .../cypress/support/Pages/EntityExplorer.ts | 8 +- .../cypress/support/Pages/InviteModal.ts | 7 +- app/client/cypress/support/Pages/JSEditor.ts | 8 +- app/client/cypress/support/commands.js | 2 +- 24 files changed, 615 insertions(+), 53 deletions(-) create mode 100644 app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug27817_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug27817_Spec.ts index d69f1f7e99..deb6dd0f35 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug27817_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug27817_Spec.ts @@ -10,12 +10,10 @@ describe("Datasource structure schema preview data", () => { featureFlagIntercept({ ab_gsheet_schema_enabled: true }); dataSources.CreateDataSource("Postgres"); }); + it("1. Table selection should be enabled and add template button absent", () => { dataSources.selectTabOnDatasourcePage("View data"); - agHelper.TypeText( - dataSources._datasourceStructureSearchInput, - "public.users", - ); + agHelper.TypeText(dataSources._datasourceStructureSearchInput, "users"); agHelper.GetNClick( dataSources._dsPageTabContainerTableName("public.users"), ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/DeleteBranch_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/DeleteBranch_spec.js index 5d41bff883..689aa330d9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/DeleteBranch_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/DeleteBranch_spec.js @@ -95,6 +95,7 @@ describe("Delete branch flow", () => { }); it("4. Verify Default branch deletion not allowed ", () => { + agHelper.Sleep(2000); //for toasts to appear then wait for disappear agHelper.WaitUntilAllToastsDisappear(); DeleteBranchFromUI(0); cy.get(gitSyncLocators.closeBranchList).click({ force: true }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSObject/Bug9585_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSObject/Bug9585_spec.ts index cbe69128a4..7f80cb8a4b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSObject/Bug9585_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSObject/Bug9585_spec.ts @@ -15,10 +15,8 @@ describe("List no functions on empty collection", () => { } }`, { - paste: true, completeReplace: true, toRun: false, - shouldCreateNewJSObj: true, prettify: false, }, ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObjectMutation_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObjectMutation_spec.ts index 52b60ccbf0..09d555941f 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObjectMutation_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObjectMutation_spec.ts @@ -130,7 +130,7 @@ describe("JSObject testing", () => { _.jsEditor.RunJSObj(); _.entityExplorer.SelectEntityByName("Text2", "Widgets"); _.agHelper.AssertContains("id-1"); - cy.reload(); + _.agHelper.RefreshPage(); _.agHelper.AssertContains("Not Set"); _.entityExplorer.SelectEntityByName("JSObject1", "Queries/JS"); _.jsEditor.SelectFunctionDropdown("myFun2"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts new file mode 100644 index 0000000000..b6b95b9c37 --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts @@ -0,0 +1,386 @@ +import { + entityExplorer, + jsEditor, + agHelper, + locators, + propPane, + draggableWidgets, + deployMode, + debuggerHelper, + apiPage, + dataManager, +} from "../../../../support/Objects/ObjectsCore"; + +describe("Widget Property Setters - Part III - Tc #2409 - Validates SetOptions", () => { + before(() => { + entityExplorer.DragDropWidgetNVerify(draggableWidgets.INPUT_V2, 300); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.SELECT, 300, 200); + entityExplorer.SelectEntityByName("Input1"); + propPane.UpdatePropertyFieldValue("Default value", "{{Select1.options}}"); + }); + + it("1. Set Widget property to unaccepted values & verify debug error", () => { + //SetOptions to not acceptable value - Boolean + jsEditor.CreateJSObject( + `export default { + myFun1 () { + Select1.setOptions(false); + } + }`, + { + completeReplace: true, + }, + ); + jsEditor.RunJSObj(); + entityExplorer.SelectEntityByName("Page1"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.eq("false"); + }); + debuggerHelper.AssertDebugError( + "Default value is missing in options. Please update the value.", + "", + true, + false, + ); + + //SetOptions to not acceptable value - Numeric + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + myFun1 () { + Select1.setOptions(1234); + } + }`, + false, + ); + jsEditor.RunJSObj(); + entityExplorer.SelectEntityByName("Page1"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.eq("1234"); + }); + debuggerHelper.AssertDebugError( + "Default value is missing in options. Please update the value.", + "", + false, + false, + ); + + //SetOptions to not acceptable value - String + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + myFun1 () { + Select1.setOptions('fdfjhgf7'); + } + }`, + false, + ); + jsEditor.RunJSObj(); + entityExplorer.SelectEntityByName("Page1"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.eq("fdfjhgf7"); + }); + debuggerHelper.AssertDebugError( + "Default value is missing in options. Please update the value.", + "", + false, + false, + ); + + //SetOptions to not acceptable value - undefined + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + myFun1 () { + Select1.setOptions(undefined); + } + }`, + false, + ); + jsEditor.RunJSObj(); + entityExplorer.SelectEntityByName("Page1"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.eq("fdfjhgf7"); + }); + debuggerHelper.AssertDebugError( + "Default value is missing in options. Please update the value.", + "", + false, + false, + ); + + //SetOptions to not acceptable value - null + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + myFun1 () { + Select1.setOptions(null); + } + }`, + false, + ); + jsEditor.RunJSObj(); + entityExplorer.SelectEntityByName("Page1"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.be.empty; + }); + debuggerHelper.AssertDebugError( + "Default value is missing in options. Please update the value.", + "", + false, + false, + ); + + //unabel to set +ve value to setOptions: + // {{JSObject1.myFun1.data.map((item)=>{return{ + // label: item.name, + // value: item.email } })}} + // deployMode.DeployApp(); + }); + + it("2. Update 'setOptions' property By JS function & By action selector", () => { + entityExplorer.SelectEntityByName("Select1"); + propPane.EnterJSContext("Source Data", ""); // By JS function + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj(`export default { + myFun1 () { + Select1.setOptions([{label: 'monday', value: 'weekday'}]) + } + }`); + jsEditor.RunJSObj(); + entityExplorer.SelectEntityByName("Page1"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.include("monday").and.to.include("weekday"); + }); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300); + propPane.EnterJSContext("onClick", "{{JSObject1.myFun1()}}"); // By action selector + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj(`export default { + myFun1 () { + Select1.setOptions([{label: 'monday', value: 'weekday', code: '1'}]) + } + }`); + deployMode.DeployApp(); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.eq("[]"); + }); + agHelper.ClickButton("Submit"); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val) + .to.include("monday") + .and.to.include("weekday") + .and.to.include("1"); + }); + deployMode.NavigateBacktoEditor(); + }); + + it("3. Update 'setOptions' property - during onPage load", () => { + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EnableDisableAsyncFuncSettings("myFun1", true, false); //for on page load execution + deployMode.DeployApp(); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val) + .to.include("monday") + .and.to.include("weekday") + .and.to.include("1"); + }); + deployMode.NavigateBacktoEditor(); + }); + + it("4. Update 'setOptions' property - during onPage load - via Promise", () => { + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj(`export default { + myFun1 () { + return new Promise((resolve,reject)=>{ + Select1.setOptions([{label: 'monday', value: 'weekday'}]) + }) + } + }`); + deployMode.DeployApp(); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val) + .to.include("monday") + .and.to.include("weekday") + .and.not.to.include("1"); + }); + deployMode.NavigateBacktoEditor(); + }); + + it("5. Update 'setOptions' property - during onPage load - via CallBack", () => { + apiPage.CreateAndFillApi( + dataManager.dsValues[dataManager.defaultEnviorment].mockApiUrl, + ); + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj(`export default { + async myFunc1 () { + await Api1.run(() => {Select1.setOptions([ + { + "label": "Api callback", + "value": "Api callback" + } + ])}, () => {showAlert('unable to run API')}); + } + }`); + jsEditor.EnableDisableAsyncFuncSettings("myFunc1", true, false); //for on page load execution, since sync function is updated to async + deployMode.DeployApp(); + agHelper.Sleep(2000); //for call to finish for CI runs + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.include("Api callback"); + }); + deployMode.NavigateBacktoEditor(); + }); + + it("6. Update 'setOptions' property - during onPage load - via contcat", () => { + entityExplorer.SelectEntityByName("Select1"); + propPane.EnterJSContext( + "Source Data", + `[ + { + "name": "monday", + "code": "Weekday" + } + ]`, + ); // By JS function + entityExplorer.DragDropWidgetNVerify(draggableWidgets.SELECT, 300, 400); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.SELECT, 300, 500); + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj(`export default { + myFunc1 () { + Select3.setOptions(Select1.options.concat(Select2.options)); + } + }`); + jsEditor.EnableDisableAsyncFuncSettings("myFunc1", true, false); //for on page load execution, since sync function is updated to async + entityExplorer.SelectEntityByName("Input1"); + propPane.UpdatePropertyFieldValue("Default value", "{{Select3.options}}"); + deployMode.DeployApp(); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val) + .to.include("monday") + .and.to.include("Blue") + .and.to.include("Red") + .and.to.include("Green"); + }); + deployMode.NavigateBacktoEditor(); + }); + + it("7. Update 'setOptions' property - via SetTimeout framework function", () => { + entityExplorer.SelectEntityByName("Input1"); + propPane.UpdatePropertyFieldValue("Default value", "{{Select1.options}}"); + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj(`export default { + myFun1() { + let localValue = {"label": 'local label', "value": 'local value'}; + setTimeout(() => {Select1.setOptions(localValue)}, 1000); + } + }`); + jsEditor.EnableDisableAsyncFuncSettings("myFun1", false, false); //for on page load execution + deployMode.DeployApp(); + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.contain("monday"); + }); + agHelper.ClickButton("Submit"); + agHelper.Sleep(); //settimeout timer! + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).to.include("local label").and.to.include("local value"); + }); + deployMode.NavigateBacktoEditor(); + }); +}); diff --git a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts index b80a9f0ae6..b3510f1990 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts @@ -10,7 +10,7 @@ import { dataManager, } from "../../../../support/Objects/ObjectsCore"; -describe("Widget Property Setters - Part II", () => { +describe("Widget Property Setters - Part II - Tc #2409", () => { it("1. Bug 25287 - CurrencyInput does not update value when set using CurrencyInput.text", () => { entityExplorer.DragDropWidgetNVerify(draggableWidgets.CURRENCY_INPUT); entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 200); @@ -43,7 +43,7 @@ describe("Widget Property Setters - Part II", () => { ); }); - it("2. Update Visible property via JS function", () => { + it("2. Update Visible property via JS function - using appmsith store", () => { entityExplorer.SelectEntityByName("JSObject1"); jsEditor.EditJSObj( `export default { @@ -63,7 +63,7 @@ describe("Widget Property Setters - Part II", () => { ); }); - it("3. Update Input value via JS function", () => { + it("3. Update Input value via JS function - using async await - Api call", () => { apiPage.CreateAndFillApi( dataManager.dsValues[dataManager.defaultEnviorment].mockApiUrl, ); @@ -108,7 +108,7 @@ describe("Widget Property Setters - Part II", () => { }); }); - it("4. Update Input value via JS function run", () => { + it("4. Update Input value via JS Call back function - in Edit mode itself + OnPage load", () => { entityExplorer.SelectEntityByName("JSObject1"); jsEditor.EditJSObj( `export default { @@ -137,12 +137,106 @@ describe("Widget Property Setters - Part II", () => { .then((val) => { expect(val).contains("@"); }); - deployMode.DeployApp(); + + entityExplorer.SelectEntityByName("Input1"); + propPane.UpdatePropertyFieldValue( + "Default value", + "{{appsmith.user.name}}", + ); + deployMode.DeployApp(); //below validates the Page load + agHelper + .GetText( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + + " " + + locators._input, + "val", + ) + .then((val) => { + expect(val).not.be.empty; + }); }); - // it("5. Update Widget property value during OnPage load", () => { - // // - // }); + it("5. Update Widget property through framework function - Settimeout", () => { + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + async myFun1 () { + setTimeout(()=>{Button1.isVisible ?Button1.setVisibility(false):Button1.setVisibility(true)},2000) + } + }`, + false, + ); + jsEditor.EnableDisableAsyncFuncSettings("myFun1", true, false); + deployMode.DeployApp(); + agHelper.AssertElementVisibility( + locators._widgetInDeployed(draggableWidgets.BUTTON), //Asserting before setTimeout JS function execution, button is visible + ); + agHelper.Sleep(2000); //waiting for settimeout to execute + agHelper.AssertElementAbsence( + locators._widgetInDeployed(draggableWidgets.BUTTON), + ); + }); + + it("6. Verify SetWidget for unsupported properties - setPlaying(Audio widget) property for Button, set property via try/catch block", () => { + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + myFun1 () { + Button1.setPlaying(true); + }, + }`, + false, + ); + agHelper.AssertElementVisibility(locators._lintErrorElement); + agHelper.HoverElement(locators._lintErrorElement); + agHelper.AssertContains(`"setPlaying" doesn't exist in Button1`); + + //try catch block + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + myFun1 () { + try { + Api1.run().then(()=>{ Button1.setVisibility(false)}) + } + catch(e) + { showAlert(e.message) } + }, + }`, + false, + ); + deployMode.DeployApp(); + agHelper.AssertElementAbsence( + locators._widgetInDeployed(draggableWidgets.BUTTON), + ); + }); + + it("7.Update set property using mutative values", () => { + entityExplorer.SelectEntityByName("Button1"); + propPane.TogglePropertyState("Visible", "Off"); //due to bug, element state is not altereed when set via settimeout + propPane.TogglePropertyState("Visible", "On"); + entityExplorer.SelectEntityByName("JSObject1"); + jsEditor.EditJSObj( + `export default { + var1: [true,false,true,false], + async myFun1() { + for (let i =0; i<=this.var1.length;i++){ + Input1.setVisibility(this.var1[i]); + } + }, + }`, + false, + ); + jsEditor.EnableDisableAsyncFuncSettings("myFun1", false, false); + deployMode.DeployApp(); + agHelper.AssertElementVisibility( + locators._widgetInDeployed(draggableWidgets.INPUT_V2), //Asserting before setTimeout JS function execution, Input is visible + ); + agHelper.ClickButton("Submit"); + agHelper.AssertElementAbsence( + locators._widgetInDeployed(draggableWidgets.INPUT_V2), + ); + }); afterEach(() => { deployMode.NavigateBacktoEditor(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Form/FormWidget_Select_TreeSelect_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Form/FormWidget_Select_TreeSelect_spec.js index f0f9bb411d..251784a198 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Form/FormWidget_Select_TreeSelect_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Form/FormWidget_Select_TreeSelect_spec.js @@ -1,16 +1,21 @@ const widgetsPage = require("../../../../../locators/Widgets.json"); const formWidgetsPage = require("../../../../../locators/FormWidgets.json"); -import * as _ from "../../../../../support/Objects/ObjectsCore"; +import { agHelper } from "../../../../../support/Objects/ObjectsCore"; describe("Form Widget Functionality", function () { before(() => { - _.agHelper.AddDsl("formSelectTreeselectDsl"); + agHelper.AddDsl("formSelectTreeselectDsl"); }); + it("Validate Select and TreeSelect Widget", function () { cy.get(widgetsPage.formButtonWidget) .contains("Submit") .should("have.attr", "disabled"); - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(1000) //for dropdown to load for CI runs + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.treeSelectFilterInput).click().type("Blue"); cy.treeSelectDropdown("Blue"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Modal/Modal_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Modal/Modal_spec.ts index a426b2e37b..d6dd991ffb 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Modal/Modal_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Modal/Modal_spec.ts @@ -21,6 +21,7 @@ describe("Modal Widget test cases", function () { entityExplorer.DragDropWidgetNVerify(draggableWidgets.MODAL, 300, 300); entityExplorer.SelectEntityByName("Button1"); propPane.EnterJSContext("onClick", "{{showModal('Modal1');}}"); + agHelper.Sleep(); deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON)); agHelper.Sleep(2000); //Wait for widgets to settle @@ -48,9 +49,11 @@ describe("Modal Widget test cases", function () { entityExplorer.SelectEntityByName("Button1"); propPane.ToggleJSMode("onClick", false); propPane.CreateModal("onClick"); + agHelper.Sleep(500); propPane.CreateModal("onClick"); + agHelper.Sleep(500); deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON)); - + agHelper.Sleep(2000); //Wait for widgets to settle & be visible agHelper.ClickButton("Submit"); agHelper.AssertElementLength(locators._modal, 3); agHelper.AssertElementVisibility(locators._modal, true, 2); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/Multi_Select_Tree_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/Multi_Select_Tree_spec.js index 10f38d0322..da80af016d 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/Multi_Select_Tree_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/Multi_Select_Tree_spec.js @@ -24,7 +24,11 @@ describe("MultiSelectTree Widget Functionality", function () { // Check if isDirty is set to false cy.get(".t--widget-textwidget").should("contain", "false"); // Interact with UI - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); cy.treeMultiSelectDropdown("Red"); // Check if isDirty is set to true cy.get(".t--widget-textwidget").should("contain", "true"); @@ -42,7 +46,11 @@ describe("MultiSelectTree Widget Functionality", function () { .first() .should("have.text", "Red"); // Clear the selected value - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); cy.treeMultiSelectDropdown("Red"); }); @@ -51,8 +59,11 @@ describe("MultiSelectTree Widget Functionality", function () { // search for option Red in the search input cy.openPropertyPane("multiselecttreewidget"); cy.testJsontext("defaultselectedvalues", ""); - cy.wait(2000); - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(2000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.multiTreeSelectFilterInput) .click({ force: true }) .type("Green"); @@ -64,7 +75,11 @@ describe("MultiSelectTree Widget Functionality", function () { .first() .should("have.text", "Green"); // Reopen the multi-tree select widget - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); // Assert if the search input is empty now cy.get(formWidgetsPage.multiTreeSelectFilterInput) .invoke("val") @@ -74,7 +89,11 @@ describe("MultiSelectTree Widget Functionality", function () { }); it("4. To Validate Options", function () { - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.multiTreeSelectFilterInput).click().type("light"); cy.treeMultiSelectDropdown("Light Blue"); }); @@ -99,7 +118,11 @@ describe("MultiSelectTree Widget Functionality", function () { }); it("7. To Check Option Not Found", function () { - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.multiTreeSelectFilterInput).click().type("ABCD"); cy.get(".tree-multiselect-dropdown .rc-tree-select-empty").contains( "No Results Found", diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/RTL_support.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/RTL_support.ts index f24658a026..eaa7d7e1c2 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/RTL_support.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/RTL_support.ts @@ -15,15 +15,11 @@ describe("Select Widget", () => { featureFlagIntercept({ license_widget_rtl_support_enabled: false, }); - agHelper.AssertElementAbsence(".t--property-control-enablertl"); - featureFlagIntercept({ license_widget_rtl_support_enabled: true, }); - agHelper.RefreshPage(); - agHelper.Sleep(2000); agHelper.AssertElementExist(".t--property-control-enablertl"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/CategorySlider_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/CategorySlider_spec.ts index 1cbcf7b6fa..8654767e5b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/CategorySlider_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/CategorySlider_spec.ts @@ -169,8 +169,10 @@ describe("Category Slider spec", () => { agHelper.RemoveCharsNType(propPane._placeholderValue, -1, "xxl", 5); // Verify option added agHelper.AssertElementLength(propPane._placeholderName, len + 1); + agHelper.Sleep(); // Wait for the element to settle to delete it // Delete option - agHelper.GetNClick(propPane._optionsDeleteButton, 5); + agHelper.GetNClick(propPane._optionsDeleteButton, 5, true); + agHelper.Sleep(); // Wait for the element to be deleted // Verify option deleted agHelper.AssertElementLength(propPane._placeholderName, len); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/NumberSlider_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/NumberSlider_spec.ts index 19d23fd290..839872904e 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/NumberSlider_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Sliders/NumberSlider_spec.ts @@ -425,7 +425,7 @@ describe("Number Slider spec", () => { .type("{rightArrow}") .type("{upArrow}"); - agHelper.Sleep(200); + agHelper.Sleep(); agHelper .GetText(getWidgetSelector(draggableWidgets.TEXT)) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Edge_case_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Edge_case_spec.js index 0a00d6f9a1..40df5e635c 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Edge_case_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Edge_case_spec.js @@ -54,6 +54,7 @@ describe("Table widget v2 edge case scenario testing", function () { //Check the value present in the textfield which is selectedRowIndices is [] cy.get(`${widgetsPage.textWidget} .bp3-ui-text`).should("have.text", "[]"); + cy.wait(1000); //Select the 1st, 2nd and 3rd row table.SelectTableRow(0, 0, true, "v2"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Select_TreeSelect_MultiSelect_Empty_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Select_TreeSelect_MultiSelect_Empty_spec.ts index fd8d0223bb..e17ac3ac03 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Select_TreeSelect_MultiSelect_Empty_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Select_TreeSelect_MultiSelect_Empty_spec.ts @@ -5,13 +5,19 @@ describe("MultiSelect, Tree Select and Multi Tree Select Widget Empty Options Fu _.agHelper.AddDsl("SelectDslWithEmptyOptions"); }); it("1. To Check empty options for Multi Select Tree Widget", () => { - cy.get(formWidgetsPage.treeSelectInput).first().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .first() + .click({ force: true }) + .wait(500); cy.get(".rc-tree-select-empty").should("have.text", "No Results Found"); //To Check empty options for Single Select Tree Widget" - cy.get(formWidgetsPage.treeSelectInput) + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) .last() .click({ force: true }) + .wait(500) .get(".single-tree-select-dropdown .rc-tree-select-empty") .should("have.text", "No Results Found"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Single_Select_Tree_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Single_Select_Tree_spec.ts index bb9e523234..9c191593ae 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Single_Select_Tree_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Single_Select_Tree_spec.ts @@ -28,7 +28,11 @@ describe("Single Select Widget Functionality", function () { // Check if isDirty is reset to false cy.get(".t--widget-textwidget").should("contain", "false"); // Interact with UI - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(1000) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.treeSelectFilterInput).click().type("light"); cy.treeSelectDropdown("Light Blue"); // Check if isDirty is set to true @@ -50,14 +54,22 @@ describe("Single Select Widget Functionality", function () { }); it("3. To Validate Options", function () { - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.treeSelectFilterInput).click().type("light"); cy.treeSelectDropdown("Light Blue"); }); it("4. Clears the search field when widget is closed", () => { // Open the widget - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); // Search for Green option in the search input cy.get(formWidgetsPage.treeSelectFilterInput).click().type("Green"); // Select the Green Option @@ -68,7 +80,11 @@ describe("Single Select Widget Functionality", function () { .first() .should("have.text", "Green"); // Reopen the widget - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); // Assert the search input is cleared cy.get(formWidgetsPage.treeSelectFilterInput) .invoke("val") @@ -95,7 +111,11 @@ describe("Single Select Widget Functionality", function () { }); it("7. To Check Option Not Found", function () { - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); cy.get(formWidgetsPage.treeSelectFilterInput).click().type("ABCD"); cy.get(".tree-select-dropdown .rc-tree-select-empty").contains( "No Results Found", @@ -137,7 +157,11 @@ describe("Single Select Widget Functionality", function () { // Add a message to alert event in onOptionChange cy.testJsontext("onoptionchange", `{{showAlert('Option Changed')}}`); // Open the widget - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); // Search for Green option in the search input cy.get(formWidgetsPage.treeSelectFilterInput).click().type("Green"); // Select the Green Option @@ -147,7 +171,11 @@ describe("Single Select Widget Functionality", function () { // Validate the toast message cy.validateToastMessage("Option Changed"); // Open the widget - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); // Search for Green option (selecting same option) in the search input cy.get(formWidgetsPage.treeSelectFilterInput).click().type("Green"); // Select the Green Option diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Tree_Select_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Tree_Select_spec.ts index 0c42ff3e5a..21c9ff2cd0 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Tree_Select_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TreeSelect/Tree_Select_spec.ts @@ -32,7 +32,11 @@ describe("Tree Select Widget", function () { .invoke("val") .should("be.empty"); // click on the widget - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); // select Green option cy.treeSelectDropdown("Green"); // again click on cancel icon in the widget @@ -56,7 +60,11 @@ describe("Tree Select Widget", function () { .find(".rc-tree-select-clear") .should("not.exist"); // click on the widget again - cy.get(formWidgetsPage.treeSelectInput).last().click({ force: true }); + cy.wait(500) + .get(formWidgetsPage.treeSelectInput) + .last() + .click({ force: true }) + .wait(500); // select Green option cy.treeSelectDropdown("Green"); // assert if the widget input value is Green diff --git a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts index 3ae7028387..19be7a9fe3 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts @@ -407,6 +407,7 @@ describe("JS Function Execution", function () { assertAsyncFunctionsOrder(FUNCTIONS_SETTINGS_DEFAULT_DATA); agHelper.RefreshPage(); + agHelper.Sleep(2000); //for confirmatiom modal to appear before clicking on "Yes" button for CI runs // click "Yes" button for all onPageload && ConfirmExecute functions for (let i = 0; i <= onPageLoadAndConfirmExecuteFunctionsLength - 1; i++) { //agHelper.AssertElementPresence(jsEditor._dialog("Confirmation Dialog")); // Not working in edit mode diff --git a/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/Basic_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/Basic_Spec.ts index 50c690ea45..51bfcd829e 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/Basic_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/Basic_Spec.ts @@ -76,10 +76,11 @@ describe("MySQL Datatype tests", function () { }); i % 2 && agHelper.ToggleSwitch("Bool_column"); agHelper.ClickButton("insertRecord"); + agHelper.Sleep(2000); //for the modal to close after entering all values & value to reflect in table agHelper.AssertElementVisibility( locators._buttonByText("Run InsertQuery"), ); - agHelper.Sleep(2000); + agHelper.Sleep(3000); }); }); diff --git a/app/client/cypress/support/Objects/FeatureFlags.ts b/app/client/cypress/support/Objects/FeatureFlags.ts index 788bde5643..c002462a06 100644 --- a/app/client/cypress/support/Objects/FeatureFlags.ts +++ b/app/client/cypress/support/Objects/FeatureFlags.ts @@ -13,5 +13,6 @@ export const featureFlagIntercept = ( cy.intercept("GET", "/api/v1/users/features", response); if (reload) { cy.reload(); + cy.wait(2000); //for the page to re-load finish for CI runs } }; diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index 8d16cd8a08..55d904770f 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -1089,6 +1089,9 @@ export class AggregateHelper extends ReusableHelper { win.location.href = url; }); }); + this.AssertElementAbsence( + this.locator._specificToast("Cannot read properties of undefined"), + ); this.assertHelper.AssertDocumentReady(); this.Sleep(4000); //for page to load for CI runs networkCallAlias && diff --git a/app/client/cypress/support/Pages/EntityExplorer.ts b/app/client/cypress/support/Pages/EntityExplorer.ts index 0bca90e2b7..9bbdb6101c 100644 --- a/app/client/cypress/support/Pages/EntityExplorer.ts +++ b/app/client/cypress/support/Pages/EntityExplorer.ts @@ -455,9 +455,11 @@ export class EntityExplorer { action: "Edit name", }); else cy.xpath(this._entityNameInExplorer(entityName)).dblclick(); - cy.xpath(this.locator._entityNameEditing(entityName)).type( - renameVal + "{enter}", - ); + cy.xpath(this.locator._entityNameEditing(entityName)) + .type(renameVal) + .wait(500) + .type("{enter}") + .wait(300); this.AssertEntityPresenceInExplorer(renameVal); this.agHelper.Sleep(); //allowing time for name change to reflect in EntityExplorer } diff --git a/app/client/cypress/support/Pages/InviteModal.ts b/app/client/cypress/support/Pages/InviteModal.ts index ae2b92af7f..86ffa1fbc6 100644 --- a/app/client/cypress/support/Pages/InviteModal.ts +++ b/app/client/cypress/support/Pages/InviteModal.ts @@ -7,6 +7,7 @@ export class InviteModal { private embedSettings = ObjectsRegistry.EmbedSettings; private deployMode = ObjectsRegistry.DeployMode; private commonLocators = ObjectsRegistry.CommonLocators; + private assertHelper = ObjectsRegistry.AssertHelper; public locators = { _inviteTab: "[data-testid='t--tab-INVITE']", @@ -85,7 +86,11 @@ export class InviteModal { toggle, toggle == "On" ? false : true, ); - cy.get(this.locators._previewEmbed).invoke("removeAttr", "target").click(); + cy.get(this.locators._previewEmbed) + .invoke("removeAttr", "target") + .click() + .wait(2000); + this.assertHelper.AssertDocumentReady(); this.agHelper.Sleep(3000); //for page to load if (toggle == "On") { this.deployMode.NavigateBacktoEditor(); //Also verifies that navigation bar is present diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index bc63e1983a..1b1b785211 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -148,16 +148,16 @@ export class JSEditor { public CreateJSObject( JSCode: string, - options: ICreateJSObjectOptions = DEFAULT_CREATE_JS_OBJECT_OPTIONS, + options: Partial = {}, ) { const { completeReplace, - lineNumber = 4, + lineNumber, paste, - prettify = true, + prettify, shouldCreateNewJSObj, toRun, - } = options; + } = { ...DEFAULT_CREATE_JS_OBJECT_OPTIONS, ...options }; shouldCreateNewJSObj && this.NavigateToNewJSEditor(); if (!completeReplace) { diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index f0d4115f0d..31a9025ac2 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -1309,7 +1309,7 @@ Cypress.Commands.add("ValidatePaginateResponseUrlData", (runTestCss) => { cy.isSelectRow(0); cy.readTabledata("0", "5").then((tabData) => { const tableData = tabData; - expect(tableData).to.equal(valueToTest); + expect(valueToTest).contains(tableData); }); }); });