Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: updated DS test and common method #36204

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
dataSources,
entityItems,
homePage,
locators,
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
Expand Down Expand Up @@ -70,13 +71,14 @@ describe(
agHelper.RefreshPage();
dataSources.CreateMockDB("Users");
dataSources.CreateQueryAfterDSSaved();
dataSources.VerifyTableSchemaOnQueryEditor("public.users");
dataSources.SelectTableFromPreviewSchemaList("public.users");
dataSources.VerifyColumnSchemaOnQueryEditor("id", 1);
agHelper.GetNClick('[data-testid="t--tab-schema"]');
agHelper.AssertElementAbsence(locators._btnSpinner, 5000);
dataSources.FilterAndVerifyDatasourceSchemaBySearch(
"public.us",
"public.users",
);
dataSources.SelectTableFromPreviewSchemaList("public.users");
dataSources.VerifyColumnSchemaOnQueryEditor("id", 1);
},
);

Expand All @@ -87,10 +89,13 @@ describe(
agHelper.RefreshPage();
dataSources.CreateMockDB("Users");
dataSources.CreateQueryAfterDSSaved();
agHelper.GetNClick('[data-testid="t--tab-schema"]');
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");
},
);
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Pages/DataSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor suggestion to replace explicit waits with conditional waits.

Using explicit waits like agHelper.Sleep(1000) can lead to non-deterministic test behaviors and longer than necessary test times. Consider using Cypress's conditional waiting features to wait for specific conditions or elements to be ready.

Here's a suggested refactor:

- agHelper.Sleep(1000); //for search result to load
+ cy.wait('@searchResults'); // Assuming an alias for the search network call

Committable suggestion was skipped due to low confidence.

this.agHelper.Sleep(1000); //for search result to load
this.VerifyTableSchemaOnQueryEditor(expectedTableName);
}
Expand Down
Loading