test: Cypress | CI Stabilize (#26000)

## Description
- This pR improves FilterAndVerifyDatasourceSchemaBySearch() method
- Alters locator for _datasourceTableSchemaInQueryEditor to narrow down
the search result
- Hence fixing /BugTests/DatasourceSchema_spec.ts() causing chrome crash
in CI runs
- Fixes ListV2/Event_Bindings_spec.ts

#### Type of change
- Script fix (non-breaking change which fixes an issue)
- 
## Testing
>
#### How Has This Been Tested?
- [ ] Cypress local runs

## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after changes were reviewed
This commit is contained in:
Aishwarya-U-R 2023-08-04 09:16:59 +05:30 committed by GitHub
parent 150e6d8bf0
commit b5af1a936f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 36 deletions

View File

@ -72,11 +72,7 @@ describe("Datasource form related tests", function () {
dataSources.VerifyTableSchemaOnQueryEditor("public.users"); dataSources.VerifyTableSchemaOnQueryEditor("public.users");
entityExplorer.ExpandCollapseEntity("public.users"); entityExplorer.ExpandCollapseEntity("public.users");
dataSources.VerifyColumnSchemaOnQueryEditor("id"); dataSources.VerifyColumnSchemaOnQueryEditor("id");
dataSources.FilterAndVerifyDatasourceSchemaBySearch( dataSources.FilterAndVerifyDatasourceSchemaBySearch("gender", "column");
"gender",
true,
"column",
);
}, },
); );
@ -126,10 +122,8 @@ describe("Datasource form related tests", function () {
agHelper.RefreshPage(); agHelper.RefreshPage();
dataSources.CreateDataSource("S3", true, false); dataSources.CreateDataSource("S3", true, false);
dataSources.CreateQueryAfterDSSaved(); dataSources.CreateQueryAfterDSSaved();
dataSources.VerifyTableSchemaOnQueryEditor("appsmith-hris");
dataSources.FilterAndVerifyDatasourceSchemaBySearch( dataSources.FilterAndVerifyDatasourceSchemaBySearch(
"appsmith-hris", "appsmith-hris",
true,
"table", "table",
); );
}); });

View File

