From 353e007e781df8aa109803b3a96592352f07892c Mon Sep 17 00:00:00 2001 From: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Date: Tue, 6 Sep 2022 08:59:39 +0530 Subject: [PATCH] test: Script updates for flaky tests (#16533) * Autosave trial fix * json form field flaky fix * js fun exe spec flaky fix --- .../Widgets/JSONForm/JSONForm_FieldChange_spec.js | 1 + .../ClientSideTests/Widgets/List/List1_spec.js | 1 + .../ServerSideTests/GenerateCRUD/MySQL2_Spec.ts | 1 + .../JsFunctionExecution/JSFunctionExecution_spec.ts | 6 +++--- app/client/cypress/support/Pages/JSEditor.ts | 4 ++-- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js index 666448dfab..ae496c4a30 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js @@ -173,6 +173,7 @@ describe("JSON Form Widget Field Change", () => { cy.openFieldConfiguration("hobbies"); cy.selectDropdownValue(commonlocators.jsonFormFieldType, "Array"); + cy.wait(2000); //for array field to reflect cy.get(`${fieldPrefix}-hobbies`).then((hobbies) => { cy.wrap(hobbies) .find(".t--jsonformfield-array-add-btn") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js index 50032dcb2b..5d8d1480e9 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js @@ -115,6 +115,7 @@ describe("Binding the list widget with text widget", function() { "response.body.responseMeta.status", 200, ); + cy.reload(); cy.wait(2000); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts index 242340565f..b68b47dadb 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts @@ -331,6 +331,7 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => { //Delete the test data ee.ActionContextMenuByEntityName("Stores", "Delete", "Are you sure?"); agHelper.ValidateNetworkStatus("@deletePage", 200); + agHelper.RefreshPage(); }); it("12. Validate Drop of the Newly Created - Stores - Table from MySQL datasource", () => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts index 108fa8e1f2..b8e6726c84 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts @@ -245,7 +245,7 @@ describe("JS Function Execution", function() { ); // Fix parse error and assert that debugger error is removed - jsEditor.EditJSObj(JS_OBJECT_WITHOUT_PARSE_ERROR, true); + jsEditor.EditJSObj(JS_OBJECT_WITHOUT_PARSE_ERROR, true, false); agHelper.GetNClick(jsEditor._runButton); agHelper.AssertContains("ran successfully"); //to not hinder with next toast msg in next case! jsEditor.AssertParseError(false, true); @@ -258,13 +258,13 @@ describe("JS Function Execution", function() { // Switch back to response tab agHelper.GetNClick(locator._responseTab); // Re-introduce parse errors - jsEditor.EditJSObj(JS_OBJECT_WITH_PARSE_ERROR + "}}", false); + jsEditor.EditJSObj(JS_OBJECT_WITH_PARSE_ERROR + "}}", false, false); agHelper.GetNClick(jsEditor._runButton); // Assert that there is a function execution parse error jsEditor.AssertParseError(true, true); // Delete function - jsEditor.EditJSObj(JS_OBJECT_WITH_DELETED_FUNCTION, true); + jsEditor.EditJSObj(JS_OBJECT_WITH_DELETED_FUNCTION, true, false); // Assert that parse error is removed from debugger when function is deleted agHelper.GetNClick(locator._errorTab); agHelper.AssertContains( diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index d8cbc5b8ff..259c549505 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -190,7 +190,7 @@ export class JSEditor { } //Edit the name of a JSObject's property (variable or function) - public EditJSObj(newContent: string, toPrettify = true) { + public EditJSObj(newContent: string, toPrettify = true, toVerifyAutoSave = true) { cy.get(this.locator._codeMirrorTextArea) .first() .focus() @@ -200,7 +200,7 @@ export class JSEditor { }); this.agHelper.Sleep(2000); //Settling time for edited js code toPrettify && this.agHelper.ActionContextMenuWithInPane("Prettify Code"); - this.agHelper.AssertAutoSave(); + toVerifyAutoSave && this.agHelper.AssertAutoSave(); } public DisableJSContext(endp: string) {