From e6793a7bbbd809e32e224a0b05f16d4239b731c5 Mon Sep 17 00:00:00 2001 From: Keyur Paralkar Date: Wed, 23 Aug 2023 23:25:56 +0530 Subject: [PATCH] test: creates data source from ted server instead of mock db (#26585) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This PR fixes the the `server_side_filtering_spec_1.ts` that was failing on the air gapped instance. It creates the DS from the ted server instead of mock DB. Reason for this change: Mock DBs are not available in air gapped instances. #### PR fixes following issue(s) Fixes # (issue number) #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --- .../TableV2/server_side_filtering_spec_1.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/server_side_filtering_spec_1.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/server_side_filtering_spec_1.ts index a281060b6a..8c2addab72 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/server_side_filtering_spec_1.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/server_side_filtering_spec_1.ts @@ -33,7 +33,9 @@ describe("Table widget v2: test server side filtering", function () { oneClickBindingLocator.otherActionSelector("Connect new datasource"), ); - dataSources.CreateMockDB("Users").then(($createdMockUsers) => { + dataSources.CreateDataSource("MySql"); + + cy.get("@dsName").then(($dsName) => { dataSources.CreateQueryAfterDSSaved(); cy.wait(500); @@ -42,14 +44,14 @@ describe("Table widget v2: test server side filtering", function () { expandLoadMoreOptions(); agHelper.GetNClick( - oneClickBindingLocator.datasourceSelector($createdMockUsers), + oneClickBindingLocator.datasourceSelector($dsName as unknown as string), ); agHelper.Sleep(3000); //for tables to populate for CI runs agHelper.GetNClick(oneClickBindingLocator.tableOrSpreadsheetDropdown); agHelper.GetNClick( - oneClickBindingLocator.tableOrSpreadsheetDropdownOption("public.users"), + oneClickBindingLocator.tableOrSpreadsheetDropdownOption("employees"), ); agHelper.GetNClick(oneClickBindingLocator.connectData); @@ -69,7 +71,7 @@ describe("Table widget v2: test server side filtering", function () { // set execute select SQL query action on table filter update: propPane.SelectPlatformFunction("onTableFilterUpdate", "Execute a query"); - agHelper.GetNClickByContains(".single-select", "Select_public_users1"); + agHelper.GetNClickByContains(".single-select", "Select_employees1"); agHelper.GetNClick(propPane._actionAddCallback("success")); agHelper.GetNClick(locators._dropDownValue("Show alert")); agHelper.EnterActionValue("Message", ALERT_SUCCESS_MSG); @@ -79,7 +81,7 @@ describe("Table widget v2: test server side filtering", function () { table.ReadTableRowColumnData(0, 0, "v2").then(($cellData) => { expect(Number($cellData)).to.greaterThan(-1); }); - table.OpenNFilterTable("id", "greater than", "10"); + table.OpenNFilterTable("employeeNumber", "greater than", "1000"); agHelper.WaitUntilToastDisappear(ALERT_SUCCESS_MSG); table.CloseFilter(); table.ReadTableRowColumnData(0, 0, "v2").then(($cellData) => { @@ -101,12 +103,12 @@ describe("Table widget v2: test server side filtering", function () { it("4. should test that data is filtered client-side when serverside filtering is turned off", () => { propPane.TogglePropertyState("serversidefiltering", "Off"); - table.OpenNFilterTable("id", "is equal to", "4"); + table.OpenNFilterTable("employeeNumber", "is equal to", "1002"); table.CloseFilter(); // check first row table.ReadTableRowColumnData(0, 0, "v2").then(($cellData) => { - expect($cellData).to.eq("4"); + expect($cellData).to.eq("1002"); }); }); });