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

View File

@ -41,7 +41,9 @@ describe("Listv2 - Event bindings spec", () => {
// click the button on inner list 1st row.
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", () => {

View File

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