fix: Fix issue with navigation for uqi form queries (#26411)

When you have two UQI plugin queries for example Twilio and MongoDB.
Navigation between these two queries resets the Mongo
actionConfiguration command state. This PR fixes that.


Fixes #26410 


- Bug fix (non-breaking change which fixes an issue)

## 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
- [x] Manual
- [ ] 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-)
- [x] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] 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
This commit is contained in:
Ayangade Adeoluwa 2023-08-22 18:22:36 +01:00 committed by GitHub
parent bec8337af9
commit eb90e25530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 2 deletions

View File

@ -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");
});
});

View File

@ -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",
},
};

View File

@ -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();

View File

@ -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);
}