Automated tests for Postgres Datatype - JSON type (#14796)

This commit is contained in:
Aishwarya-U-R 2022-07-06 11:24:00 +05:30 committed by GitHub
parent 3c9543ad93
commit 10fe3e3acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 4005 additions and 118 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,6 @@
"database-url": "appsmith-f9fe4.firebaseio.com",
"projectID": "appsmith-f9fe4",
"serviceAccCredentials": "testdata",
"access_key": "AKIATTSPRCT3ZEMEPSMC",
"secret_key": "DTFRFG15G7Xyn8IIHDW9cKXMg+TuA7DIC74oC0L9",
"mockHostAddress":"fake-api.cvuydmurdlas.us-east-1.rds.amazonaws.com",
"mockDatabaseName": "fakeapi",
"mockDatabaseUsername": "fakeapi",

View File

@ -40,7 +40,7 @@ describe("[Bug]: The data from the query does not show up on the widget #14299",
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("getAstronauts");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
jsEditor.CreateJSObject(
`export default {
runAstros: () => {

View File

@ -130,8 +130,8 @@ describe("Git import flow", function() {
cy.xpath("//input[@value='Success']").should("be.visible");
});
// commenting these test until issue with git status call is fixed
/*it("Create a new branch, clone page and validate data on that branch in deploy and edit mode", () => {
// Skipping these test until issue with git status call is fixed
it.skip("Create a new branch, clone page and validate data on that branch in deploy and edit mode", () => {
cy.createGitBranch(newBranch);
cy.get(".tbody")
.first()
@ -199,7 +199,7 @@ describe("Git import flow", function() {
cy.get(commonlocators.backToEditor).click();
cy.wait(2000);
});
it("Switch to master and verify data in edit and deploy mode", () => {
it.skip("Switch to master and verify data in edit and deploy mode", () => {
cy.switchGitBranch("master");
cy.wait(2000);
// validate data binding in edit and deploy mode
@ -221,7 +221,7 @@ describe("Git import flow", function() {
cy.get(commonlocators.backToEditor).click();
cy.wait(2000);
});
it("Add widget to master, merge then checkout to child branch and verify data", () => {
it.skip("Add widget to master, merge then checkout to child branch and verify data", () => {
cy.get(explorer.widgetSwitchId).click();
cy.wait(2000); // wait for transition
cy.dragAndDropToCanvas("buttonwidget", { x: 300, y: 600 });
@ -237,6 +237,6 @@ describe("Git import flow", function() {
});
after(() => {
cy.deleteTestGithubRepo(repoName);
}); */
//cy.deleteTestGithubRepo(repoName);
});
});

View File

@ -1,6 +1,9 @@
const omnibar = require("../../../../locators/Omnibar.json");
const dsl = require("../../../../fixtures/omnibarDsl.json");
const commonlocators = require("../../../../locators/commonlocators.json");
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
let agHelper = ObjectsRegistry.AggregateHelper;
describe("Omnibar functionality test cases", () => {
const apiName = "Omnibar1";
@ -102,7 +105,10 @@ describe("Omnibar functionality test cases", () => {
cy.wait(1000);
cy.wait("@createNewJSCollection");
cy.wait(1000);
cy.get(".t--js-action-name-edit-field").type(jsObjectName);
cy.get(".t--js-action-name-edit-field")
.type(jsObjectName)
.wait(1000);
agHelper.WaitUntilToastDisappear("created successfully");
cy.get(omnibar.globalSearch).click({ force: true });
cy.get(omnibar.categoryTitle)
.eq(1)

View File

@ -1,11 +1,5 @@
const commonlocators = require("../../../../locators/commonlocators.json");
const dsl = require("../../../../fixtures/ThemeAppdsl.json");
const widgetsPage = require("../../../../locators/Widgets.json");
const testdata = require("../../../../fixtures/testdata.json");
const apiwidget = require("../../../../locators/apiWidgetslocator.json");
const explorer = require("../../../../locators/explorerlocators.json");
const formWidgetsPage = require("../../../../locators/FormWidgets.json");
const publish = require("../../../../locators/publishWidgetspage.json");
const themelocator = require("../../../../locators/ThemeLocators.json");
let themeBackgroudColor;
@ -13,13 +7,15 @@ let themeFont;
let themeColour;
describe("Theme validation usecase for multi-select widget", function() {
it("Drag and drop multi-select widget and validate Default font and list of font validation", function() {
it("Drag and drop multi-select widget and validate Default font and list of font validation + Bug 15007", function() {
cy.log("Login Successful");
cy.reload(); // To remove the rename tooltip
cy.get(explorer.addWidget).click();
cy.get(commonlocators.entityExplorersearch).should("be.visible");
cy.get(commonlocators.entityExplorersearch)
.clear()
.wait(200)
.click()
.type("multiselect");
cy.dragAndDropToCanvas("multiselectwidgetv2", { x: 300, y: 80 });
cy.wait("@updateLayout").should(
@ -45,7 +41,7 @@ describe("Theme validation usecase for multi-select widget", function() {
"response.body.responseMeta.status",
200,
);
cy.wait(5000);
cy.wait(3000);
cy.contains("Border").click({ force: true });
//Shadow validation
@ -97,25 +93,32 @@ describe("Theme validation usecase for multi-select widget", function() {
.text();
});
});
cy.contains("Font").click({ force: true });
//cy.contains("Font").click({ force: true });
//Color
cy.wait(3000);
cy.get(themelocator.inputColor).clear();
cy.get(themelocator.inputColor).type("purple");
cy.get(themelocator.inputColor)
.clear()
.wait(200)
.click()
.type("purple");
cy.get(themelocator.inputColor).should("have.value", "purple");
cy.get(themelocator.color)
.eq(1)
.click({ force: true });
cy.get(themelocator.inputColor).clear();
cy.wait(2000);
cy.get(themelocator.inputColor).type("brown");
cy.get(themelocator.inputColor)
.clear()
.wait(200)
.click()
.type("brown");
cy.get(themelocator.inputColor).should("have.value", "brown");
cy.wait(2000);
cy.contains("Color").click({ force: true });
});
it("Publish the App and validate Font across the app", function() {
it.skip("Publish the App and validate Font across the app + Bug 15007", function() {
//Skipping due to mentioned bug
cy.PublishtheApp();
cy.get(".rc-select-selection-item > .rc-select-selection-item-content")
.first()
@ -133,10 +136,10 @@ describe("Theme validation usecase for multi-select widget", function() {
"font-family",
themeFont,
);
cy.goToEditFromPublish();
});
it("Validate Default Theme change across application", function() {
cy.goToEditFromPublish();
cy.get("#canvas-selection-0").click({ force: true });
//Change the Theme
cy.get(commonlocators.changeThemeBtn).click({ force: true });

View File

@ -39,14 +39,14 @@ describe("Postgres - Datatype Boolean & Enum types tests", function() {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("createEnum");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.RunQuery();
query = `create table boolenumtypes (serialId SERIAL not null primary key, workingDay weekdays, AreWeWorking boolean)`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("createTable");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.RunQuery();
//ee.ExpandCollapseEntity(dsName); //Clicking Create Query from Active DS is already expanding ds
@ -70,43 +70,43 @@ describe("Postgres - Datatype Boolean & Enum types tests", function() {
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("insertRecord");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
query = `UPDATE public."boolenumtypes" SET "workingday" = {{Updateworkingday.selectedOptionValue}}, "areweworking" = {{Updateareweworking.isSwitchedOn}} WHERE serialid = {{Table1.selectedRow.serialid}};`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("updateRecord");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
query = `SELECT * from enum_range(NULL::weekdays)`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("getEnum");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
query = `DELETE FROM public."boolenumtypes" WHERE serialId ={{Table1.selectedRow.serialid}}`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("deleteRecord");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
query = `DELETE FROM public."boolenumtypes"`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("deleteAllRecords");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
query = `drop table public."boolenumtypes"`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("dropTable");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
query = `drop type weekdays`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("dropEnum");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity(dsName, false);
@ -197,7 +197,7 @@ describe("Postgres - Datatype Boolean & Enum types tests", function() {
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("verifyEnumOrdering");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("Saturday");
@ -207,7 +207,7 @@ describe("Postgres - Datatype Boolean & Enum types tests", function() {
});
query = `SELECT * FROM boolenumtypes WHERE workingday = (SELECT MIN(workingday) FROM boolenumtypes);`;
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("Monday");
@ -301,6 +301,6 @@ describe("Postgres - Datatype Boolean & Enum types tests", function() {
deployMode.DeployApp();
deployMode.NavigateBacktoEditor();
ee.ExpandCollapseEntity("QUERIES/JS");
dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); //ProductLines, Employees pages are still using this ds
dataSources.DeleteDatasouceFromWinthinDS(dsName, 200);
});
});

View File

@ -14,7 +14,7 @@ describe("Postgres - Datatype Character tests", function() {
cy.fixture("CharacterDTdsl").then((val: any) => {
agHelper.AddDsl(val);
});
propPane.ChangeTheme("Modern");
propPane.ChangeTheme("Pacific");
});
it("1. Create Postgress DS", function() {
@ -38,9 +38,10 @@ describe("Postgres - Datatype Character tests", function() {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("createTable");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
cy.get(".CodeMirror textarea").focus();
dataSources.RunQuery();
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(ee._entityNameInExplorer("public.chartypes"));
@ -54,7 +55,7 @@ describe("Postgres - Datatype Character tests", function() {
agHelper
.GetText(dataSources._noRecordFound)
.then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show"));
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("4. Creating INSERT query - chartypes", () => {
@ -62,7 +63,7 @@ describe("Postgres - Datatype Character tests", function() {
VALUES ({{Insertone.text}}, {{Insertasmany.text}}, {{Insertlimited.text}}::varchar(4), {{Insertunlimited.text}});`;
ee.ActionTemplateMenuByEntityName("public.chartypes", "INSERT");
agHelper.RenameWithInPane("insertRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("5. Creating UPDATE query - chartypes", () => {
@ -74,7 +75,7 @@ describe("Postgres - Datatype Character tests", function() {
WHERE serialid = {{Table1.selectedRow.serialid}};`;
ee.ActionTemplateMenuByEntityName("public.chartypes", "UPDATE");
agHelper.RenameWithInPane("updateRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("5. Creating DELETE query with condition - chartypes", () => {
@ -82,21 +83,21 @@ describe("Postgres - Datatype Character tests", function() {
WHERE serialId = {{Table1.selectedRow.serialid}};`;
ee.ActionTemplateMenuByEntityName("public.chartypes", "DELETE");
agHelper.RenameWithInPane("deleteRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("6. Creating DELETE query for complete table empty - chartypes", () => {
query = `DELETE FROM public."chartypes"`;
ee.ActionTemplateMenuByEntityName("public.chartypes", "DELETE");
agHelper.RenameWithInPane("deleteAllRecords");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("7. Creating DROP table query - chartypes", () => {
query = `drop table public."chartypes"`;
ee.ActionTemplateMenuByEntityName("public.chartypes", "DELETE");
agHelper.RenameWithInPane("dropTable");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity(dsName, false);
});

View File

@ -41,9 +41,10 @@ describe("Postgres - Datatype DateTime tests", function() {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("createTable");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
cy.get(".CodeMirror textarea").focus();
dataSources.RunQuery();
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(
@ -64,7 +65,7 @@ describe("Postgres - Datatype DateTime tests", function() {
agHelper
.GetText(dataSources._noRecordFound)
.then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show"));
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("4. Creating INSERT query - datetimetypes", () => {
@ -72,7 +73,7 @@ describe("Postgres - Datatype DateTime tests", function() {
VALUES('{{Insertts.text}}', '{{Inserttstz.text}}', '{{Insertdater.text}}', '{{Inserttimer.text}}', '{{Insertintervaler.text}}');`;
ee.ActionTemplateMenuByEntityName("public.datetimetypes", "INSERT");
agHelper.RenameWithInPane("insertRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.ToggleUsePreparedStatement(false);
});
@ -82,7 +83,7 @@ describe("Postgres - Datatype DateTime tests", function() {
"intervaler" = '{{Updateintervaler.text}}' WHERE serialid = {{Table1.selectedRow.serialid}};`;
ee.ActionTemplateMenuByEntityName("public.datetimetypes", "UPDATE");
agHelper.RenameWithInPane("updateRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.ToggleUsePreparedStatement(false);
});
@ -91,21 +92,21 @@ describe("Postgres - Datatype DateTime tests", function() {
WHERE serialId = {{Table1.selectedRow.serialid}};`;
ee.ActionTemplateMenuByEntityName("public.datetimetypes", "DELETE");
agHelper.RenameWithInPane("deleteRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("7. Creating DELETE query for complete table empty - datetimetypes", () => {
query = `DELETE FROM public."datetimetypes"`;
ee.ActionTemplateMenuByEntityName("public.datetimetypes", "DELETE");
agHelper.RenameWithInPane("deleteAllRecords");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("8. Creating DROP table query - datetimetypes", () => {
query = `drop table public."datetimetypes"`;
ee.ActionTemplateMenuByEntityName("public.datetimetypes", "DELETE");
agHelper.RenameWithInPane("dropTable");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("9. Validating interval methods", () => {
@ -116,7 +117,7 @@ describe("Postgres - Datatype DateTime tests", function() {
EXTRACT (MINUTE FROM INTERVAL '5 hours 21 minutes');`;
ee.ActionTemplateMenuByEntityName("public.datetimetypes", "SELECT");
agHelper.RenameWithInPane("intervalRecords");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq(

View File

@ -0,0 +1,721 @@
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
let guid: any, dsName: any, query: string;
const agHelper = ObjectsRegistry.AggregateHelper,
ee = ObjectsRegistry.EntityExplorer,
dataSources = ObjectsRegistry.DataSources,
propPane = ObjectsRegistry.PropertyPane,
table = ObjectsRegistry.Table,
locator = ObjectsRegistry.CommonLocators,
deployMode = ObjectsRegistry.DeployMode;
describe("Postgres - Datatype Json & JsonB types tests", function() {
before(() => {
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
dataSources.NavigateToDSCreateNew();
dataSources.CreatePlugIn("PostgreSQL");
guid = uid;
agHelper.RenameWithInPane("Postgres " + guid, false);
dataSources.FillPostgresDSForm();
dataSources.TestSaveDatasource();
cy.wrap("Postgres " + guid).as("dsName");
});
cy.get("@dsName").then(($dsName) => {
dsName = $dsName;
});
});
//#region Json Datatype
it("0. Importing App & setting theme", () => {
cy.fixture("JsonDTdsl").then((val: any) => {
agHelper.AddDsl(val);
});
ee.NavigateToSwitcher("widgets");
propPane.ChangeColor(33, "Primary");
propPane.ChangeColor(39, "Background");
});
it("1. Creating table query - jsonbooks", () => {
query = `CREATE TABLE jsonbooks(serialId SERIAL PRIMARY KEY, details JSON)`;
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("createTable");
dataSources.EnterQuery(query);
dataSources.RunQuery();
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(ee._entityNameInExplorer("public.jsonbooks"));
});
it("2. Creating SELECT query - jsonbooks + Bug 14493", () => {
ee.ActionTemplateMenuByEntityName("public.jsonbooks", "SELECT");
agHelper.RenameWithInPane("selectRecords");
dataSources.RunQuery();
agHelper
.GetText(dataSources._noRecordFound)
.then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show"));
});
it("3. Creating all queries - jsonbooks", () => {
query = `INSERT INTO jsonbooks(details) VALUES('{"customer": "{{InsertJSONForm.formData.customer}}", "title": "{{InsertJSONForm.formData.title}}", "type": {{InsertJSONForm.formData.type}}, "info": {"published": {{InsertJSONForm.formData.info.published}}, "price": {{InsertJSONForm.formData.info.price}}}}');`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("insertRecord");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.ToggleUsePreparedStatement(false);
query = `UPDATE public."jsonbooks" SET "details" = '{"customer": "{{UpdateJSONForm.formData.customer}}", "title": "{{UpdateJSONForm.formData.title}}", "type": {{UpdateJSONForm.formData.type}}, "info": {"published": {{UpdateJSONForm.formData.info.published}}, "price": {{UpdateJSONForm.formData.info.price}}}}' WHERE serialid = {{Table1.selectedRow.serialid}};`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("updateRecord");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.ToggleUsePreparedStatement(false);
query = `DELETE FROM public."jsonbooks" WHERE serialId ={{Table1.selectedRow.serialid}}`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("deleteRecord");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
query = `DELETE FROM public."jsonbooks"`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("deleteAllRecords");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
query = `drop table public."jsonbooks"`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("dropTable");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity(dsName, false);
});
it("4. Inserting record - jsonbooks", () => {
ee.SelectEntityByName("Page1");
deployMode.DeployApp();
table.WaitForTableEmpty(); //asserting table is empty before inserting!
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Customer", "Lily Bush");
deployMode.EnterJSONInputValue("Title", "PostgreSQL for Beginners");
deployMode.SelectJsonFormMultiSelect("Type", ["Programming", "Computer"]);
agHelper.ToggleSwitch("Published", "check", true);
deployMode.EnterJSONInputValue("Price", "150");
agHelper.ClickButton("Insert");
agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(0, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(0, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("5. Inserting another record - jsonbooks", () => {
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Customer", "Josh William");
deployMode.EnterJSONInputValue("Title", "Ivanhoe");
deployMode.SelectJsonFormMultiSelect("Type", ["Adventure", "Novel"]);
agHelper.ToggleSwitch("Published", "check", true);
deployMode.EnterJSONInputValue("Price", "400");
agHelper.ClickButton("Insert");
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(1, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(1, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("6. Inserting another record - jsonbooks", () => {
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Customer", "Mary Clark");
deployMode.EnterJSONInputValue("Title", "The Pragmatic Programmer");
deployMode.SelectJsonFormMultiSelect("Type", ["Programming"], 0, true);
agHelper.ToggleSwitch("Published", "uncheck", true);
deployMode.EnterJSONInputValue("Price", "360");
agHelper.ClickButton("Insert");
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(2, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(2, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("7. Updating record - jsonbooks", () => {
table.SelectTableRow(1);
agHelper.ClickButton("Run UpdateQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Title", " Bill"); //Adding Bill to name
agHelper.ToggleSwitch("Published", "uncheck", true);
deployMode.ClearJSONFieldValue("Price");
deployMode.EnterJSONInputValue("Price", "660");
agHelper.ClickButton("Update");
agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Update did not fail
agHelper.AssertElementVisible(locator._spanButton("Run UpdateQuery"));
table.ReadTableRowColumnData(1, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("3");
});
table.ReadTableRowColumnData(2, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("2"); //Since recently updated column to pushed to last!
});
table.ReadTableRowColumnData(2, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("8. Validating JSON functions", () => {
deployMode.NavigateBacktoEditor();
table.WaitUntilTableLoad();
ee.ExpandCollapseEntity("QUERIES/JS");
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.RenameWithInPane("verifyJsonFunctions");
//Verifying -> - returns results in json format
query = `SELECT details -> 'title' AS "BookTitle" FROM jsonbooks;`;
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["BookTitle"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("PostgreSQL for Beginners");
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("The Pragmatic Programmer");
});
dataSources.ReadQueryTableResponse(2).then(($cellData) => {
expect($cellData).to.eq("Ivanhoe Bill");
});
//Verifying ->> - returns result in text format
query = `SELECT details -> 'info' ->> 'price' AS "BookPrice" FROM jsonbooks;`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["BookPrice"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("150");
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("360");
});
dataSources.ReadQueryTableResponse(2).then(($cellData) => {
expect($cellData).to.eq("660");
});
//Verifying 'CAST' with 'WHERE' clause
query = `SELECT details -> 'customer' AS "P+ Customer", details -> 'info' ->> 'price' as "Book Price" FROM jsonbooks where CAST (details -> 'info' ->> 'price' as INTEGER) > 360;`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["P+ Customer", "Book Price"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("Josh William");
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("660");
});
//Verifying Aggregate functions
query = `SELECT MIN (CAST (details -> 'info' ->> 'price' as INTEGER)), MAX (CAST (details -> 'info' ->> 'price' as INTEGER)), SUM (CAST (details -> 'info' ->> 'price' as INTEGER)), AVG (CAST (details -> 'info' ->> 'price' as INTEGER)), count(*) FROM jsonbooks;`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders([
"min",
"max",
"sum",
"avg",
"count",
]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("150");
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("660");
});
dataSources.ReadQueryTableResponse(2).then(($cellData) => {
expect($cellData).to.eq("1170");
});
dataSources.ReadQueryTableResponse(3).then(($cellData) => {
expect($cellData).to.eq("390");
});
dataSources.ReadQueryTableResponse(4).then(($cellData) => {
expect($cellData).to.eq("3");
});
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("QUERIES/JS", false);
});
it("9. Deleting records - jsonbooks", () => {
ee.SelectEntityByName("Page1");
deployMode.DeployApp();
table.WaitUntilTableLoad();
table.SelectTableRow(1);
agHelper.ClickButton("DeleteQuery", 1);
agHelper.ValidateNetworkStatus("@postExecute", 200);
agHelper.ValidateNetworkStatus("@postExecute", 200);
agHelper.Sleep(2500); //Allwowing time for delete to be success
table.ReadTableRowColumnData(1, 0, 2000).then(($cellData) => {
expect($cellData).not.to.eq("3"); //asserting 2nd record is deleted
});
table.ReadTableRowColumnData(1, 0, 200).then(($cellData) => {
expect($cellData).to.eq("2");
});
});
it("10. Deleting all records from table - jsonbooks", () => {
agHelper.GetNClick(locator._deleteIcon);
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
agHelper.Sleep(2000);
table.WaitForTableEmpty();
});
it("11. Inserting another record (to check serial column) - jsonbooks", () => {
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Customer", "Bob Sim");
deployMode.EnterJSONInputValue("Title", "Treasure Island");
deployMode.SelectJsonFormMultiSelect("Type", ["Novel"]);
agHelper.ToggleSwitch("Published", "uncheck", true);
deployMode.EnterJSONInputValue("Price", "80");
agHelper.AssertElementVisible(locator._visibleTextDiv("Out of range!"));
deployMode.ClearJSONFieldValue("Price");
deployMode.EnterJSONInputValue("Price", "800");
agHelper.ClickButton("Insert");
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(0, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("4"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(0, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("12. Validate Drop of the Newly Created - jsonbooks - Table from Postgres datasource", () => {
deployMode.NavigateBacktoEditor();
ee.ExpandCollapseEntity("QUERIES/JS");
ee.SelectEntityByName("dropTable");
dataSources.RunQuery();
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("0"); //Success response for dropped table!
});
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementAbsence(ee._entityNameInExplorer("public.jsonbooks"));
ee.ExpandCollapseEntity(dsName, false);
ee.ExpandCollapseEntity("DATASOURCES", false);
});
it("13. Verify Deletion of all created queries", () => {
dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists
ee.ExpandCollapseEntity("QUERIES/JS");
ee.ActionContextMenuByEntityName("createTable", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName(
"deleteAllRecords",
"Delete",
"Are you sure?",
);
ee.ActionContextMenuByEntityName("deleteRecord", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("dropTable", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("insertRecord", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName(
"selectRecords",
"Delete",
"Are you sure?",
);
ee.ActionContextMenuByEntityName("updateRecord", "Delete", "Are you sure?");
});
//#endregion
//#region JsonB Datatype
it("14. Importing App & setting theme", () => {
cy.fixture("JsonBDTdsl").then((val: any) => {
agHelper.AddDsl(val);
});
ee.NavigateToSwitcher("widgets");
propPane.ChangeColor(12, "Primary");
propPane.ChangeColor(23, "Background");
});
it("15. Creating enum & table queries - jsonBbooks", () => {
query = `CREATE TYPE genres AS ENUM ('Fiction', 'Thriller', 'Horror', 'Marketing & Sales', 'Self-Help', 'Psychology', 'Law', 'Politics', 'Productivity', 'Reference', 'Spirituality');`;
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("createEnum");
dataSources.EnterQuery(query);
dataSources.RunQuery();
query = `CREATE TABLE "jsonBbooks" (serialId SERIAL PRIMARY KEY, details JSONB)`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("createTable");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.RunQuery();
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(
ee._entityNameInExplorer("public.jsonBbooks"),
);
});
it("16. Creating SELECT query - jsonBbooks + Bug 14493", () => {
ee.ActionTemplateMenuByEntityName("public.jsonBbooks", "SELECT");
agHelper.RenameWithInPane("selectRecords");
dataSources.RunQuery();
agHelper
.GetText(dataSources._noRecordFound)
.then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show"));
});
it("17. Creating all queries - jsonBbooks", () => {
query = `INSERT INTO "jsonBbooks"(details) VALUES('{"title": "{{InsertJSONForm.formData.title}}", "genres": {{InsertJSONForm.formData.genres}}, "info": {"published": {{InsertJSONForm.formData.info.published}}, "publishedDate": "{{InsertJSONForm.formData.info.publishedDate}}"}}');`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("insertRecord");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.ToggleUsePreparedStatement(false);
query = `UPDATE public."jsonBbooks" SET "details" = '{"title": "{{UpdateJSONForm.formData.title}}", "genres": {{UpdateJSONForm.formData.genres}}, "info": {"published": {{UpdateJSONForm.formData.info.published}}, "publishedDate": "{{UpdateJSONForm.formData.info.publishedDate}}"}}' WHERE serialid = {{Table1.selectedRow.serialid}};`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("updateRecord");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.ToggleUsePreparedStatement(false);
query = `SELECT * from enum_range(NULL::genres)`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("getEnum");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
query = `DELETE FROM public."jsonBbooks" WHERE serialId ={{Table1.selectedRow.serialid}}`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("deleteRecord");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
query = `DELETE FROM public."jsonBbooks"`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("deleteAllRecords");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
query = `drop table public."jsonBbooks"`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("dropTable");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
query = `drop type genres`;
ee.CreateNewDsQuery(dsName);
agHelper.RenameWithInPane("dropEnum");
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity(dsName, false);
});
it("18. Inserting record - jsonbooks", () => {
ee.SelectEntityByName("Page1");
deployMode.DeployApp();
table.WaitForTableEmpty(); //asserting table is empty before inserting!
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Title", "Sleeping Beauties");
agHelper.ToggleSwitch("Published", "check", true);
agHelper.GetNClick(
deployMode._jsonFormDatepickerFieldByName("Published Date"),
);
agHelper.GetNClick(locator._datePicker(5));
deployMode.SelectJsonFormMultiSelect("Genres", [
"Fiction",
"Thriller",
"Horror",
]);
agHelper.ClickButton("Insert");
agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(0, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(0, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("19. Inserting another record - jsonbooks", () => {
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Title", "Deep Work");
agHelper.ToggleSwitch("Published", "check", true);
agHelper.GetNClick(
deployMode._jsonFormDatepickerFieldByName("Published Date"),
);
agHelper.GetNClick(locator._datePicker(15));
deployMode.SelectJsonFormMultiSelect("Genres", [
"Productivity",
"Reference",
]);
agHelper.ClickButton("Insert");
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(1, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(1, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("20. Inserting another record - jsonbooks", () => {
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Title", "Siddhartha");
agHelper.ToggleSwitch("Published", "uncheck", true);
agHelper.GetNClick(
deployMode._jsonFormDatepickerFieldByName("Published Date"),
);
agHelper.GetNClick(locator._datePicker(15));
deployMode.SelectJsonFormMultiSelect("Genres", ["Fiction", "Spirituality"]);
agHelper.ClickButton("Insert");
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(2, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(2, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("21. Updating record - jsonbooks", () => {
//table.SelectTableRow(0);
agHelper.ClickButton("Run UpdateQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.ClearJSONFieldValue("Title");
deployMode.EnterJSONInputValue("Title", "The Dictator''s Handbook"); //Adding Bill to name
agHelper.ToggleSwitch("Published", "uncheck", true);
agHelper.GetNClick(
deployMode._jsonFormDatepickerFieldByName("Published Date"),
);
agHelper.GetNClick(locator._datePicker(25));
deployMode.SelectJsonFormMultiSelect(
"Genres",
["Fiction", "Thriller", "Horror"],
0,
false,
);
deployMode.SelectJsonFormMultiSelect("Genres", ["Law", "Politics"]);
agHelper.ClickButton("Update");
agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Update did not fail
agHelper.AssertElementVisible(locator._spanButton("Run UpdateQuery"));
table.ReadTableRowColumnData(1, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("3");
});
table.ReadTableRowColumnData(2, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("1"); //Since recently updated column to pushed to last!
});
table.ReadTableRowColumnData(2, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("22. Validating JSON functions", () => {
deployMode.NavigateBacktoEditor();
table.WaitUntilTableLoad();
ee.ExpandCollapseEntity("QUERIES/JS");
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.RenameWithInPane("verifyJsonBFunctions");
//Verifying @> contains
query = `SELECT '["Fiction", "Thriller", "Horror"]'::jsonb @> '["Fiction", "Horror"]'::jsonb as "Result1", '["Fiction", "Horror"]'::jsonb @> '["Fiction", "Thriller", "Horror"]'::jsonb as "Result2", '{"name": "Alice", "agent": {"bot": true} }'::jsonb -> 'agent' ->> 'bot' is not null as "Filter"`;
agHelper.GetNClick(dataSources._templateMenu);
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["Result1", "Result2", "Filter"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("true");
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("false");
});
dataSources.ReadQueryTableResponse(2).then(($cellData) => {
expect($cellData).to.eq("true");
});
//Verifying ->> - returns result in text format & checks contains
query = `SELECT details->'title' as "BookTitle", details -> 'info' ->> 'publishedDate' as "Published Date" FROM "jsonBbooks" WHERE details->'genres' @> '["Fiction"]'::jsonb;`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["BookTitle", "Published Date"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("Siddhartha");
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("2022-07-15");
});
//Verifying Top Level key is present
query = `SELECT '{"book": {"title": "War and Peace"}}'::jsonb @> '{"book": {}}'::jsonb as "Top Level Key"; `;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["Top Level Key"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("true");
});
//Verifying jsonb functions
query = `select jsonb_each( '{"name": "Alice", "agent": {"bot": true} }'::jsonb), jsonb_object_keys( '{"name": "Alice", "agent": {"bot": true} }'::jsonb), jsonb_extract_path( '{"name": "Alice", "agent": {"bot": true} }'::jsonb, 'agent', 'bot');`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(["jsonb_each", "jsonb_object_keys", "jsonb_extract_path"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq('(name,"""Alice""")');
});
dataSources.ReadQueryTableResponse(1).then(($cellData) => {
expect($cellData).to.eq("name");
});
dataSources.ReadQueryTableResponse(2).then(($cellData) => {
expect($cellData).to.eq("true");
});
dataSources.ReadQueryTableResponse(3).then(($cellData) => {
expect($cellData).to.eq('(agent,"{""bot"": true}")');
});
dataSources.ReadQueryTableResponse(4).then(($cellData) => {
expect($cellData).to.eq("agent");
});
dataSources.ReadQueryTableResponse(5).then(($cellData) => {
expect($cellData).to.eq("true");
});
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("QUERIES/JS", false);
});
it("23. Deleting records - jsonbooks", () => {
ee.SelectEntityByName("Page1");
deployMode.DeployApp();
table.WaitUntilTableLoad();
table.SelectTableRow(1);
agHelper.ClickButton("DeleteQuery", 1);
agHelper.ValidateNetworkStatus("@postExecute", 200);
agHelper.ValidateNetworkStatus("@postExecute", 200);
agHelper.Sleep(2500); //Allwowing time for delete to be success
table.ReadTableRowColumnData(1, 0, 2000).then(($cellData) => {
expect($cellData).not.to.eq("3"); //asserting 2nd record is deleted
});
table.ReadTableRowColumnData(1, 0, 200).then(($cellData) => {
expect($cellData).to.eq("1");
});
});
it("24. Deleting all records from table - jsonbooks", () => {
agHelper.GetNClick(locator._deleteIcon);
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
agHelper.Sleep(2000);
table.WaitForTableEmpty();
});
it("25. Inserting another record (to check serial column) - jsonbooks", () => {
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisible(locator._modal);
deployMode.EnterJSONInputValue("Title", "Influence");
agHelper.ToggleSwitch("Published", "check", true);
agHelper.GetNClick(
deployMode._jsonFormDatepickerFieldByName("Published Date"),
);
agHelper.GetNClick(locator._datePicker(16));
deployMode.SelectJsonFormMultiSelect("Genres", ["Marketing & Sales", "Self-Help", "Psychology"]);
agHelper.ClickButton("Insert");
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
table.ReadTableRowColumnData(0, 0, 2000).then(($cellData) => {
expect($cellData).to.eq("4"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(0, 1, 200).then(($cellData) => {
expect($cellData).not.to.eq("");
});
});
it("26. Validate Drop of the Newly Created - jsonbooks - Table from Postgres datasource", () => {
deployMode.NavigateBacktoEditor();
ee.ExpandCollapseEntity("QUERIES/JS");
ee.SelectEntityByName("dropTable");
dataSources.RunQuery();
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("0"); //Success response for dropped table!
});
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementAbsence(ee._entityNameInExplorer("public.jsonBbooks"));
ee.ExpandCollapseEntity(dsName, false);
ee.ExpandCollapseEntity("DATASOURCES", false);
});
it("27. Verify Deletion of all created queries", () => {
dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists
ee.ExpandCollapseEntity("QUERIES/JS");
ee.ActionContextMenuByEntityName("createEnum", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("createTable", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName(
"deleteAllRecords",
"Delete",
"Are you sure?",
);
ee.ActionContextMenuByEntityName("deleteRecord", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("dropTable", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("dropEnum", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("getEnum", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName("insertRecord", "Delete", "Are you sure?");
ee.ActionContextMenuByEntityName(
"selectRecords",
"Delete",
"Are you sure?",
);
ee.ActionContextMenuByEntityName("updateRecord", "Delete", "Are you sure?");
});
//#endregion
it("28. Verify Deletion of datasource", () => {
deployMode.DeployApp();
deployMode.NavigateBacktoEditor();
ee.ExpandCollapseEntity("QUERIES/JS");
dataSources.DeleteDatasouceFromWinthinDS(dsName, 200);
});
});

View File

@ -14,7 +14,7 @@ describe("Postgres - Datatype Numeric tests", function() {
cy.fixture("NumericDTdsl").then((val: any) => {
agHelper.AddDsl(val);
});
propPane.ChangeTheme("Modern");
propPane.ChangeTheme("Moon");
});
it("1. Create Postgress DS", function() {
@ -38,9 +38,10 @@ describe("Postgres - Datatype Numeric tests", function() {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("createTable");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
cy.get(".CodeMirror textarea").focus();
dataSources.RunQuery();
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(
@ -62,7 +63,7 @@ describe("Postgres - Datatype Numeric tests", function() {
VALUES ({{Insertbigint.text}}, {{Insertdecimal.text}}, {{Insertnumeric.text}})`;
ee.ActionTemplateMenuByEntityName("public.numerictypes", "INSERT");
agHelper.RenameWithInPane("insertRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("5. Creating UPDATE query - numerictypes", () => {
@ -73,7 +74,7 @@ describe("Postgres - Datatype Numeric tests", function() {
WHERE serialid = {{Table1.selectedRow.serialid}};`;
ee.ActionTemplateMenuByEntityName("public.numerictypes", "UPDATE");
agHelper.RenameWithInPane("updateRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("5. Creating DELETE query with condition - numerictypes", () => {
@ -81,21 +82,21 @@ describe("Postgres - Datatype Numeric tests", function() {
WHERE serialId ={{Table1.selectedRow.serialid}}`;
ee.ActionTemplateMenuByEntityName("public.numerictypes", "DELETE");
agHelper.RenameWithInPane("deleteRecord");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("6. Creating DELETE query for complete table empty - numerictypes", () => {
query = `DELETE FROM public."numerictypes"`;
ee.ActionTemplateMenuByEntityName("public.numerictypes", "DELETE");
agHelper.RenameWithInPane("deleteAllRecords");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
});
it("7. Creating DROP table query - numerictypes", () => {
query = `drop table public."numerictypes"`;
ee.ActionTemplateMenuByEntityName("public.numerictypes", "DELETE");
agHelper.RenameWithInPane("dropTable");
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
ee.ExpandCollapseEntity("QUERIES/JS", false);
ee.ExpandCollapseEntity(dsName, false);
});

View File

@ -1,11 +1,15 @@
const datasourceEditor = require("../../../../locators/DatasourcesEditor.json");
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
let dataSources = ObjectsRegistry.DataSources;
let datasourceName, actionName;
describe("Mongo Active datasource test cases", function() {
before(() => {
cy.NavigateToDatasourceEditor();
cy.get(datasourceEditor.MongoDB).click();
cy.getPluginFormsAndCreateDatasource();
dataSources.CreatePlugIn("MongoDB");
cy.fillMongoDatasourceForm();
cy.get(datasourceEditor.saveBtn).click({ force: true });
cy.wait("@createDatasource").then((httpResponse) => {

View File

@ -10,7 +10,7 @@ describe("Create a rest datasource", function() {
it("Create a rest datasource + Bug 14566", function() {
cy.NavigateToAPI_Panel();
cy.CreateAPI("Testapi");
cy.CreateAPI();
cy.enterDatasourceAndPath(testdata.baseUrl, testdata.methods);
cy.assertPageSave();
cy.get(".t--store-as-datasource")

View File

@ -24,7 +24,7 @@ describe("Validate Mongo CRUD with JSON Form", () => {
});
it("1. Create DS & then Add new Page and generate CRUD template using created datasource", () => {
propPane.ChangeTheme("Modern");
propPane.ChangeTheme("Water Lily");
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
@ -45,7 +45,6 @@ describe("Validate Mongo CRUD with JSON Form", () => {
cy.wrap("Mongo " + guid).as("dsName");
});
agHelper.ValidateNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.WaitUntilToastDisappear("datasource updated successfully");
agHelper.GetNClick(dataSources._selectTableDropdown);
agHelper.GetNClickByContains(dataSources._dropdownOption, "pokemon");
GenerateCRUDNValidateDeployPage(
@ -101,7 +100,6 @@ describe("Validate Mongo CRUD with JSON Form", () => {
agHelper.GetNClick(dataSources._generatePageBtn);
agHelper.ValidateNetworkStatus("@replaceLayoutWithCRUDPage", 201);
//agHelper.ValidateToastMessage("Successfully generated a page");// Commenting this since FindQuery failure appears sometimes
agHelper.WaitUntilToastDisappear("Successfully generated a page");
agHelper.ValidateNetworkStatus("@getActions", 200);
agHelper.ValidateNetworkStatus("@postExecute", 200);
agHelper.ValidateNetworkStatus("@updateLayout", 200);

View File

@ -44,7 +44,6 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => {
});
agHelper.ValidateNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.WaitUntilToastDisappear("datasource updated successfully");
agHelper.GetNClick(dataSources._selectTableDropdown);
agHelper.GetNClickByContains(
dataSources._dropdownOption,
@ -95,7 +94,6 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => {
});
agHelper.ValidateNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.WaitUntilToastDisappear("datasource updated successfully");
agHelper.GetNClick(dataSources._selectTableDropdown);
agHelper.GetNClickByContains(dataSources._dropdownOption, "customers");
@ -162,13 +160,14 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("CreateProductLines");
agHelper.EnterValue(tableCreateQuery);
dataSources.EnterQuery(tableCreateQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery); //failing sometimes!
dataSources.RunQuery();
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("DATASOURCES")
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(ee._entityNameInExplorer("productlines"));
@ -303,7 +302,7 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("CreateStores");
agHelper.EnterValue(tableCreateQuery);
dataSources.EnterQuery(tableCreateQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);
@ -583,12 +582,13 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("DropStores");
agHelper.EnterValue(deleteTblQuery);
dataSources.EnterQuery(deleteTblQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);
dataSources.RunQuery();
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementAbsence(ee._entityNameInExplorer("Stores"));
@ -599,7 +599,7 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("DropStores");
agHelper.EnterValue(deleteTblQuery);
dataSources.EnterQuery(deleteTblQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);

View File

@ -37,7 +37,6 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
});
agHelper.ValidateNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.WaitUntilToastDisappear("datasource updated successfully");
agHelper.GetNClick(dataSources._selectTableDropdown);
agHelper.GetNClickByContains(dataSources._dropdownOption, "film");
@ -90,7 +89,6 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
});
agHelper.ValidateNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.WaitUntilToastDisappear("datasource updated successfully");
agHelper.GetNClick(dataSources._selectTableDropdown);
agHelper.GetNClickByContains(dataSources._dropdownOption, "suppliers");
@ -105,7 +103,7 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
cy.get("@dsName").then(($dsName) => {
dsName = $dsName;
});
propPane.ChangeTheme("Modern");
propPane.ChangeTheme("Sunrise");
});
it("3. Generate CRUD page from datasource present in ACTIVE section", function() {
@ -166,13 +164,14 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("CreateVessels");
agHelper.EnterValue(tableCreateQuery);
dataSources.EnterQuery(tableCreateQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery); //failing sometimes!
dataSources.RunQuery();
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementVisible(ee._entityNameInExplorer("public.vessels"));
@ -276,7 +275,7 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
WHERE "ship_id" = {{data_table.selectedRow.ship_id}};`;
ee.SelectEntityByName("UpdateQuery", "QUERIES/JS");
agHelper.EnterValue(updateQuery);
dataSources.EnterQuery(updateQuery);
agHelper.AssertAutoSave();
ee.ExpandCollapseEntity("QUERIES/JS", false);
});
@ -518,7 +517,7 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
);`;
ee.SelectEntityByName("InsertQuery", "QUERIES/JS");
agHelper.EnterValue(insertQuery);
dataSources.EnterQuery(insertQuery);
agHelper.AssertAutoSave();
ee.ExpandCollapseEntity("QUERIES/JS", false);
});
@ -688,12 +687,13 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("DropVessels");
agHelper.EnterValue(deleteTblQuery);
dataSources.EnterQuery(deleteTblQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);
dataSources.RunQuery();
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementAbsence(ee._entityNameInExplorer("public.vessels"));
@ -704,7 +704,7 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => {
dataSources.NavigateFromActiveDS(dsName, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("DropVessels");
agHelper.EnterValue(deleteTblQuery);
dataSources.EnterQuery(deleteTblQuery);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);

View File

@ -50,7 +50,7 @@ describe("JSObjects OnLoad Actions tests", function() {
agHelper.RenameWithInPane("GetUser");
cy.get("@jsObjName").then((jsObjName) => {
jsName = jsObjName;
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{" +
jsObjName +
".getId.data}}",
@ -418,7 +418,7 @@ describe("JSObjects OnLoad Actions tests", function() {
dataSources.NavigateFromActiveDS(guid, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("getCitiesList");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT distinct city FROM public.city order by city ASC",
);
@ -460,7 +460,7 @@ describe("JSObjects OnLoad Actions tests", function() {
// dataSources.NavigateToActiveDSQueryPane(guid);
// agHelper.GetNClick(dataSources._templateMenu);
// agHelper.RenameWithInPane("getCountry");
// agHelper.EnterValue(
// dataSources.EnterQuery(
// "SELECT country FROM public.city as City join public.country Country on City.country_id=Country.country_id where City.city = {{" +
// jsObjName +
// ".getSelectedCity()}}",

View File

@ -31,7 +31,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
dataSources.NavigateFromActiveDS(guid, true);
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("ParamsTest");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{this?.params?.condition || '1=1'}} order by id",
);
jsEditor.CreateJSObject(
@ -73,7 +73,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("2. With Optional chaining : {{ (function() { return this?.params?.condition })() }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(function() { return this?.params?.condition })() || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -88,7 +88,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("3. With Optional chaining : {{ (() => { return this?.params?.condition })() }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(() => { return this?.params?.condition })() || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -103,7 +103,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("4. With Optional chaining : {{ this?.params.condition }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{this?.params.condition || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -118,7 +118,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("5. With Optional chaining : {{ (function() { return this?.params.condition })() }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(function() { return this?.params.condition })() || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -133,7 +133,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("6. With Optional chaining : {{ (() => { return this?.params.condition })() }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(() => { return this?.params.condition })() || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -148,7 +148,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("7. With No Optional chaining : {{ this.params.condition }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{this.params.condition || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -163,7 +163,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("8. With No Optional chaining : {{ (function() { return this.params.condition })() }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(function() { return this.params.condition })() || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -178,7 +178,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("9. With No Optional chaining : {{ (() => { return this.params.condition })() }}", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(() => { return this.params.condition })() || '1=1'}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));
@ -193,7 +193,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("10. With Optional chaining : {{ this.params.condition }} && direct paramter passed", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(() => { return this.params.condition })() || '7'}} order by id",
);
@ -212,7 +212,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
it("11. With Optional chaining : {{ this.params.condition }} && no optional paramter passed", function() {
ee.SelectEntityByName("ParamsTest", "QUERIES/JS");
agHelper.EnterValue(
dataSources.EnterQuery(
"SELECT * FROM public.users where id = {{(() => { return this.params.condition })()}} order by id",
);
deployMode.DeployApp(locator._spanButton("Submit"));

View File

@ -44,7 +44,6 @@ describe("Validate Mongo Query Pane Validations", () => {
});
agHelper.ValidateNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.WaitUntilToastDisappear("datasource updated successfully");
agHelper.GetNClick(dataSources._selectTableDropdown);
agHelper.GetNClickByContains(dataSources._dropdownOption, "friends");
@ -643,15 +642,16 @@ describe("Validate Mongo Query Pane Validations", () => {
dataSources.NavigateFromActiveDS(dsName, true);
dataSources.ValidateNSelectDropdown("Commands", "Find Document(s)", "Raw");
agHelper.RenameWithInPane("DropAuthorNAwards"); //Due to template appearing after renaming
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("DropAuthorNAwards");
agHelper.EnterValue(dropCollection);
dataSources.EnterQuery(dropCollection);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);
dataSources.RunQuery();
agHelper.ActionContextMenuWithInPane("Delete");
ee.ExpandCollapseEntity("DATASOURCES");
ee.ExpandCollapseEntity(dsName);
ee.ActionContextMenuByEntityName(dsName, "Refresh");
agHelper.AssertElementAbsence(ee._entityNameInExplorer("AuthorNAwards"));
@ -663,7 +663,7 @@ describe("Validate Mongo Query Pane Validations", () => {
dataSources.ValidateNSelectDropdown("Commands", "Find Document(s)", "Raw");
agHelper.GetNClick(dataSources._templateMenu);
agHelper.RenameWithInPane("DropAuthorNAwards");
agHelper.EnterValue(dropCollection);
dataSources.EnterQuery(dropCollection);
cy.get(".CodeMirror textarea").focus();
//agHelper.VerifyEvaluatedValue(tableCreateQuery);

View File

@ -68,12 +68,13 @@ describe("Validate MySQL query UI flows - Bug 14054", () => {
});
it("4. Verify Deletion of the datasource", () => {
ee.ActionContextMenuByEntityName(dsName, "Delete", "Are you sure?")
ee.SelectEntityByName(dsName, "DATASOURCES");
ee.ActionContextMenuByEntityName(dsName, "Delete", "Are you sure?");
agHelper.ValidateNetworkStatus("@deleteDatasource", 200);
});
function runQueryNValidate(query: string, columnHeaders: string[]) {
agHelper.EnterValue(query);
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.AssertQueryResponseHeaders(columnHeaders);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -59,8 +59,10 @@ Cypress.Commands.add("CreateAPI", (apiname) => {
cy.get(explorer.blankAPI).click({ force: true });
cy.wait("@createNewApi");
cy.get(apiwidget.resourceUrl).should("be.visible");
cy.renameWithInPane(apiname);
cy.WaitAutoSave();
if (apiname) {
cy.renameWithInPane(apiname);
cy.WaitAutoSave();
}
// Added because api name edit takes some time to
// reflect in api sidebar after the call passes.
// eslint-disable-next-line cypress/no-unnecessary-waiting

View File

@ -76,4 +76,5 @@ export class CommonLocators {
_deleteIcon = "button .bp3-icon-delete"
_datePickerValue = "div[data-testid='datepicker-container'] input"
_switchToggle = (switchName: string) => "//div[contains(@class, 't--switch-widget-label')][text()='"+switchName+"']/parent::label/span"
_jsonToggle = (fieldName: string) => `//p[text()='${fieldName}']/parent::div//following-sibling::div//input[@type='checkbox']`;
}

View File

@ -139,7 +139,11 @@ export class AggregateHelper {
});
}
public WaitUntilToastDisappear(msgToCheckforDisappearance: string | "", index = 0 , length = 1) {
public WaitUntilToastDisappear(
msgToCheckforDisappearance: string | "",
index = 0,
length = 1,
) {
this.ValidateToastMessage(msgToCheckforDisappearance, index, length);
cy.waitUntil(() => cy.get(this.locator._toastMsg), {
errorMsg: msgToCheckforDisappearance + " did not disappear",
@ -444,8 +448,11 @@ export class AggregateHelper {
public ToggleSwitch(
switchName: string,
toggle: "check" | "uncheck" = "check",
jsonSwitch = false,
) {
const locator = cy.xpath(this.locator._switchToggle(switchName));
const locator = jsonSwitch
? cy.xpath(this.locator._jsonToggle(switchName))
: cy.xpath(this.locator._switchToggle(switchName));
const parentLoc = locator.parent("label");
if (toggle == "check")
parentLoc.then(($parent) => {
@ -551,10 +558,6 @@ export class AggregateHelper {
this.UpdateCodeInput($field, valueToEnter);
},
);
} else {
cy.get(this.locator._codeEditorTarget).then(($field: any) => {
this.UpdateCodeInput($field, valueToEnter);
});
}
this.AssertAutoSave();
}

View File

@ -225,6 +225,7 @@ export class DataSources {
public SaveDatasource() {
cy.get(this._saveDs).click();
this.agHelper.ValidateNetworkStatus("@saveDatasource", 200);
this.agHelper.WaitUntilToastDisappear("datasource updated successfully");
// cy.wait("@saveDatasource")
// .then((xhr) => {
@ -274,8 +275,10 @@ export class DataSources {
? this._createQuery
: this._datasourceCardGeneratePageBtn;
this.ee.SelectEntityByName(datasourceName, "DATASOURCES");
this.ee.ExpandCollapseEntity(datasourceName, false);
this.ee.NavigateToSwitcher("explorer");
this.ee.ExpandCollapseEntity("DATASOURCES", false);
//this.ee.SelectEntityByName(datasourceName, "DATASOURCES");
//this.ee.ExpandCollapseEntity(datasourceName, false);
this.NavigateToDSCreateNew();
this.agHelper.GetNClick(this._activeTab);
cy.get(this._datasourceCard)
@ -289,11 +292,6 @@ export class DataSources {
this.agHelper.Sleep(2000); //for the CreateQuery/GeneratePage page to load
}
public NavigateToActiveDSviaEntityExplorer(datasourceName: string) {
this.ee.SelectEntityByName(datasourceName, "DATASOURCES");
cy.get(this._createQuery).click({ force: true });
}
public ValidateNSelectDropdown(
ddTitle: string,
currentValue = "",
@ -382,4 +380,11 @@ export class DataSources {
this.agHelper.AssertAutoSave();
}
public EnterQuery(query: string) {
cy.get(this.locator._codeEditorTarget).then(($field: any) => {
this.agHelper.UpdateCodeInput($field, query);
});
this.agHelper.AssertAutoSave();
}
}

View File

@ -13,7 +13,11 @@ export class DeployMode {
_jsonFormDatepickerFieldByName = (fieldName: string) =>
`//p[text()='${fieldName}']/ancestor::div[@direction='column']//div[@data-testid='datepicker-container']//input`;
_jsonSelectDropdown = "button.select-button";
private _jsonFormMultiSelectByName = (fieldName: string) =>
`//p[text()='${fieldName}']/ancestor::div[@direction='column']//div[@data-testid='multiselect-container']//div[contains(@class, 'rc-select-show-arrow')]`;
_clearDropdown = "button.select-button span.cancel-icon";
private _jsonFormMultiSelectOptions = (option: string) =>
`//div[@title='${option}']//input[@type='checkbox']/ancestor::div[@title='${option}']`;
//refering PublishtheApp from command.js
public DeployApp(
@ -90,7 +94,46 @@ export class DeployMode {
.eq(index)
.scrollIntoView()
.click();
cy.get(this.locator._selectOptionValue(dropdownOption)).click({ force: true });
cy.get(this.locator._selectOptionValue(dropdownOption)).click({
force: true,
});
this.agHelper.Sleep(); //for selected value to reflect!
}
public SelectJsonFormMultiSelect(
name: string,
options: string[],
index = 0,
check = true,
) {
cy.xpath(this._jsonFormMultiSelectByName(name))
.eq(index)
.scrollIntoView()
.click();
this.agHelper.Sleep(500);
if (check) {
options.forEach(($each) => {
cy.get(this.locator._multiSelectOptions($each))
.check({ force: true })
.wait(800);
cy.xpath(this._jsonFormMultiSelectOptions($each)).should(
"have.class",
"rc-select-item-option-selected",
);
});
} else {
options.forEach(($each) => {
cy.get(this.locator._multiSelectOptions($each))
.uncheck({ force: true })
.wait(800);
cy.xpath(this._jsonFormMultiSelectOptions($each)).should(
"not.have.class",
"rc-select-item-option-selected",
);
});
}
// //closing multiselect dropdown
cy.get("body").type("{esc}");
}
}

View File

@ -10,7 +10,7 @@ Cypress.Commands.add("borderMouseover", (index, text) => {
cy.get(themelocator.border)
.eq(index)
.trigger("mouseover");
cy.wait(2000);
cy.wait(1000);
cy.get(themelocator.popover).contains(text);
});
@ -18,7 +18,7 @@ Cypress.Commands.add("shadowMouseover", (index, text) => {
cy.xpath(themelocator.shadow)
.eq(index)
.trigger("mouseover");
cy.wait(2000);
cy.wait(1000);
cy.get(themelocator.popover).contains(text);
});