From 4228173c989a597b858d71a380275518a4473cfa Mon Sep 17 00:00:00 2001 From: sneha122 Date: Tue, 30 Jan 2024 12:52:10 +0530 Subject: [PATCH] fix: cypress test added for onboarding start with data (#30720) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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 ## 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. Co-authored-by: “sneha122” <“sneha@appsmith.com”> --- .../Onboarding/StartFromData_spec.ts | 42 +++++++++++++++++++ .../cypress/support/Pages/DataSources.ts | 7 +++- .../cypress/support/Pages/Onboarding.ts | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromData_spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromData_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromData_spec.ts new file mode 100644 index 0000000000..8948691521 --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromData_spec.ts @@ -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"), + ); + }); + }, +); diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index a61f34cbfc..81b94a433b 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -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); diff --git a/app/client/cypress/support/Pages/Onboarding.ts b/app/client/cypress/support/Pages/Onboarding.ts index cdb663a625..070742da23 100644 --- a/app/client/cypress/support/Pages/Onboarding.ts +++ b/app/client/cypress/support/Pages/Onboarding.ts @@ -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"]`, };