test: fix DataSourceScheme (#36339)

test:
Fixing DataSourceScheme test

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5155

Improved reliability of data source schema tests by ensuring correct UI
interactions and logical flow.
Enhanced verification process by checking for the absence of loading
spinners before data verification.

**Bugs Raised as part of fixing the spec:**

https://github.com/appsmithorg/appsmith/issues/36349
Test Skipped: https://github.com/appsmithorg/appsmith/issues/36348

/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/10885399399>
> Commit: 12ca3b6b75d5bb135dd4859c45a90d6a9ead81eb
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10885399399&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Mon, 16 Sep 2024 15:08:37 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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

## Summary by CodeRabbit

- **Bug Fixes**
- Skipped a test case for schema fetching due to a known bug, improving
test reliability.
  
- **New Features**
- Enhanced search functionality within the datasource structure,
ensuring previous inputs do not interfere with new searches.
- Improved interaction with the schema tab in the user interface for
better testing.

- **Documentation**
- Updated the path for limited tests to focus on the "Datasource Schema"
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “NandanAnantharamu” <“nandan@thinkify.io”>
This commit is contained in:
NandanAnantharamu 2024-09-16 22:53:09 +05:30 committed by GitHub
parent 4dcec5f2b2
commit 5dfbe8cac7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import {
dataSources,
entityItems,
homePage,
locators,
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
@ -46,7 +47,8 @@ describe(
});
});
it("2. Verify if schema was fetched once #18448", () => {
//This test is failing because of this bug #36348
it.skip("2. Verify if schema was fetched once #36348", () => {
agHelper.RefreshPage();
EditorNavigation.SelectEntityByName(
dataSourceName,
@ -70,13 +72,14 @@ describe(
agHelper.RefreshPage();
dataSources.CreateMockDB("Users");
dataSources.CreateQueryAfterDSSaved();
dataSources.VerifyTableSchemaOnQueryEditor("public.users");
dataSources.SelectTableFromPreviewSchemaList("public.users");
dataSources.VerifyColumnSchemaOnQueryEditor("id", 1);
agHelper.GetNClick(dataSources._dsTabSchema);
agHelper.AssertElementAbsence(locators._btnSpinner);
dataSources.FilterAndVerifyDatasourceSchemaBySearch(
"public.us",
"public.users",
);
dataSources.SelectTableFromPreviewSchemaList("public.users");
dataSources.VerifyColumnSchemaOnQueryEditor("id", 1);
},
);
@ -87,10 +90,13 @@ describe(
agHelper.RefreshPage();
dataSources.CreateMockDB("Users");
dataSources.CreateQueryAfterDSSaved();
agHelper.GetNClick(dataSources._dsTabSchema);
dataSources.FilterAndVerifyDatasourceSchemaBySearch("public.users");
dataSources.VerifyTableSchemaOnQueryEditor("public.users");
// then refresh
dataSources.RefreshDatasourceSchema();
// assert the schema is still shown.
dataSources.FilterAndVerifyDatasourceSchemaBySearch("public.users");
dataSources.VerifyTableSchemaOnQueryEditor("public.users");
},
);

View File

@ -201,7 +201,7 @@ export class DataSources {
".t--datasource-name:contains('" + dsName + "')";
_mandatoryMark = "//span[text()='*']";
_deleteDSHostPort = ".t--delete-field";
_dsTabSchema = "[data-testid='t--tab-schema']";
private _pageSelectionMenu = "[data-testId='t--page-selection']";
private _pageSelectMenuItem = ".ads-v2-menu__menu-item";
@ -1373,7 +1373,7 @@ export class DataSources {
expectedTableName = search,
) {
this.agHelper.Sleep(2500); //for query editor to load
this.agHelper.TypeText(this._datasourceStructureSearchInput, search);
this.agHelper.ClearNType(this._datasourceStructureSearchInput, search);
this.agHelper.Sleep(1000); //for search result to load
this.VerifyTableSchemaOnQueryEditor(expectedTableName);
}