chore: added new test cases for different plugins (#31068)

## Description
Added test cases for start with data flow by default. The test cases are
added for :
- `Postgres` : It should redirect to ds page with schema preview
- `Mysql` : It should redirect to ds page with schema preview
- `S3` : It should redirect to ds page with config and we can create
query on top of it
- `Airtable` : It should redirect to ds page with config and we can
create query on top of it
- `REST API` : It should redirect to action page and the action creation
is successful

#### PR fixes following issue(s)
Fixes #30806 
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### 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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Tests**
- Expanded and refined test descriptions and cases for the "Start with
data userflow," focusing on creating and saving data sources for
Postgres, MySql, S3, Airtable, and Rest API actions.

- **Refactor**
- Modified access level of a method in the `ApiPage` class to enhance
testability.

- **New Features**
- Introduced a new property in the `DataSources` class to improve data
handling capabilities.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Aman Agarwal 2024-02-13 17:19:13 +05:30 committed by GitHub
parent 33da769afb
commit 7ae87dc061
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 4 deletions

View File

@ -5,10 +5,11 @@ import {
dataSources,
homePage,
assertHelper,
apiPage,
} from "../../../../support/Objects/ObjectsCore";
describe(
"Start with data userflow",
"Start with data userflow : Create different datasources and save",
{ tags: ["@tag.excludeForAirgap", "@tag.Datasource"] },
function () {
beforeEach(() => {
@ -17,6 +18,7 @@ describe(
{
ab_show_templates_instead_of_blank_canvas_enabled: true,
ab_create_new_apps_enabled: true,
ab_start_with_data_default_enabled: true,
},
false,
);
@ -25,10 +27,9 @@ describe(
homePage.SignUp(`${uid}@appsmithtest.com`, uid as unknown as string);
onboarding.closeIntroModal();
});
agHelper.GetNClick(onboarding.locators.startFromDataCard);
});
it("1. onboarding flow - create datasource and save, it should take me to datasource page with view mode", function () {
it("1. Postgres : should take me to datasource page with view mode", function () {
assertHelper.AssertNetworkStatus("@getPlugins");
dataSources.CreateDataSource("Postgres", false);
dataSources.selectTabOnDatasourcePage("View data");
@ -41,5 +42,31 @@ describe(
dataSources._dsPageTableTriggermenuTarget("public.users"),
);
});
it("2. Mysql : should take me to datasource page with view mode", function () {
assertHelper.AssertNetworkStatus("@getPlugins");
dataSources.CreateDataSource("MySql", false);
dataSources.selectTabOnDatasourcePage("View data");
assertHelper.AssertNetworkExecutionSuccess("@schemaPreview");
agHelper.AssertElementExist(dataSources._dsSchemaTableResponse);
});
it("3. S3 : should take me to datasource page", function () {
assertHelper.AssertNetworkStatus("@getPlugins");
dataSources.CreateDataSource("S3", false);
dataSources.CreateQueryAfterDSSaved("", "S3Query");
});
it("4. Airtable : should take me to datasource page", function () {
assertHelper.AssertNetworkStatus("@getPlugins");
dataSources.CreateDataSource("Airtable", false, false);
dataSources.CreateQueryAfterDSSaved("", "AirtableQuery");
});
it("5. Rest API action : should take me to action page directly", function () {
assertHelper.AssertNetworkStatus("@getPlugins");
agHelper.GetNClick(apiPage._createapi, 0);
assertHelper.AssertNetworkStatus("@createNewApi", 201);
});
},
);

View File

@ -15,7 +15,7 @@ export class ApiPage {
// private datasources = ObjectsRegistry.DataSources;
private _createapi = ".t--createBlankApiCard";
_createapi = ".t--createBlankApiCard";
_resourceUrl = ".t--dataSourceField";
private _headerKey = (index: number) =>
".t--actionConfiguration\\.headers\\[" +

View File

@ -310,6 +310,7 @@ export class DataSources {
_dsStructurePreviewMode = ".datasourceStructure-datasource-view-mode";
private _dsSchemaEntityItem = ".t--entity-item";
private _entityTriggerElement = ".t--template-menu-trigger";
_dsSchemaTableResponse = ".t--table-response";
public AssertDSEditViewMode(mode: AppModes) {
if (mode == "Edit") this.agHelper.AssertElementAbsence(this._editButton);