|
|
@ -5,212 +5,195 @@ import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; |
|
|
|
export const genTest = (apiType, dbType) => { |
|
|
|
export const genTest = (apiType, dbType) => { |
|
|
|
if (!isTestSuiteActive(apiType, dbType)) return; |
|
|
|
if (!isTestSuiteActive(apiType, dbType)) return; |
|
|
|
|
|
|
|
|
|
|
|
describe(`${apiType.toUpperCase()} api - Filter, Fields, Sort`, () => { |
|
|
|
describe(`${apiType.toUpperCase()} api - Grid operations`, () => { |
|
|
|
before(() => { |
|
|
|
// before(() => {
|
|
|
|
// loginPage.loginAndOpenProject(apiType, dbType);
|
|
|
|
// // loginPage.loginAndOpenProject(apiType, dbType);
|
|
|
|
|
|
|
|
//
|
|
|
|
// open country table
|
|
|
|
// // open country table
|
|
|
|
|
|
|
|
// cy.openTableTab("Country", 25);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// after(() => {
|
|
|
|
|
|
|
|
// cy.closeTableTab("Country");
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
afterEach(() => { |
|
|
|
|
|
|
|
cy.saveLocalStorage(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("Check country table - Pagination", () => { |
|
|
|
cy.openTableTab("Country", 25); |
|
|
|
cy.openTableTab("Country", 25); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.get(".nc-pagination").should("exist"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify > pagination option
|
|
|
|
|
|
|
|
mainPage.getPagination(">").click(); |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getPagination(2) |
|
|
|
|
|
|
|
.should("have.class", "ant-pagination-item-active"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify < pagination option
|
|
|
|
|
|
|
|
mainPage.getPagination("<").click(); |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getPagination(1) |
|
|
|
|
|
|
|
.should("have.class", "ant-pagination-item-active"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
after(() => { |
|
|
|
// create new row using + button in header
|
|
|
|
cy.closeTableTab("Country"); |
|
|
|
//
|
|
|
|
|
|
|
|
it("Add row using tool header button", () => { |
|
|
|
|
|
|
|
// add a row to end of Country table
|
|
|
|
|
|
|
|
cy.get(".nc-add-new-row-btn").click(); |
|
|
|
|
|
|
|
cy.wait(1000); |
|
|
|
|
|
|
|
cy.get(".nc-expand-col-Country").find(".nc-cell > input").first().type("Test Country"); |
|
|
|
|
|
|
|
cy.getActiveDrawer() |
|
|
|
|
|
|
|
.find(".ant-btn-primary") |
|
|
|
|
|
|
|
.contains("Save row") |
|
|
|
|
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cy.get("#data-table-form-Country > input")
|
|
|
|
|
|
|
|
// .first()
|
|
|
|
|
|
|
|
// .type("Test Country");
|
|
|
|
|
|
|
|
// cy.contains("Save row").filter("button").click();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.toastWait("updated successfully"); |
|
|
|
|
|
|
|
cy.getActiveDrawer() |
|
|
|
|
|
|
|
.find(".ant-btn") |
|
|
|
|
|
|
|
.contains("Cancel") |
|
|
|
|
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
mainPage.getPagination(5).click(); |
|
|
|
|
|
|
|
// kludge: flicker on load
|
|
|
|
|
|
|
|
cy.wait(3000) |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getCell("Country", 10) |
|
|
|
|
|
|
|
.contains("Test Country") |
|
|
|
|
|
|
|
.should("exist"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe(`Pagination`, () => { |
|
|
|
// delete single row
|
|
|
|
beforeEach(() => { |
|
|
|
//
|
|
|
|
}) |
|
|
|
it("Delete Row", () => { |
|
|
|
|
|
|
|
// delete row added in previous step
|
|
|
|
// check pagination
|
|
|
|
mainPage.getCell("Country", 10).rightclick(); |
|
|
|
it("Check country table - Pagination", () => { |
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click(); |
|
|
|
cy.get(".nc-pagination").should("exist"); |
|
|
|
|
|
|
|
|
|
|
|
// cy.toastWait('Deleted row successfully')
|
|
|
|
// verify > pagination option
|
|
|
|
|
|
|
|
mainPage.getPagination(">").click(); |
|
|
|
// verify
|
|
|
|
mainPage |
|
|
|
cy.get(`:nth-child(10) > [data-title="Country"]`).should("not.exist"); |
|
|
|
.getPagination(2) |
|
|
|
|
|
|
|
.should("have.class", "ant-pagination-item-active"); |
|
|
|
mainPage.getPagination(1).click(); |
|
|
|
|
|
|
|
|
|
|
|
// verify < pagination option
|
|
|
|
|
|
|
|
mainPage.getPagination("<").click(); |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getPagination(1) |
|
|
|
|
|
|
|
.should("have.class", "ant-pagination-item-active"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe(`Row operations`, () => { |
|
|
|
// create new row using right click menu option
|
|
|
|
beforeEach(() => { |
|
|
|
//
|
|
|
|
cy.fileHook(); |
|
|
|
it.skip("Add row using rightclick menu option", () => { |
|
|
|
}) |
|
|
|
// Temporary
|
|
|
|
|
|
|
|
mainPage.getPagination(5).click(); |
|
|
|
// create new row using + button in header
|
|
|
|
|
|
|
|
//
|
|
|
|
mainPage.getCell("Country", 9).rightclick({ force: true }); |
|
|
|
it("Add row using tool header button", () => { |
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu") |
|
|
|
// add a row to end of Country table
|
|
|
|
.contains("Insert New Row") |
|
|
|
cy.get(".nc-add-new-row-btn").click(); |
|
|
|
.click({ force: true }); |
|
|
|
cy.wait(1000); |
|
|
|
mainPage |
|
|
|
cy.get(".nc-expand-col-Country").find(".nc-cell > input").first().type("Test Country"); |
|
|
|
.getCell("Country", 10) |
|
|
|
cy.getActiveDrawer() |
|
|
|
.dblclick() |
|
|
|
.find(".ant-btn-primary") |
|
|
|
.find("input") |
|
|
|
.contains("Save row") |
|
|
|
.type("Test Country-1{enter}"); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 10).rightclick({ force: true }); |
|
|
|
// cy.get("#data-table-form-Country > input")
|
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu") |
|
|
|
// .first()
|
|
|
|
.contains("Insert New Row") |
|
|
|
// .type("Test Country");
|
|
|
|
.click({ force: true }); |
|
|
|
// cy.contains("Save row").filter("button").click();
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getCell("Country", 11) |
|
|
|
cy.toastWait("updated successfully"); |
|
|
|
.dblclick() |
|
|
|
cy.getActiveDrawer() |
|
|
|
.find("input") |
|
|
|
.find(".ant-btn") |
|
|
|
.type("Test Country-2{enter}"); |
|
|
|
.contains("Cancel") |
|
|
|
|
|
|
|
.click(); |
|
|
|
// GUI-v2 Kludge:
|
|
|
|
|
|
|
|
// to move cursor away from input field; enter key is not recognized
|
|
|
|
// verify
|
|
|
|
// mainPage.getCell("Country", 10).click()
|
|
|
|
mainPage.getPagination(5).click(); |
|
|
|
|
|
|
|
// kludge: flicker on load
|
|
|
|
// verify
|
|
|
|
cy.wait(3000) |
|
|
|
mainPage |
|
|
|
mainPage |
|
|
|
.getCell("Country", 10) |
|
|
|
.getCell("Country", 10) |
|
|
|
.contains("Test Country-1") |
|
|
|
.contains("Test Country") |
|
|
|
.should("exist"); |
|
|
|
.should("exist"); |
|
|
|
mainPage |
|
|
|
}); |
|
|
|
.getCell("Country", 11) |
|
|
|
|
|
|
|
.contains("Test Country-2") |
|
|
|
// delete single row
|
|
|
|
.should("exist"); |
|
|
|
//
|
|
|
|
|
|
|
|
it("Delete Row", () => { |
|
|
|
|
|
|
|
// delete row added in previous step
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 10).rightclick(); |
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cy.toastWait('Deleted row successfully')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
cy.get(`:nth-child(10) > [data-title="Country"]`).should("not.exist"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getPagination(1).click(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create new row using right click menu option
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
it.skip("Add row using rightclick menu option", () => { |
|
|
|
|
|
|
|
// Temporary
|
|
|
|
|
|
|
|
mainPage.getPagination(5).click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 9).rightclick({ force: true }); |
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu") |
|
|
|
|
|
|
|
.contains("Insert New Row") |
|
|
|
|
|
|
|
.click({ force: true }); |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getCell("Country", 10) |
|
|
|
|
|
|
|
.dblclick() |
|
|
|
|
|
|
|
.find("input") |
|
|
|
|
|
|
|
.type("Test Country-1{enter}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 10).rightclick({ force: true }); |
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu") |
|
|
|
|
|
|
|
.contains("Insert New Row") |
|
|
|
|
|
|
|
.click({ force: true }); |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getCell("Country", 11) |
|
|
|
|
|
|
|
.dblclick() |
|
|
|
|
|
|
|
.find("input") |
|
|
|
|
|
|
|
.type("Test Country-2{enter}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GUI-v2 Kludge:
|
|
|
|
|
|
|
|
// to move cursor away from input field; enter key is not recognized
|
|
|
|
|
|
|
|
// mainPage.getCell("Country", 10).click()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getCell("Country", 10) |
|
|
|
|
|
|
|
.contains("Test Country-1") |
|
|
|
|
|
|
|
.should("exist"); |
|
|
|
|
|
|
|
mainPage |
|
|
|
|
|
|
|
.getCell("Country", 11) |
|
|
|
|
|
|
|
.contains("Test Country-2") |
|
|
|
|
|
|
|
.should("exist"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete selected rows (multiple)
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
it.skip("Delete Selected", () => { |
|
|
|
|
|
|
|
cy.get(".ant-checkbox").should('exist') |
|
|
|
|
|
|
|
.eq(10).click({ force: true }); |
|
|
|
|
|
|
|
cy.get(".ant-checkbox").should('exist') |
|
|
|
|
|
|
|
.eq(11).click({ force: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 10).rightclick({ force: true }); |
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu") |
|
|
|
|
|
|
|
.contains("Delete Selected Rows") |
|
|
|
|
|
|
|
.click({ force: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
// mainPage.getCell("Country", 10).should("not.exist");
|
|
|
|
|
|
|
|
// mainPage.getCell("Country", 11).should("not.exist");
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
|
|
|
`:nth-child(10) > [data-title="Country"]` |
|
|
|
|
|
|
|
).should("not.exist"); |
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
|
|
|
`:nth-child(11) > [data-title="Country"]` |
|
|
|
|
|
|
|
).should("not.exist"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getPagination(1).click(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe(`Sort operations`, () => { |
|
|
|
// delete selected rows (multiple)
|
|
|
|
beforeEach(() => { |
|
|
|
//
|
|
|
|
cy.fileHook(); |
|
|
|
it.skip("Delete Selected", () => { |
|
|
|
}) |
|
|
|
cy.get(".ant-checkbox").should('exist') |
|
|
|
|
|
|
|
.eq(10).click({ force: true }); |
|
|
|
|
|
|
|
cy.get(".ant-checkbox").should('exist') |
|
|
|
|
|
|
|
.eq(11).click({ force: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 10).rightclick({ force: true }); |
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-grid-context-menu") |
|
|
|
|
|
|
|
.contains("Delete Selected Rows") |
|
|
|
|
|
|
|
.click({ force: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
// mainPage.getCell("Country", 10).should("not.exist");
|
|
|
|
|
|
|
|
// mainPage.getCell("Country", 11).should("not.exist");
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
|
|
|
`:nth-child(10) > [data-title="Country"]` |
|
|
|
|
|
|
|
).should("not.exist"); |
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
|
|
|
`:nth-child(11) > [data-title="Country"]` |
|
|
|
|
|
|
|
).should("not.exist"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainPage.getPagination(1).click(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("Enable sort", () => { |
|
|
|
|
|
|
|
mainPage.sortField("Country", "Z → A"); |
|
|
|
|
|
|
|
cy.contains("Zambia").should("exist"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("Disable sort", () => { |
|
|
|
it("Enable sort", () => { |
|
|
|
mainPage.clearSort(); |
|
|
|
mainPage.sortField("Country", "Z → A"); |
|
|
|
cy.contains("Zambia").should("not.exist"); |
|
|
|
cy.contains("Zambia").should("exist"); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe("Field Operation", () => { |
|
|
|
it("Disable sort", () => { |
|
|
|
beforeEach(() => { |
|
|
|
mainPage.clearSort(); |
|
|
|
cy.fileHook(); |
|
|
|
cy.contains("Zambia").should("not.exist"); |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("Hide field", () => { |
|
|
|
it("Hide field", () => { |
|
|
|
mainPage.hideField("LastUpdate"); |
|
|
|
mainPage.hideField("LastUpdate"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("Show field", () => { |
|
|
|
it("Show field", () => { |
|
|
|
mainPage.unhideField("LastUpdate"); |
|
|
|
mainPage.unhideField("LastUpdate"); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe("Filter operations", () => { |
|
|
|
it("Create Filter", () => { |
|
|
|
beforeEach(() => { |
|
|
|
mainPage.filterField("Country", "is equal", "India"); |
|
|
|
cy.fileHook(); |
|
|
|
// cy.get("td:contains(India)").should("exist");
|
|
|
|
}) |
|
|
|
mainPage.getCell("Country", 1) |
|
|
|
|
|
|
|
.contains("India") |
|
|
|
it("Create Filter", () => { |
|
|
|
.should("exist"); |
|
|
|
mainPage.filterField("Country", "is equal", "India"); |
|
|
|
}); |
|
|
|
// cy.get("td:contains(India)").should("exist");
|
|
|
|
|
|
|
|
mainPage.getCell("Country", 1) |
|
|
|
it("Delete Filter", () => { |
|
|
|
.contains("India") |
|
|
|
// remove sort and check
|
|
|
|
.should("exist"); |
|
|
|
mainPage.filterReset(); |
|
|
|
}); |
|
|
|
mainPage.getCell("Country", 1) |
|
|
|
|
|
|
|
.contains("India") |
|
|
|
it("Delete Filter", () => { |
|
|
|
.should("not.exist"); |
|
|
|
// remove sort and check
|
|
|
|
// cy.contains("td:contains(India)").should("not.exist");
|
|
|
|
mainPage.filterReset(); |
|
|
|
|
|
|
|
mainPage.getCell("Country", 1) |
|
|
|
cy.closeTableTab("Country"); |
|
|
|
.contains("India") |
|
|
|
|
|
|
|
.should("not.exist"); |
|
|
|
|
|
|
|
// cy.contains("td:contains(India)").should("not.exist");
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|