From 03fbcdd21c4ee97d8c7dad91f559ae3f9bf12210 Mon Sep 17 00:00:00 2001 From: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Date: Thu, 20 Oct 2022 11:56:52 +0530 Subject: [PATCH] test: Script updates for flaky tests (#17603) * Skipping Bug16702 spec * Bug 16702 fix * timeout spec index update * Bug 16702 spec fix * Bug16702 fix * BUg16702 spec fix * Bug 16702 revert * fix template spec Co-authored-by: Parthvi Goswami --- .../ClientSideTests/BugTests/Bug16702_Spec.ts | 18 ++++++++++++------ .../Templates/ForkTemplateToGitConnectedApp.js | 3 ++- .../Fork_Template_Existing_app_spec.js | 4 ++-- .../Templates/Fork_Template_To_App_spec.js | 4 ++-- .../{timeout_spec.ts => SetTimeout_spec.ts} | 16 ++++++++++------ 5 files changed, 28 insertions(+), 17 deletions(-) rename app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/{timeout_spec.ts => SetTimeout_spec.ts} (92%) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts index 9e3d87615c..038551c5a0 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts @@ -9,7 +9,11 @@ const locator = ObjectsRegistry.CommonLocators, const GRAPHQL_LIMIT_QUERY = ` query { - launchesPast(limit: "__limit__", offset: "__offset__") { + launchesPast(limit: + "__limit__" + ,offset: + "__offset__" + ) { mission_name rocket { rocket_name @@ -44,10 +48,12 @@ describe("Binding Expressions should not be truncated in Url and path extraction // expect(Cypress.dom.isDetached($el)).to.false; // }) //.trigger("mouseover") - .click() + .dblclick() .type("{{JSObject1."); - agHelper.GetNClickByContains(locator._hints, "offsetValue"); - agHelper.Sleep(200); + agHelper.GetNAssertElementText(locator._hints, "offsetValue", "have.text", 1); + agHelper.Sleep(); + agHelper.TypeText(locator._codeMirrorTextArea, "offsetValue", 1); + agHelper.Sleep(2000); /* Start: Block of code to remove error of detached node of codemirror for cypress reference */ @@ -58,10 +64,10 @@ describe("Binding Expressions should not be truncated in Url and path extraction cy.get(".t--graphql-query-editor pre.CodeMirror-line span") .contains("__limit__") //.trigger("mouseover") - .click() + .dblclick() .type("{{JSObject1."); agHelper.GetNClickByContains(locator._hints, "limitValue"); - agHelper.Sleep(); + agHelper.Sleep(2000); //Commenting this since - many runs means - API response is 'You are doing too many launches' // apiPage.RunAPI(false, 20, { // expectedPath: "response.body.data.body.data.launchesPast[0].mission_name", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js index 59718911ec..35b49ba01e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js @@ -25,6 +25,7 @@ describe("Fork a template to the current app", () => { }); it("1.Bug #17002 Forking a template into an existing app which is connected to git makes the application go into a bad state ", function() { + cy.wait(5000); cy.get(template.startFromTemplateCard).click(); cy.wait("@fetchTemplate").should( "have.nested.property", @@ -52,7 +53,7 @@ describe("Fork a template to the current app", () => { cy.CreatePage(); cy.get(template.startFromTemplateCard).click(); - cy.wait(1000); + cy.wait(5000); cy.get(template.templateDialogBox).should("be.visible"); cy.xpath("//div[text()='Customer Support Dashboard']").click(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js index 8a260ade15..075e30866b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js @@ -5,7 +5,7 @@ const publish = require("../../../../locators/publishWidgetspage.json"); describe("Fork a template to the current app from new page popover", () => { it("1. Fork template from page section", () => { cy.AddPageFromTemplate(); - cy.wait(1000); + cy.wait(3000); cy.get(template.templateDialogBox).should("be.visible"); cy.wait(4000); cy.xpath( @@ -25,7 +25,7 @@ describe("Fork a template to the current app from new page popover", () => { it("2. Add selected page of template from page section", () => { cy.AddPageFromTemplate(); - cy.wait(1000); + cy.wait(3000); cy.get(template.templateDialogBox).should("be.visible"); cy.wait(4000); cy.xpath("//div[text()='Customer Support Dashboard']").click(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js index 06f565e627..5b2d20d204 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js @@ -10,7 +10,7 @@ describe("Fork a template to the current app", () => { "response.body.responseMeta.status", 200, ); - cy.wait(1000); + cy.wait(5000); cy.get(template.templateDialogBox).should("be.visible"); cy.xpath( "//div[text()='Customer Support Dashboard']/following-sibling::div//button[contains(@class, 'fork-button')]", @@ -46,7 +46,7 @@ describe("Fork a template to the current app", () => { "response.body.responseMeta.status", 200, ); - cy.wait(1000); + cy.wait(5000); cy.get(template.templateDialogBox).should("be.visible"); cy.xpath("//div[text()='Customer Support Dashboard']").click(); cy.wait("@getTemplatePages").should( diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/timeout_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts similarity index 92% rename from app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/timeout_spec.ts rename to app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts index f6bd939da6..002a4a22d8 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/timeout_spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts @@ -6,7 +6,7 @@ const apiPage = ObjectsRegistry.ApiPage; const deployMode = ObjectsRegistry.DeployMode; describe("Tests setTimeout API", function() { - it("Executes showAlert after 3 seconds and uses default value", () => { + it("1. Executes showAlert after 3 seconds and uses default value", () => { jsEditor.CreateJSObject( `export default { myVar1: [], @@ -30,7 +30,8 @@ describe("Tests setTimeout API", function() { agHelper.Sleep(3000); agHelper.AssertContains("Hello world - default", "exist"); }); - it("Executes all three alerts in parallel after 3 seconds", () => { + + it("2. Executes all three alerts in parallel after 3 seconds", () => { jsEditor.CreateJSObject( `export default { myVar1: [], @@ -62,7 +63,8 @@ describe("Tests setTimeout API", function() { agHelper.AssertContains("Hello world - 2", "exist"); agHelper.AssertContains("Hello world - 3", "exist"); }); - it("Resolves promise after 3 seconds and shows alert", () => { + + it("3. Resolves promise after 3 seconds and shows alert", () => { jsEditor.CreateJSObject( `export default { myVar1: [], @@ -121,7 +123,7 @@ describe("Tests setTimeout API", function() { agHelper.GetNAssertContains(locators._debuggerLogMessage, "Working!"); }); - it("Resolves promise after 3 seconds and shows alert", () => { + it("4. Resolves promise after 3 seconds and shows alert", () => { jsEditor.CreateJSObject( `export default { myVar1: [], @@ -145,7 +147,8 @@ describe("Tests setTimeout API", function() { agHelper.Sleep(3000); agHelper.AssertContains("resolved"); }); - it("Access to args passed into success/error callback functions in API.run when using setTimeout", () => { + + it("5. Access to args passed into success/error callback functions in API.run when using setTimeout", () => { apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users"); jsEditor.CreateJSObject( `export default { @@ -187,7 +190,8 @@ describe("Tests setTimeout API", function() { agHelper.Sleep(3000); agHelper.AssertContains("Barty Crouch"); }); - it("Verifies whether setTimeout executes on page load", () => { + + it("6. Verifies whether setTimeout executes on page load", () => { apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users"); jsEditor.CreateJSObject( `export default {