Skip to content

Commit

Permalink
test: regression tests for import flow (#38457)
Browse files Browse the repository at this point in the history
Added test for import app validation at app level

/ok-to-test tags="@tag.All"



<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12653467361>
> Commit: 1ac6a57
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12653467361&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 08 Jan 2025 04:28:32 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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

## Summary by CodeRabbit

- **Tests**
- Added a new test suite to verify import functionality for applications
- Implemented test case to check import options and data source
validation at the app level

- **New Features**
- Added new locators for import button and list item title to support
testing

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

---------

Co-authored-by: “NandanAnantharamu” <“[email protected]”>
  • Loading branch information
NandanAnantharamu and “NandanAnantharamu” authored Jan 12, 2025
1 parent 057c626 commit 2dadb16
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import {
agHelper,
homePage,
gitSync,
appSettings,
locators,
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
AppSidebar,
AppSidebarButton,
} from "../../../../support/Pages/EditorNavigation";
import ReconnectLocators from "../../../../locators/ReconnectLocators";

describe("Tests Import option for normal apps at app level", {}, () => {
before(() => {
gitSync.CreateNConnectToGit();
});

it("1. Verify Import Option at app level", () => {
let Datasource = [
"AWSLambda",
"Airtable",
"GSheets_RWDSelected",
"GSheets_RWDAll",
"Hubspot",
"gsheet",
"Twilio",
"Dynamo",
"ElasticSearch",
"Firestore",
"Movies",
"Mongo",
"Oracle",
"Redshift",
"PostGreSQL",
"SMTP",
"Snowflake",
"S3",
"Oauth2.0",
"Pixabay",
"OpenAI",
];
AppSidebar.navigate(AppSidebarButton.Settings);
agHelper.GetNClick(appSettings.locators._importHeader);
agHelper.AssertElementEnabledDisabled(appSettings.locators._importBtn);

homePage.NavigateToHome();
homePage.CreateNewApplication();
AppSidebar.navigate(AppSidebarButton.Settings);
agHelper.GetNClick(appSettings.locators._importHeader);
agHelper.AssertElementEnabledDisabled(
appSettings.locators._importBtn,
0,
false,
);
agHelper.GetNClick(appSettings.locators._importBtn);
homePage.ImportApp("TryToCoverMore.json", "", true);
agHelper.GetNClick(ReconnectLocators.SkipToAppBtn);

AppSidebar.navigate(AppSidebarButton.Data);
Datasource.forEach((ds) => {
agHelper.GetNAssertContains(locators._listItemTitle, ds);
});
});
});
1 change: 1 addition & 0 deletions app/client/cypress/fixtures/TryToCoverMore.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/client/cypress/support/Objects/CommonLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ export class CommonLocators {
_editorTab = ".editor-tab";
_entityTestId = (entity: string) =>
`[data-testid="t--entity-item-${entity}"]`;
_listItemTitle = ".ads-v2-listitem__title";
_dropdownOption = ".rc-select-item-option-content";
_dropdownActiveOption = ".rc-select-dropdown .rc-select-item-option-active";
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class AppSettings {
_scrollArrows: ".scroll-arrows",
_getActivePage: (pageName: string) =>
`//span[contains(text(),"${pageName}")]//ancestor::a[contains(@class,'is-active')]`,
_importBtn: "[data-testid='t--app-setting-import-btn']",
};

public errorMessageSelector = (fieldId: string) => {
Expand Down

0 comments on commit 2dadb16

Please sign in to comment.