@ -41,7 +41,9 @@ describe("Listv2 - Event bindings spec", () => {
// click the button on inner list 1st row. // click the button on inner list 1st row.
agHelper.ClickButton("Submit"); agHelper.ClickButton("Submit");
agHelper.ValidateToastMessage("Blue _ 001 _ 0 _ outer input _ inner input"); agHelper.WaitUntilToastDisappear(
"Blue _ 001 _ 0 _ outer input _ inner input",
);
}); });
it("2. nested list - inner widget should get updated values of currentView and level_1", () => { it("2. nested list - inner widget should get updated values of currentView and level_1", () => {

View File

@ -32,7 +32,7 @@ interface RunQueryParams {
export class DataSources { export class DataSources {
private agHelper = ObjectsRegistry.AggregateHelper; private agHelper = ObjectsRegistry.AggregateHelper;
private table = ObjectsRegistry.Table; private table = ObjectsRegistry.Table;
private ee = ObjectsRegistry.EntityExplorer; private entityExplorer = ObjectsRegistry.EntityExplorer;
private locator = ObjectsRegistry.CommonLocators; private locator = ObjectsRegistry.CommonLocators;
private apiPage = ObjectsRegistry.ApiPage; private apiPage = ObjectsRegistry.ApiPage;
private tedTestConfig = ObjectsRegistry.TEDTestConfigs; private tedTestConfig = ObjectsRegistry.TEDTestConfigs;
@ -238,8 +238,8 @@ export class DataSources {
"//p[contains(text(),'" + "//p[contains(text(),'" +
ddName + ddName +
"')]/ancestor::div[@class='form-config-top']/following-sibling::div//div[contains(@class, 'rc-select-multiple')]"; "')]/ancestor::div[@class='form-config-top']/following-sibling::div//div[contains(@class, 'rc-select-multiple')]";
private _datasourceTableSchemaInQueryEditor = private _datasourceTableSchemaInQueryEditor = (schemaName: string) =>
".datasourceStructure-query-editor"; `//div[contains(@class, 'datasourceStructure-query-editor')]//div[contains(@class, 't--entity-name')][text()='${schemaName}']`;
private _datasourceSchemaRefreshBtn = ".datasourceStructure-refresh"; private _datasourceSchemaRefreshBtn = ".datasourceStructure-refresh";
private _datasourceStructureHeader = ".datasourceStructure-header"; private _datasourceStructureHeader = ".datasourceStructure-header";
private _datasourceColumnSchemaInQueryEditor = ".t--datasource-column"; private _datasourceColumnSchemaInQueryEditor = ".t--datasource-column";
@ -255,7 +255,7 @@ export class DataSources {
} }
public GeneratePageWithDB(datasourceName: any, tableName: string) { public GeneratePageWithDB(datasourceName: any, tableName: string) {
this.ee.AddNewPage("Generate page with data"); this.entityExplorer.AddNewPage("Generate page with data");
this.agHelper.GetNClick(this._selectDatasourceDropdown); this.agHelper.GetNClick(this._selectDatasourceDropdown);
this.agHelper.GetNClickByContains( this.agHelper.GetNClickByContains(
this.locator._dropdownText, this.locator._dropdownText,
@ -271,7 +271,7 @@ export class DataSources {
} }
public GeneratePageWithMockDB() { public GeneratePageWithMockDB() {
this.ee.AddNewPage("Generate page with data"); this.entityExplorer.AddNewPage("Generate page with data");
this.agHelper.GetNClick(this._selectDatasourceDropdown); this.agHelper.GetNClick(this._selectDatasourceDropdown);
this.agHelper.GetNClickByContains( this.agHelper.GetNClickByContains(
this._dropdownOption, this._dropdownOption,
@ -394,7 +394,7 @@ export class DataSources {
} }
public NavigateToDSCreateNew() { public NavigateToDSCreateNew() {
this.ee.HoverOnEntityItem("Datasources"); this.entityExplorer.HoverOnEntityItem("Datasources");
Cypress._.times(2, () => { Cypress._.times(2, () => {
this.agHelper.GetNClick(this._addNewDataSource, 0, true); this.agHelper.GetNClick(this._addNewDataSource, 0, true);
this.agHelper.Sleep(); this.agHelper.Sleep();
@ -816,8 +816,8 @@ export class DataSources {
dsName: string, dsName: string,
expectedRes: number | number[] = 200, expectedRes: number | number[] = 200,
) { ) {
this.ee.SelectEntityByName(dsName, "Datasources"); this.entityExplorer.SelectEntityByName(dsName, "Datasources");
this.ee.ActionContextMenuByEntityName({ this.entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: dsName, entityNameinLeftSidebar: dsName,
action: "Delete", action: "Delete",
entityType: EntityItems.Datasource, entityType: EntityItems.Datasource,
@ -884,10 +884,10 @@ export class DataSources {
} }
public AssertDSActive(dsName: string | RegExp) { public AssertDSActive(dsName: string | RegExp) {
this.ee.NavigateToSwitcher("Explorer", 0, true); this.entityExplorer.NavigateToSwitcher("Explorer", 0, true);
this.ee.ExpandCollapseEntity("Datasources", false); this.entityExplorer.ExpandCollapseEntity("Datasources", false);
//this.ee.SelectEntityByName(datasourceName, "Datasources"); //this.entityExplorer.SelectEntityByName(datasourceName, "Datasources");
//this.ee.ExpandCollapseEntity(datasourceName, false); //this.entityExplorer.ExpandCollapseEntity(datasourceName, false);
this.NavigateToActiveTab(); this.NavigateToActiveTab();
return this.agHelper.GetNAssertContains(this._datasourceCard, dsName); return this.agHelper.GetNAssertContains(this._datasourceCard, dsName);
} }
@ -951,8 +951,8 @@ export class DataSources {
} }
DeleteQuery(queryName: string) { DeleteQuery(queryName: string) {
this.ee.ExpandCollapseEntity("Queries/JS"); this.entityExplorer.ExpandCollapseEntity("Queries/JS");
this.ee.ActionContextMenuByEntityName({ this.entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: queryName, entityNameinLeftSidebar: queryName,
action: "Delete", action: "Delete",
entityType: EntityItems.Query, entityType: EntityItems.Query,
@ -1245,7 +1245,7 @@ export class DataSources {
sleep = 500, sleep = 500,
) { ) {
this.agHelper.RemoveEvaluatedPopUp(); //to close the evaluated pop-up this.agHelper.RemoveEvaluatedPopUp(); //to close the evaluated pop-up
this.ee.CreateNewDsQuery(dsName); this.entityExplorer.CreateNewDsQuery(dsName);
if (query) { if (query) {
this.EnterQuery(query, sleep); this.EnterQuery(query, sleep);
} }
@ -1341,7 +1341,7 @@ export class DataSources {
} else { } else {
this.SaveDatasource(); this.SaveDatasource();
} }
this.ee.ActionContextMenuByEntityName({ this.entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: dataSourceName, entityNameinLeftSidebar: dataSourceName,
action: "Refresh", action: "Refresh",
}); });
@ -1351,9 +1351,9 @@ export class DataSources {
} }
public VerifyTableSchemaOnQueryEditor(schema: string) { public VerifyTableSchemaOnQueryEditor(schema: string) {
this.agHelper this.agHelper.AssertElementVisible(
.GetElement(this._datasourceTableSchemaInQueryEditor) this._datasourceTableSchemaInQueryEditor(schema),
.contains(schema); );
} }
public VerifySchemaAbsenceInQueryEditor() { public VerifySchemaAbsenceInQueryEditor() {
@ -1381,17 +1381,15 @@ export class DataSources {
public FilterAndVerifyDatasourceSchemaBySearch( public FilterAndVerifyDatasourceSchemaBySearch(
search: string, search: string,
verifySearch = false, filterBy?: "table" | "column",
filterBy: "table" | "column" = "column",
) { ) {
this.agHelper.Sleep(2500); //for query editor to load
this.agHelper.TypeText(this._datasourceStructureSearchInput, search); this.agHelper.TypeText(this._datasourceStructureSearchInput, search);
this.agHelper.Sleep(); //for search result to load
if (verifySearch) { if (filterBy === "column") {
if (filterBy === "column") { this.VerifyColumnSchemaOnQueryEditor(search);
this.VerifyColumnSchemaOnQueryEditor(search); } else if (filterBy === "table") {
} else { this.VerifyTableSchemaOnQueryEditor(search);
this.VerifyTableSchemaOnQueryEditor(search);
}
} }
} }