PromucFlow_constructor/app/client/cypress/support/Pages/DataSources.ts

71 lines
3.0 KiB
TypeScript
Raw Normal View History

test: Automated tests for Promises & related bugs in Typescript + Flaky fixes (#10378) * Flaky fixes * S3 CRUD intercept fix * S3 CRUD script change revert * S3 revert! * .its(store) not present fix * TS failure fixes * ChartDataopoint js removed * JSObject ts flaky fix * Bugs 9789, 10150 scripted * Bug 10284 & 9782 scripted * Updated dsl file names * Table_Widget case #7 flaky fix * Bug 10150 scripting improved * DocumentViewer spec flaky fix * Input widget locator corrected * MemberRoles cases script started in TS * UpdateUserRoleInOrg() fix * Skip JSObject_To_ListWidgetSpec.ts until #10284 * Add validation * JSObject_To_ListWidgetSpec.ts timeout increase * Skipping tests until bug 10284 is fixed * Increased wait time * UpdateUserRoleInOrg() updated * MemberRoles_Spec.ts fixed * JSObjToInput - updated * Postgres flaky fix * Member Roles aka CreateOrg test flaky fix * JSObToListWidget_Spec.ts - commenting until bugfix * COmmenting JSobjToInput spec * Commonlocators added back * Entity explorer name fix * Locators fix * Locator corrected * Cypress.json removed files from ignoring list * S3 & Postgress failures fix * Postgress failure locator fix * S3 upload script skipping until bug fix * Params Bug 10784 script started * Fixing Promises Spec * Increased wait time! * MigrationSpec - Image column,Cardformat,Pagestyles * S3, Postgres, Promise - failures fix * Canvas renamed * Bug 11415 - Added Validations * InputWidgets_navigateTo - flaky fix * MigrationSpec - import change * Locators files - Json to Js conversion * DS plugnis name change * Locators - Json to JS conversion * Locators - Json to JS updations * Select_Widget_Value flaky fix * Adding timeout for execute calls to finish * Migration spec - diff syntax+List.js flaky fix * List & MIgration flaky fix
2022-03-02 16:54:43 +00:00
import { CommonLocators } from "../Objects/CommonLocators";
import datasourceFormData from "../../fixtures/datasources.json";
import { AggregateHelper } from "./AggregateHelper";
const agHelper = new AggregateHelper();
const locator = new CommonLocators();
export class DataSources {
private _host = "input[name='datasourceConfiguration.endpoints[0].host']"
private _port = "input[name='datasourceConfiguration.endpoints[0].port']"
private _databaseName = "input[name='datasourceConfiguration.authentication.databaseName']"
private _username = "input[name='datasourceConfiguration.authentication.username']"
private _sectionAuthentication = "[data-cy=section-Authentication]"
private _password = "input[name = 'datasourceConfiguration.authentication.password']"
private _testDs = ".t--test-datasource"
private _saveDs = ".t--save-datasource"
private _datasourceCard = ".t--datasource"
_templateMenu = ".t--template-menu"
public CreatePlugIn(pluginName: string) {
cy.get(locator._createNewPlgin(pluginName)).click();
}
public FillPostgresDSForm(shouldAddTrailingSpaces = false) {
const hostAddress = shouldAddTrailingSpaces ? datasourceFormData["postgres-host"] + " " : datasourceFormData["postgres-host"];
const databaseName = shouldAddTrailingSpaces ? datasourceFormData["postgres-databaseName"] + " " : datasourceFormData["postgres-databaseName"];
cy.get(this._host).type(hostAddress);
cy.get(this._port).type(datasourceFormData["postgres-port"].toString());
cy.get(this._databaseName).clear().type(databaseName);
cy.get(this._sectionAuthentication).click();
cy.get(this._username).type(datasourceFormData["postgres-username"]);
cy.get(this._password).type(datasourceFormData["postgres-password"]);
}
public TestSaveDatasource(expectedRes = true) {
this.TestDatasource(expectedRes);
this.SaveDatasource();
}
public TestDatasource(expectedRes = true) {
cy.get(this._testDs).click();
cy.wait("@testDatasource").should(
"have.nested.property",
"response.body.data.success",
expectedRes,
);
}
public SaveDatasource() {
cy.get(this._saveDs).click();
cy.wait("@saveDatasource")
.then((xhr) => {
cy.log(JSON.stringify(xhr.response!.body));
}).should("have.nested.property", "response.body.responseMeta.status", 200);
}
public NavigateToActiveDSQueryPane(datasourceName: string) {
agHelper.NavigateToDSAdd()
agHelper.GetNClick(locator._activeTab)
cy.get(this._datasourceCard)
.contains(datasourceName)
.scrollIntoView()
.should("be.visible")
.closest(this._datasourceCard)
.within(() => {
cy.get(locator._createQuery).click({ force: true });
})
agHelper.Sleep(2000); //for the CreateQuery page to load
}
}