From 863c36ce7cd58dea25bbae71238e5980f6ead3df Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Wed, 28 Aug 2024 17:47:44 +0530 Subject: [PATCH 1/4] fix: API multipart spec flakiness (#35927) --- .../ServerSide/ApiTests/API_MultiPart_Spec.ts | 47 +++---------------- .../cypress/support/Objects/DataManager.ts | 4 ++ app/client/cypress/support/Pages/ApiPage.ts | 2 +- 3 files changed, 12 insertions(+), 41 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts index ec7e2ab5801..e2007f6b0c9 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts @@ -2,6 +2,7 @@ import { agHelper, apiPage, assertHelper, + dataManager, deployMode, entityItems, jsEditor, @@ -128,8 +129,8 @@ describe( agHelper.AddDsl("multiPartFormDataDsl"); apiPage.CreateAndFillApi( - "https://api.cloudinary.com/v1_1/appsmithautomationcloud/image/upload?upload_preset=fbbhg4xu", - "CloudinaryUploadApi", + dataManager.dsValues[dataManager.defaultEnviorment].multipartAPI, + "MultipartAPI", 30000, "POST", ); @@ -145,7 +146,7 @@ describe( myVar1: [], myVar2: {}, upload: async () => { - await CloudinaryUploadApi.run().then(()=> showAlert('Image uploaded to Cloudinary successfully', 'success')).catch(err => showAlert(err.message, 'error')); + await MultipartAPI.run().then(()=> showAlert('Image uploaded to multipart successfully', 'success')).catch(err => showAlert(err.message, 'error')); await resetWidget('FilePicker1', true); } }`, @@ -161,15 +162,9 @@ describe( propPane.EnterJSContext("onFilesSelected", `{{JSObject1.upload()}}`); EditorNavigation.SelectEntityByName("Image1", EntityType.Widget); - propPane.UpdatePropertyFieldValue( - "Image", - "{{CloudinaryUploadApi.data.url}}", - ); + propPane.UpdatePropertyFieldValue("Image", "{{MultipartAPI.data.url}}"); - EditorNavigation.SelectEntityByName( - "CloudinaryUploadApi", - EntityType.Api, - ); + EditorNavigation.SelectEntityByName("MultipartAPI", EntityType.Api); apiPage.ToggleOnPageLoadRun(false); //Bug 12476 EditorNavigation.SelectEntityByName("Page1", EntityType.Page); @@ -177,9 +172,7 @@ describe( agHelper.ClickButton("Select Files"); agHelper.UploadFile(imageNameToUpload); assertHelper.AssertNetworkExecutionSuccess("@postExecute"); //validating Cloudinary api call - agHelper.ValidateToastMessage( - "Image uploaded to Cloudinary successfully", - ); + agHelper.ValidateToastMessage("Image uploaded to multipart successfully"); agHelper.Sleep(); cy.xpath(apiPage._imageSrc) .find("img") @@ -192,31 +185,5 @@ describe( agHelper.AssertElementVisibility(locators._buttonByText("Select Files")); //verifying if reset! deployMode.NavigateBacktoEditor(); }); - - it("8. Checks MultiPart form data for a Array Type upload results in API error", () => { - const imageNameToUpload = "AAAFlowerVase.jpeg"; - EditorNavigation.SelectEntityByName( - "CloudinaryUploadApi", - EntityType.Api, - ); - apiPage.EnterBodyFormData( - "MULTIPART_FORM_DATA", - "file", - "{{FilePicker1.files[0]}}", - "Array", - true, - ); - EditorNavigation.SelectEntityByName("FilePicker1", EntityType.Widget); - agHelper.ClickButton("Select Files"); - agHelper.UploadFile(imageNameToUpload); - assertHelper.AssertNetworkExecutionSuccess("@postExecute", false); - - deployMode.DeployApp(locators._buttonByText("Select Files")); - agHelper.ClickButton("Select Files"); - agHelper.UploadFile(imageNameToUpload); - assertHelper.AssertNetworkExecutionSuccess("@postExecute", false); - agHelper.ValidateToastMessage("CloudinaryUploadApi failed to execute"); - agHelper.AssertElementVisibility(locators._buttonByText("Select Files")); //verifying if reset in case of failure! - }); }, ); diff --git a/app/client/cypress/support/Objects/DataManager.ts b/app/client/cypress/support/Objects/DataManager.ts index 515b3f05032..a54e1162eb3 100644 --- a/app/client/cypress/support/Objects/DataManager.ts +++ b/app/client/cypress/support/Objects/DataManager.ts @@ -80,6 +80,8 @@ export class DataManager { "http://host.docker.internal:5001/v1/mock-api-object?records=10", echoApiUrl: "http://host.docker.internal:5001/v1/mock-api/echo", randomCatfactUrl: "http://host.docker.internal:5001/v1/catfact/random", + multipartAPI: + "http://host.docker.internal:5001/v1/mock-api/echo-multipart", randomTrumpApi: "http://host.docker.internal:5001/v1/whatdoestrumpthink/random", mockHttpCodeUrl: "http://host.docker.internal:5001/v1/mock-http-codes/", @@ -179,6 +181,8 @@ export class DataManager { mockApiUrl: "http://host.docker.internal:5001/v1/mock-api?records=10", echoApiUrl: "http://host.docker.internal:5001/v1/mock-api/echo", randomCatfactUrl: "http://host.docker.internal:5001/v1/catfact/random", + multipartAPI: + "http://host.docker.internal:5001/v1/mock-api/echo-multipart", mockHttpCodeUrl: "http://host.docker.internal:5001/v1/mock-http-codes/", AirtableBaseForME: "appubHrVbovcudwN6", AirtableTableForME: "tblsFCQSskVFf7xNd", diff --git a/app/client/cypress/support/Pages/ApiPage.ts b/app/client/cypress/support/Pages/ApiPage.ts index 793a6d03c10..8804ae793dd 100644 --- a/app/client/cypress/support/Pages/ApiPage.ts +++ b/app/client/cypress/support/Pages/ApiPage.ts @@ -303,7 +303,7 @@ export class ApiPage { | "RAW", ) { this.agHelper.GetNClick(this._bodyTypeSelect); - cy.xpath(this._bodyTypeToSelect(subTabName)).should("be.visible").click(); + this.agHelper.GetNClick(this._bodyTypeToSelect(subTabName)); } AssertRightPaneSelectedTab(tabName: RightPaneTabs) { From 1968ec70a31a926171519b2aa53e4bb6bbbbcad5 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Wed, 28 Aug 2024 19:16:12 +0530 Subject: [PATCH 2/4] fix: mysql2 spec flakiness (#35950) --- .../ServerSide/GenerateCRUD/MySQL2_Spec.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts index aee98caa858..3271e32094d 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts @@ -82,10 +82,11 @@ describe( dataSources.RunQueryNVerifyResponseViews(10); dataSources.AssertQueryTableResponse(5, "2112"); dataSources.AssertQueryTableResponse(6, "Mike's Liquors"); - agHelper.ActionContextMenuWithInPane({ - action: "Delete", - entityType: entityItems.Query, - }); + // Commenting this deletion of query to make the generate crud work on the new page instead of the current page + // agHelper.ActionContextMenuWithInPane({ + // action: "Delete", + // entityType: entityItems.Query, + // }); }); it("3. Verify Generate CRUD for the new table & Verify Deploy mode for table - Stores", () => { @@ -129,13 +130,13 @@ describe( updateNVerify(6, 4, newStoreSecret as string); }); - table.SelectTableRow(17, 0, true, "v2"); - dataSources.AssertJSONFormHeader(17, 0, "store_id"); - generateStoresSecretInfo(17); + table.SelectTableRow(12, 0, true, "v2"); + dataSources.AssertJSONFormHeader(12, 0, "store_id"); + generateStoresSecretInfo(12); cy.get("@secretInfo").then(($secretInfo) => { newStoreSecret = $secretInfo; cy.log("newStoreSecret is : " + newStoreSecret); - updateNVerify(17, 4, newStoreSecret as string); + updateNVerify(12, 4, newStoreSecret as string); }); //Hidden field bug - to add here aft secret codes are updated for some fields! From b21124679a1d5eb444944ec90d49ea77861a9da6 Mon Sep 17 00:00:00 2001 From: Rahul Barwal Date: Thu, 29 Aug 2024 10:08:45 +0530 Subject: [PATCH 3/4] test: fix flaky binary spec (#35861) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description EE PR: https://github.com/appsmithorg/appsmith-ee/pull/4954 This spec relied on retries and was asserting on wrong table cols Fixes #35877 _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 93d0502c49b6e6b714236b8ea693f5ade0eacdb5 > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Wed, 28 Aug 2024 10:48:41 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **Bug Fixes** - Removed a previously skipped test for inserting binary type records to ensure accurate functionality checks. - **Refactor** - Improved readability and maintainability of test cases by replacing hardcoded row indices with dynamic variables. - Cleaned up the test suite by removing commented-out code and adjusting sleep durations. - **Documentation** - Updated assertions to reflect changes in expected values and the sequence of operations in the tests. --- .../Postgres_DataTypes/Binary_Spec.ts | 98 ++++++------------- 1 file changed, 28 insertions(+), 70 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ServerSide/Postgres_DataTypes/Binary_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/Postgres_DataTypes/Binary_Spec.ts index bd1f3d80f40..bb8ad38cb77 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/Postgres_DataTypes/Binary_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/Postgres_DataTypes/Binary_Spec.ts @@ -8,7 +8,6 @@ import { locators, table, } from "../../../../support/Objects/ObjectsCore"; -import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags"; import EditorNavigation, { AppSidebar, AppSidebarButton, @@ -76,38 +75,7 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { table.WaitForTableEmpty(); //asserting table is empty before inserting! }); - //Timing out a lot in CI, hence skipped, Insert verified also in next case - // it.skip("3. Inserting record - binarytype", () => { - // imageNameToUpload = "Datatypes/Bridge.jpg"; - // // entityExplorer.SelectEntityByName("Page1"); - // // deployMode.DeployApp(); - // // table.WaitForTableEmpty(); //asserting table is empty before inserting! - // agHelper.ClickButton("Run InsertQuery"); - // agHelper.AssertElementVisibility(locators._modal); - - // agHelper.ClickButton("Select New Image"); - // agHelper.UploadFile(imageNameToUpload); - - // agHelper.ClickButton("Insert"); - // agHelper.AssertElementAbsence(locators._toastMsg); //Assert that Insert did not fail - // agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery")); - // agHelper.AssertElementAbsence(locators._btnSpinner, 10000); //for the update row to appear at last - // table.WaitUntilTableLoad(); - // agHelper.Sleep(3000); //some more time for all rows with images to be populated - // table.ReadTableRowColumnData(0, 0).then(($cellData) => { - // expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence - // }); - // table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { - // expect($cellData).to.eq("Bridge.jpg"); - // }); - // table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => { - // table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => { - // expect($oldimage).to.eq($newimage); - // }); - // }); - // }); - - it("4. Inserting another record - binarytype", () => { + it("3. Inserting another record - binarytype", () => { imageNameToUpload = "Datatypes/Georgia.jpeg"; agHelper.ClickButton("Run InsertQuery"); @@ -121,21 +89,21 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery")); agHelper.AssertElementAbsence(locators._btnSpinner, 20000); //for the update row to appear at last table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //some more time for all rows with images to be populated - table.ReadTableRowColumnData(1, 0).then(($cellData) => { - expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence + const rowIndex = 0; + table.ReadTableRowColumnData(rowIndex, 0).then(($cellData) => { + expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { + table.ReadTableRowColumnData(rowIndex, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Georgia.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(1, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(1, 3).then(($newimage) => { + table.AssertTableRowImageColumnIsLoaded(rowIndex, 2).then(($oldimage) => { + table.AssertTableRowImageColumnIsLoaded(rowIndex, 3).then(($newimage) => { expect($oldimage).to.eq($newimage); }); }); }); - it("5. Inserting another record - binarytype", () => { + it("4. Inserting another record - binarytype", () => { imageNameToUpload = "Datatypes/Maine.jpeg"; agHelper.ClickButton("Run InsertQuery"); @@ -149,21 +117,21 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery")); agHelper.AssertElementAbsence(locators._btnSpinner, 20000); //for the update row to appear at last table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //some more time for all rows with images to be populated - table.ReadTableRowColumnData(2, 0).then(($cellData) => { - expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence + const rowIndex = 1; + table.ReadTableRowColumnData(rowIndex, 0).then(($cellData) => { + expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + table.ReadTableRowColumnData(rowIndex, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Maine.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(2, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(2, 3).then(($newimage) => { + table.AssertTableRowImageColumnIsLoaded(rowIndex, 2).then(($oldimage) => { + table.AssertTableRowImageColumnIsLoaded(rowIndex, 3).then(($newimage) => { expect($oldimage).to.eq($newimage); }); }); }); - it("6. Updating record - binarytype", () => { + it("5. Updating record - binarytype", () => { imageNameToUpload = "Datatypes/NewJersey.jpeg"; table.SelectTableRow(1); @@ -178,45 +146,38 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { agHelper.AssertElementVisibility(locators._buttonByText("Run UpdateQuery")); agHelper.AssertElementAbsence(locators._btnSpinner, 20000); //for the update row to appear at last table.WaitUntilTableLoad(); - agHelper.Sleep(14000); //some more time for rows to rearrange! - table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { + const rowIndex = 1; + table.ReadTableRowColumnData(rowIndex, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + table.ReadTableRowColumnData(rowIndex, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("NewJersey.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(2, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(2, 3).then(($newimage) => { + table.AssertTableRowImageColumnIsLoaded(rowIndex, 2).then(($oldimage) => { + table.AssertTableRowImageColumnIsLoaded(rowIndex, 3).then(($newimage) => { expect($oldimage).to.not.eq($newimage); }); }); }); - it("7. Deleting records - binarytype", () => { - //entityExplorer.SelectEntityByName("Page1");//commenting 2 lines since case 6th is skipped! - //deployMode.DeployApp(); + it("6. Deleting records - binarytype", () => { table.WaitUntilTableLoad(); table.SelectTableRow(1); agHelper.ClickButton("DeleteQuery", 1); assertHelper.AssertNetworkStatus("@postExecute", 200); assertHelper.AssertNetworkStatus("@postExecute", 200); - agHelper.AssertElementAbsence(locators._btnSpinner, 20000); //Allowing time for delete to be success - agHelper.Sleep(6000); //Allwowing time for delete to be success - table.ReadTableRowColumnData(1, 0).then(($cellData) => { - expect($cellData).not.to.eq("3"); //asserting 2nd record is deleted - }); - table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { - expect($cellData).to.eq("2"); + agHelper.WaitUntilEleDisappear(locators._btnSpinner); //Allowing time for delete to be success + table.ReadTableRowColumnData(0, 0).then(($cellData) => { + expect($cellData).to.eq("1"); }); //Deleting all records from .table agHelper.GetNClick(locators._deleteIcon); agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery")); - agHelper.Sleep(2000); table.WaitForTableEmpty(); }); - it("8. Inserting another record (to check serial column) - binarytype", () => { + it("7. Inserting another record (to check serial column) - binarytype", () => { imageNameToUpload = "Datatypes/Massachusetts.jpeg"; agHelper.ClickButton("Run InsertQuery"); @@ -230,9 +191,8 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { agHelper.AssertElementAbsence(locators._toastMsg); //Assert that Insert did not fail agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery")); table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //for all rows with images to be populated table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { - expect($cellData).to.eq("4"); //asserting serial column is inserting fine in sequence + expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence }); table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Massachusetts.jpeg"); @@ -244,7 +204,7 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { }); }); - it("9. Validating Binary (bytea) - escape, hex, base64 functions", () => { + it("8. Validating Binary (bytea) - escape, hex, base64 functions", () => { deployMode.NavigateBacktoEditor(); table.WaitUntilTableLoad(); PageLeftPane.switchSegment(PagePaneSegment.Queries); @@ -291,7 +251,7 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { }); }); - it("10. Validating Binary (bytea) - escape, hex, base64 functions, conts", () => { + it("9. Validating Binary (bytea) - escape, hex, base64 functions, conts", () => { //Validating backslash query = `select encode('\\\\'::bytea, 'escape') as "backslash Escape1", encode('\\134'::bytea, 'escape') as "backslash Escape2", encode('\\\\'::bytea, 'hex') as "backslash Hex1", encode('\\134'::bytea, 'hex') as "backslash Hex2", encode('\\\\'::bytea, 'base64') as "backslash Base64";`; dataSources.EnterQuery(query); @@ -375,8 +335,6 @@ describe("Binary Datatype tests", { tags: ["@tag.Datasource"] }, function () { }); AppSidebar.navigate(AppSidebarButton.Editor); }); - - //Since query delete & Postgress DS delete is covered in other specs, commenting below code // after( // "Validate Drop of the Newly Created - binarytype - Table & Verify Deletion of all created queries", // () => { From ffdcaedcf13094c2df959063f5e38b602f189c98 Mon Sep 17 00:00:00 2001 From: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:55:33 +0530 Subject: [PATCH 4/4] test: updated tests for checkboxgroup (#35945) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RCA: Test was failing after removing retry, the issue was it was clicking on a checkbox which was not required. the retry actually was bringing back the system to right state by clicking again. Solution: We removed the step that was unnecessary in this case which resolved the issue EE: https://github.com/appsmithorg/appsmith-ee/pull/4992 /ok-to-test tags="@tag.Sanity" > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: e599c6d0149814c38049aaba7828465361d8f43b > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Thu, 29 Aug 2024 14:33:59 UTC --------- Co-authored-by: karthik --- .../ClientSide/Widgets/Checkbox/CheckboxGroup2_spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Checkbox/CheckboxGroup2_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Checkbox/CheckboxGroup2_spec.js index cbdab81e2ce..10c00970efb 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Checkbox/CheckboxGroup2_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Checkbox/CheckboxGroup2_spec.js @@ -77,8 +77,6 @@ describe( it("3. handleSelectAllChange: unchecked", function () { const selectAllSelector = formWidgetsPage.selectAllCheckboxControl; const uncheckedOptionInputs = `${formWidgetsPage.checkboxGroupOptionInputs} input:not(:checked)`; - // Deselect all - cy.get(selectAllSelector).click(); // Should get 2 unchecked option inputs cy.get(uncheckedOptionInputs).should("have.length", 2); //handleSelectAllChange: checked", function () {