diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bugs26410_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bugs26410_spec.ts new file mode 100644 index 0000000000..cb162ed15e --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Bugs26410_spec.ts @@ -0,0 +1,26 @@ +import { + dataSources, + entityExplorer, +} from "../../../../support/Objects/ObjectsCore"; + +describe("Fix UQI query switching", function () { + it("1. The command of the Mongo query must be preserved and should not default to initial value after changed.", function () { + dataSources.NavigateToDSCreateNew(); + dataSources.CreateDataSource("Mongo", false, false); + dataSources.CreateQueryAfterDSSaved("", "MongoQuery"); + dataSources.ValidateNSelectDropdown( + "Commands", + "Find document(s)", + "Insert document(s)", + ); + dataSources.NavigateToDSCreateNew(); + dataSources.CreateDataSource("Twilio", false, false); + dataSources.CreateQueryAfterDSSaved("", "TwilioQuery"); + dataSources.ValidateNSelectDropdown("Commands", "", "Schedule message"); + entityExplorer.SelectEntityByName("MongoQuery", "Queries/JS"); + dataSources.ValidateNSelectDropdown("Commands", "Insert document(s)"); + + entityExplorer.SelectEntityByName("TwilioQuery", "Queries/JS"); + dataSources.ValidateNSelectDropdown("Commands", "Schedule message"); + }); +}); diff --git a/app/client/cypress/support/Objects/DataManager.ts b/app/client/cypress/support/Objects/DataManager.ts index d6b1ec35a1..8ed441f038 100644 --- a/app/client/cypress/support/Objects/DataManager.ts +++ b/app/client/cypress/support/Objects/DataManager.ts @@ -95,6 +95,9 @@ export class DataManager { authenticatedApiUrl: "https://fakeapi.com", GraphqlApiUrl_TED: "http://host.docker.internal:5000/graphql", + + twilio_username: "random-username", + twilio_password: "random-password", }, Staging: { @@ -184,6 +187,9 @@ export class DataManager { authenticatedApiUrl: "https://fakeapi.com", GraphqlApiUrl_TED: "http://host.docker.internal:5000/graphql", + + twilio_username: "random-username", + twilio_password: "random-password", }, }; diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index ab98587dff..64144e355c 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -15,6 +15,7 @@ export const DataSourceKVP = { Redis: "Redis", Oracle: "Oracle", S3: "S3", + Twilio: "Twilio", }; //DataSources KeyValuePair export enum Widgets { @@ -732,6 +733,18 @@ export class DataSources { ); } + public fillTwilioDSForm(environment = this.dataManager.defaultEnviorment) { + this.ValidateNSelectDropdown("Authentication type", "", "Basic auth"); + this.agHelper.UpdateInputValue( + this._username, + this.dataManager.dsValues[environment].twilio_username.toString(), + ); + this.agHelper.UpdateInputValue( + this._password, + this.dataManager.dsValues[environment].twilio_password.toString(), + ); + } + public TestSaveDatasource(expectedRes = true, isForkModal = false) { this.TestDatasource(expectedRes); this.SaveDatasource(isForkModal); @@ -1201,7 +1214,8 @@ export class DataSources { | "Elasticsearch" | "Redis" | "Oracle" - | "S3", + | "S3" + | "Twilio", navigateToCreateNewDs = true, testNSave = true, environment = this.dataManager.defaultEnviorment, @@ -1250,6 +1264,7 @@ export class DataSources { else if (DataSourceKVP[dsType] == "Redis") this.FillRedisDSForm(environment); else if (DataSourceKVP[dsType] == "S3") this.FillS3DSForm(); + else if (DataSourceKVP[dsType] == "Twilio") this.fillTwilioDSForm(); if (testNSave) { this.TestSaveDatasource(); diff --git a/app/client/src/components/formControls/DropDownControl.tsx b/app/client/src/components/formControls/DropDownControl.tsx index 878433e544..21c583ffd5 100644 --- a/app/client/src/components/formControls/DropDownControl.tsx +++ b/app/client/src/components/formControls/DropDownControl.tsx @@ -200,7 +200,10 @@ function renderDropdown( } }); - if (selectedValue !== tempSelectedValues) { + // we also check if the selected options are present at all. + // this is because sometimes when a transition is happening the previous options become an empty array. + // before the new options are loaded. + if (selectedValue !== tempSelectedValues && selectedOptions.length > 0) { selectedValue = tempSelectedValues; props.input?.onChange(tempSelectedValues); }