fix: cypress test added for onboarding start with data (#30720)

## Description

This PR adds cypress test for issue
https://github.com/appsmithorg/appsmith/issues/30620

#### PR fixes following issue(s)
Fixes #30554 
#### 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
- Chore (housekeeping or task changes that don't impact user perception)
>
>
>
## 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
- [x] 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**
- Added automated tests for the "Start with data" user flow in the
onboarding process.
- **New Features**
- Enhanced the UI interaction in the Data Sources page by introducing an
index-based element selection feature.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
This commit is contained in:
sneha122 2024-01-30 12:52:10 +05:30 committed by GitHub
parent 9af8095504
commit 4228173c98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,42 @@
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
agHelper,
onboarding,
dataSources,
homePage,
assertHelper,
} from "../../../../support/Objects/ObjectsCore";
describe(
"Start with data userflow",
{ tags: ["@tag.excludeForAirgap", "@tag.Datasource"] },
function () {
beforeEach(() => {
homePage.LogOutviaAPI();
featureFlagIntercept({
ab_show_templates_instead_of_blank_canvas_enabled: true,
ab_create_new_apps_enabled: true,
});
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
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 () {
agHelper.Sleep(1000);
dataSources.CreateDataSource("Postgres", false);
dataSources.selectTabOnDatasourcePage("View data");
agHelper.TypeText(dataSources._datasourceStructureSearchInput, "users");
agHelper.GetNClick(
dataSources._dsPageTabContainerTableName("public.users"),
);
assertHelper.AssertNetworkExecutionSuccess("@schemaPreview");
agHelper.AssertElementAbsence(
dataSources._dsPageTableTriggermenuTarget("public.users"),
);
});
},
);

View File

@ -430,9 +430,14 @@ export class DataSources {
}).as("testDatasource");
}
public CreatePlugIn(pluginName: string, waitForToastDisappear = false) {
public CreatePlugIn(
pluginName: string,
waitForToastDisappear = false,
index = 0,
) {
cy.get(this._createNewPlgin(pluginName))
.parent("div")
.eq(index)
.trigger("click", { force: true });
this.agHelper.Sleep();
//this.agHelper.WaitUntilEleAppear(this.locator._toastMsg);

View File

@ -18,6 +18,7 @@ export class Onboarding {
add_datasources: "#add_datasources",
connect_data_overlay: "#table-overlay-connectdata",
startFromScratchCard: "[data-testid='t--start-from-scratch']",
startFromDataCard: "[data-testid='t--start-from-data']",
seeMoreButtonOnCanvas: `[data-testid="t--canvas-building-block-see-more"]`,
};