test: regression tests for import flow (#38457)

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: 1ac6a57472822360ae786bef59df3238cba130c4
> <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” <“nandan@thinkify.io”>
This commit is contained in:
NandanAnantharamu 2025-01-12 14:28:05 +05:30 committed by GitHub
parent 057c6267bd
commit 2dadb16b22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 68 additions and 0 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@ -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) => {