Browse Source

test: stability for table ops

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3655/head
Raju Udava 2 years ago
parent
commit
3c0cd1928f
  1. 390
      scripts/cypress/integration/common/1b_table_column_operations.js
  2. 849
      scripts/cypress/integration/common/4f_grid_view_share.js

390
scripts/cypress/integration/common/1b_table_column_operations.js

@ -1,201 +1,207 @@
import { mainPage } from "../../support/page_objects/mainPage"; import { mainPage } from "../../support/page_objects/mainPage";
import { import {
isTestSuiteActive, isTestSuiteActive,
isXcdb, isXcdb,
} from "../../support/page_objects/projectConstants"; } 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;
function addNewRow(index, cellValue) { function addNewRow(index, cellValue) {
cy.get(".nc-add-new-row-btn:visible").should("exist"); cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
// cy.get("#data-table-form-Title > input").first().type(cellValue); // cy.get("#data-table-form-Title > input").first().type(cellValue);
cy.get(".nc-expand-col-Title").find(".nc-cell > input") cy.get(".nc-expand-col-Title")
.should("exist") .find(".nc-cell > input")
.first() .should("exist")
.clear() .first()
.type(cellValue); .clear()
.type(cellValue);
cy.getActiveDrawer()
.find("button") cy.getActiveDrawer()
.contains("Save row") .find("button")
.click({ force: true }); .contains("Save row")
.click({ force: true });
cy.toastWait("updated successfully");
cy.get("body").type("{esc}"); cy.toastWait("updated successfully");
mainPage.getCell("Title", index).contains(cellValue).should("exist"); cy.get("body").type("{esc}");
} mainPage.getCell("Title", index).contains(cellValue).should("exist");
}
describe(`${apiType.toUpperCase()} api - Table Column`, () => {
const name = "tablex"; describe(`${apiType.toUpperCase()} api - Table Column`, () => {
const colName = "column_name_a"; const name = "tablex";
const updatedColName = "updated_column_name"; const colName = "column_name_a";
const randVal = "Test@1234.com"; const updatedColName = "updated_column_name";
const updatedRandVal = "Updated@1234.com"; const randVal = "Test@1234.com";
const updatedRandVal = "Updated@1234.com";
// before(() => {
// cy.restoreLocalStorage(); // before(() => {
// cy.createTable(name); // cy.restoreLocalStorage();
// }) // cy.createTable(name);
// })
beforeEach(() => {
cy.restoreLocalStorage(); beforeEach(() => {
}) cy.restoreLocalStorage();
afterEach(() => {
cy.saveLocalStorage();
})
// // delete table
// after(() => {
// cy.deleteTable(name, dbType);
// });
it("Create Table Column", () => {
cy.createTable(name);
mainPage.addColumn(colName, name);
});
// edit the newly created column
it("Edit table column - change datatype", () => {
if (!isXcdb()) {
cy.get(`th:contains(${colName}) .nc-icon.ant-dropdown-trigger`)
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// change column type and verify
// cy.get(".nc-column-type-input").last().click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".nc-column-type-input")
.last()
.click();
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("LongText")
.click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated");
}
});
// edit the newly created column
it("Edit table column - rename", () => {
cy.get(`th:contains(${colName}) .nc-icon.ant-dropdown-trigger`)
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// rename column and verify
cy.getActiveMenu(".nc-dropdown-edit-column").find('input.nc-column-name-input', { timeout: 3000 })
.should('exist')
.clear()
.type(updatedColName);
// cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated");
cy.get(`th:contains(${colName})`).should("not.exist");
cy.get(`th:contains(${updatedColName})`).should("exist");
});
// delete the newly created column
it("Delete table column", () => {
mainPage.deleteColumn(updatedColName);
});
it("Add new row", () => {
addNewRow(1, randVal);
});
it("Update row", () => {
mainPage
.getRow(1)
.find('.nc-row-no').should('exist').eq(0).trigger('mouseover', { force: true })
cy.get(".nc-row-expand")
.click({ force: true });
cy.get(".nc-expand-col-Title").find(".nc-cell > input")
.should("exist")
.first()
.clear()
.type(updatedRandVal);
cy.getActiveDrawer()
.find("button")
.contains("Save row")
.click({ force: true });
// partial toast message
cy.toastWait("updated successfully");
cy.get("body").type("{esc}");
mainPage.getCell("Title", 1).contains(randVal).should("not.exist");
mainPage
.getCell("Title", 1)
.contains(updatedRandVal)
.should("exist");
});
it("Delete Row", () => {
mainPage
.getCell("Title", 1)
.contains(updatedRandVal)
.rightclick({ force: true });
// delete row
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.find('.ant-dropdown-menu-item:contains("Delete Row")')
.first()
.click({ force: true });
cy.get("td").contains(randVal).should("not.exist");
});
it("Select all row check-box validation", () => {
// add multiple rows
addNewRow(1, "a1");
addNewRow(2, "a2");
addNewRow(3, "a3");
addNewRow(4, "a4");
addNewRow(5, "a5");
cy.get('.nc-no-label').should('exist').eq(0).trigger('mouseover', { force: true })
cy.get(".ant-checkbox").should('exist')
.eq(0).click({ force: true });
// delete selected rows
mainPage.getCell("Title", 3).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Selected Rows")
.click({ force: true });
// verify if everything is wiped off
mainPage.getCell("Title", 1).contains("a1").should("not.exist");
// clean-up
cy.deleteTable(name, dbType);
});
}); });
afterEach(() => {
cy.saveLocalStorage();
});
// // delete table
// after(() => {
// cy.deleteTable(name, dbType);
// });
it("Create Table Column", () => {
cy.createTable(name);
mainPage.addColumn(colName, name);
});
// edit the newly created column
it("Edit table column - change datatype", () => {
if (!isXcdb()) {
cy.get(`th:contains(${colName}) .nc-icon.ant-dropdown-trigger`)
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// fix me! wait till the modal rendering (input highlight) is completed
cy.wait(1000);
// change column type and verify
// cy.get(".nc-column-type-input").last().click();
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".nc-column-type-input")
.last()
.click();
cy.getActiveSelection(".nc-dropdown-column-type")
.find(".ant-select-item-option")
.contains("LongText")
.click();
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated");
}
});
// edit the newly created column
it("Edit table column - rename", () => {
cy.get(`th:contains(${colName}) .nc-icon.ant-dropdown-trigger`)
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// rename column and verify
cy.getActiveMenu(".nc-dropdown-edit-column")
.find("input.nc-column-name-input", { timeout: 3000 })
.should("exist")
.clear()
.type(updatedColName);
// cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated");
cy.get(`th:contains(${colName})`).should("not.exist");
cy.get(`th:contains(${updatedColName})`).should("exist");
});
// delete the newly created column
it("Delete table column", () => {
mainPage.deleteColumn(updatedColName);
});
it("Add new row", () => {
addNewRow(1, randVal);
});
it("Update row", () => {
mainPage
.getRow(1)
.find(".nc-row-no")
.should("exist")
.eq(0)
.trigger("mouseover", { force: true });
cy.get(".nc-row-expand").click({ force: true });
cy.get(".nc-expand-col-Title")
.find(".nc-cell > input")
.should("exist")
.first()
.clear()
.type(updatedRandVal);
cy.getActiveDrawer()
.find("button")
.contains("Save row")
.click({ force: true });
// partial toast message
cy.toastWait("updated successfully");
cy.get("body").type("{esc}");
mainPage.getCell("Title", 1).contains(randVal).should("not.exist");
mainPage.getCell("Title", 1).contains(updatedRandVal).should("exist");
});
it("Delete Row", () => {
mainPage
.getCell("Title", 1)
.contains(updatedRandVal)
.rightclick({ force: true });
// delete row
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.find('.ant-dropdown-menu-item:contains("Delete Row")')
.first()
.click({ force: true });
cy.get("td").contains(randVal).should("not.exist");
});
it("Select all row check-box validation", () => {
// add multiple rows
addNewRow(1, "a1");
addNewRow(2, "a2");
addNewRow(3, "a3");
addNewRow(4, "a4");
addNewRow(5, "a5");
cy.get(".nc-no-label")
.should("exist")
.eq(0)
.trigger("mouseover", { force: true });
cy.get(".ant-checkbox").should("exist").eq(0).click({ force: true });
// delete selected rows
mainPage.getCell("Title", 3).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Selected Rows")
.click({ force: true });
// verify if everything is wiped off
mainPage.getCell("Title", 1).contains("a1").should("not.exist");
// clean-up
cy.deleteTable(name, dbType);
});
});
}; };
/** /**

849
scripts/cypress/integration/common/4f_grid_view_share.js

@ -1,6 +1,6 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage"; import { mainPage } from "../../support/page_objects/mainPage";
import {loginPage} from "../../support/page_objects/navigation"; import { loginPage } from "../../support/page_objects/navigation";
let storedURL = ""; let storedURL = "";
@ -13,452 +13,445 @@ let storedURL = "";
let viewURL = {}; let viewURL = {};
export const genTest = (apiType, dbType) => { export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
const generateViewLink = (viewName) => { const generateViewLink = (viewName) => {
mainPage.shareView().click(); mainPage.shareView().click();
cy.wait(1000); cy.wait(1000);
// wait, as URL initially will be /undefined // wait, as URL initially will be /undefined
cy.getActiveModal(".nc-modal-share-view") cy.getActiveModal(".nc-modal-share-view")
.find(".share-link-box") .find(".share-link-box")
.contains("/nc/view/", { timeout: 10000 }) .contains("/nc/view/", { timeout: 10000 })
.should("exist"); .should("exist");
// copy link text, visit URL // copy link text, visit URL
cy.getActiveModal(".nc-modal-share-view") cy.getActiveModal(".nc-modal-share-view")
.find(".share-link-box") .find(".share-link-box")
.contains("/nc/view/", { timeout: 10000 }) .contains("/nc/view/", { timeout: 10000 })
.then(($obj) => { .then(($obj) => {
cy.get("body").type("{esc}"); cy.get("body").type("{esc}");
// viewURL.push($obj.text()) // viewURL.push($obj.text())
viewURL[viewName] = $obj.text().trim(); viewURL[viewName] = $obj.text().trim();
}); });
}; };
describe(`${apiType.toUpperCase()} api - GRID view (Share)`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.restoreLocalStorage();
cy.openTableTab("Address", 25);
});
describe(`${apiType.toUpperCase()} api - GRID view (Share)`, () => { beforeEach(() => {
// Run once before test- create project (rest/graphql) cy.restoreLocalStorage();
// });
before(() => {
cy.restoreLocalStorage();
cy.openTableTab("Address", 25);
});
beforeEach(() => { afterEach(() => {
cy.restoreLocalStorage(); cy.saveLocalStorage();
}); });
afterEach(() => { after(() => {
cy.saveLocalStorage(); // close table
}); // mainPage.deleteCreatedViews()
cy.restoreLocalStorage();
cy.closeTableTab("Address");
cy.saveLocalStorage();
});
after(() => { // Common routine to create/edit/delete GRID & GALLERY view
// close table // Input: viewType - 'grid'/'gallery'
// mainPage.deleteCreatedViews() //
cy.restoreLocalStorage(); const viewTest = (viewType) => {
cy.closeTableTab("Address"); it(`Create ${viewType.toUpperCase()} view`, () => {
cy.saveLocalStorage(); // create a normal public view
cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal(".nc-modal-view-create")
.find("button:contains(Submit)")
.click();
cy.toastWait("View created successfully");
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
});
});
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => {
cy.intercept("/api/v1/db/meta/audits/comments/*").as("waitForPageLoad");
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Grid-1")
.click();
mainPage.hideField("Address2");
mainPage.sortField("District", "Z → A");
mainPage.filterField("Address", "is like", "Ab");
generateViewLink("combined");
cy.log(viewURL["combined"]);
cy.wait(["@waitForPageLoad"]);
});
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => {
// generate view link multiple times
generateViewLink("combined");
generateViewLink("combined");
// verify if only one link exists in table
mainPage.shareViewList().click();
cy.get('th:contains("View Link")').should("exist");
cy.get('th:contains("View Link")')
.parent()
.parent()
.next()
.find("tr")
.its("length")
.should("eq", 1)
.then(() => {
cy.get("button.ant-modal-close:visible").click();
});
cy.signOut();
});
it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => {
// visit public view
cy.visit(viewURL["combined"], {
baseUrl: null,
}); });
cy.wait(5000);
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 18);
// verify title
cy.get(".nc-shared-view-title").contains("Grid-1").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields hidden/open`, () => {
// verify column headers
cy.get('[data-title="Address"]').should("exist");
cy.get('[data-title="Address2"]').should("not.exist");
cy.get('[data-title="District"]').should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields sort/ filter`, () => {
// country column content verification before sort
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
mainPage.getCell("District", 2).contains("Tutuila").should("exist");
mainPage.getCell("District", 3).contains("Tamil Nadu").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV`, () => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Customer List,Staff List,City,Staff List`,
`1013 Tabuk Boulevard,West Bengali,96203,158399646978,[object Object],2,,Kanchrapara,`,
`1892 Nabereznyje Telny Lane,Tutuila,28396,478229987054,[object Object],2,,Tafuna,`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`,
];
for (let i = 0; i < storedRecords.length; i++) {
let strCol = storedRecords[i].split(",");
let retCol = retrievedRecords[i].split(",");
for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j]);
}
}
};
// Common routine to create/edit/delete GRID & GALLERY view // download & verify
// Input: viewType - 'grid'/'gallery' mainPage.downloadAndVerifyCsvFromSharedView(
// `Address_exported_1.csv`,
const viewTest = (viewType) => { verifyCsv
it(`Create ${viewType.toUpperCase()} view`, () => { );
mainPage.unhideField("LastUpdate");
// create a normal public view });
cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal(".nc-modal-view-create").find("button:contains(Submit)").click(); it(`Share ${viewType.toUpperCase()} view : Disable sort`, () => {
cy.toastWait("View created successfully"); // remove sort and validate
mainPage.clearSort();
// store base URL- to re-visit and delete form view later mainPage
cy.url().then((url) => { .getCell("District", 1)
storedURL = url; .contains("West Bengali")
}); .should("exist");
}); });
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => { it(`Share ${viewType.toUpperCase()} view : Enable sort`, () => {
// Sort menu operations (Country Column, Z → A)
cy.get(`.nc-view-item.nc-${viewType}-view-item`) mainPage.sortField("District", "Z → A");
.contains("Grid-1") mainPage
.click(); .getCell("District", 1)
mainPage.hideField("Address2"); .contains("West Bengali")
mainPage.sortField("District", "Z → A"); .should("exist");
mainPage.filterField("Address", "is like", "Ab"); });
generateViewLink("combined");
cy.log(viewURL["combined"]); it(`Share ${viewType.toUpperCase()} view : Create Filter`, () => {
}); // add filter & validate
mainPage.filterField("District", "is like", "Tamil");
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => { // wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 2);
// generate view link multiple times mainPage.getCell("District", 1).contains("Tamil").should("exist");
generateViewLink("combined"); });
generateViewLink("combined");
it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => {
// verify if only one link exists in table mainPage.hideField("LastUpdate");
mainPage.shareViewList().click(); const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
cy.get('th:contains("View Link")').should("exist"); let storedRecords = [
`Address,District,PostalCode,Phone,Location,Customer List,Staff List,City,Staff List`,
cy.get('th:contains("View Link")') `1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
.parent() `1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`,
.parent() ];
.next()
.find("tr") // for (let i = 0; i < storedRecords.length; i++) {
.its("length") // expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
.should("eq", 1) // }
.then(() => {
cy.get('button.ant-modal-close:visible').click(); // ncv2@fixme
}); // for (let i = 0; i < storedRecords.length; i++) {
// let strCol = storedRecords[i].split(",");
cy.signOut(); // let retCol = retrievedRecords[i].split(",");
}); // for (let j = 0; j < 4; j++) {
// expect(strCol[j]).to.be.equal(retCol[j]);
it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => { // }
// visit public view // }
cy.visit(viewURL["combined"], {
baseUrl: null,
});
cy.wait(5000);
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 18);
// verify title
cy.get(".nc-shared-view-title").contains("Grid-1").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields hidden/open`, () => {
// verify column headers
cy.get('[data-title="Address"]').should("exist");
cy.get('[data-title="Address2"]').should("not.exist");
cy.get('[data-title="District"]').should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields sort/ filter`, () => {
// country column content verification before sort
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
mainPage
.getCell("District", 2)
.contains("Tutuila")
.should("exist");
mainPage
.getCell("District", 3)
.contains("Tamil Nadu")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV`, () => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Customer List,Staff List,City,Staff List`,
`1013 Tabuk Boulevard,West Bengali,96203,158399646978,[object Object],2,,Kanchrapara,`,
`1892 Nabereznyje Telny Lane,Tutuila,28396,478229987054,[object Object],2,,Tafuna,`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`,
];
for (let i = 0; i < storedRecords.length; i++) {
let strCol = storedRecords[i].split(",");
let retCol = retrievedRecords[i].split(",");
for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j]);
}
}
};
// download & verify
mainPage.downloadAndVerifyCsvFromSharedView(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
it(`Share ${viewType.toUpperCase()} view : Disable sort`, () => {
// remove sort and validate
mainPage.clearSort();
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : Enable sort`, () => {
// Sort menu operations (Country Column, Z → A)
mainPage.sortField("District", "Z → A");
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : Create Filter`, () => {
// add filter & validate
mainPage.filterField("District", "is like", "Tamil");
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 2);
mainPage
.getCell("District", 1)
.contains("Tamil")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Customer List,Staff List,City,Staff List`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`,
];
// for (let i = 0; i < storedRecords.length; i++) {
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
// }
// ncv2@fixme
// for (let i = 0; i < storedRecords.length; i++) {
// let strCol = storedRecords[i].split(",");
// let retCol = retrievedRecords[i].split(",");
// for (let j = 0; j < 4; j++) {
// expect(strCol[j]).to.be.equal(retCol[j]);
// }
// }
};
mainPage.downloadAndVerifyCsvFromSharedView(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
it(`Share ${viewType.toUpperCase()} view : Delete Filter`, () => {
// Remove sort and Validate
mainPage.filterReset();
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
});
it(`Share GRID view : Virtual column validation > has many`, () => {
// verify column headers
cy.get('[data-title="Customer List"]').should("exist");
cy.get('[data-title="Staff List"]').should("exist");
cy.get('[data-title="City"]').should("exist");
cy.get('[data-title="Staff List"]').should("exist");
// has many field validation
mainPage
.getCell("Customer List", 3)
.click()
.find(".nc-icon.nc-unlink-icon")
.should("not.exist");
mainPage
.getCell("Customer List", 3)
.click()
.find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist");
// mainPage
// .getCell("Customer List", 3)
// .click()
// .find(".nc-icon.nc-action-icon.nc-arrow-expand")
// .click({ force: true });
//
// // reload button
// cy.getActiveModal().find(".nc-icon").should("exist");
// cy.getActiveModal()
// .find("button")
// .contains("Link to")
// .should("not.exist");
// cy.getActiveModal()
// .find(".ant-card")
// .contains("2")
// .should("exist");
// cy.getActiveModal()
// .find(".ant-card")
// .find("button")
// .should("not.exist");
// cy.get('button.ant-modal-close').click();
});
it(`Share GRID view : Virtual column validation > belongs to`, () => {
// belongs to field validation
mainPage
.getCell("City", 1)
.click()
.find(".nc-icon.nc-unlink-icon")
.should("not.exist");
mainPage
.getCell("City", 1)
.click()
.find(".nc-icon.nc-action-icon.nc-arrow-expand")
.should("not.exist");
mainPage
.getCell("City", 1)
.find(".chips")
.contains("Kanchrapara")
.should("exist");
});
it(`Share GRID view : Virtual column validation > many to many`, () => {
// many-to-many field validation
mainPage
.getCell("Staff List", 1)
.click()
.find(".nc-icon.nc-unlink-icon")
.should("not.exist");
mainPage
.getCell("Staff List", 1)
.click()
.find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist");
mainPage
.getCell("Staff List", 1)
.click()
.find(".nc-icon.nc-action-icon.nc-arrow-expand")
.click({ force: true });
// // reload button
// Fix me : ncv2@fixme
// cy.getActiveModal().find(".nc-icon").should("exist");
// cy.getActiveModal()
// .find("button")
// .contains("Link to")
// .should("not.exist");
// cy.get('button.ant-modal-close:visible').last().click();
});
it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Address", 25);
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
cy.get(".nc-view-delete-icon").eq(0).click({ force: true });
cy.getActiveModal(".nc-modal-view-delete").find(".ant-btn-dangerous").click();
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
cy.get(".nc-view-item").its("length").should("eq", 1);
});
}; };
mainPage.downloadAndVerifyCsvFromSharedView(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
it(`Share ${viewType.toUpperCase()} view : Delete Filter`, () => {
// Remove sort and Validate
mainPage.filterReset();
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
});
it(`Share GRID view : Virtual column validation > has many`, () => {
// verify column headers
cy.get('[data-title="Customer List"]').should("exist");
cy.get('[data-title="Staff List"]').should("exist");
cy.get('[data-title="City"]').should("exist");
cy.get('[data-title="Staff List"]').should("exist");
// has many field validation
mainPage
.getCell("Customer List", 3)
.click()
.find(".nc-icon.nc-unlink-icon")
.should("not.exist");
mainPage
.getCell("Customer List", 3)
.click()
.find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist");
// mainPage
// .getCell("Customer List", 3)
// .click()
// .find(".nc-icon.nc-action-icon.nc-arrow-expand")
// .click({ force: true });
//
// // reload button
// cy.getActiveModal().find(".nc-icon").should("exist");
// cy.getActiveModal()
// .find("button")
// .contains("Link to")
// .should("not.exist");
// cy.getActiveModal()
// .find(".ant-card")
// .contains("2")
// .should("exist");
// cy.getActiveModal()
// .find(".ant-card")
// .find("button")
// .should("not.exist");
// cy.get('button.ant-modal-close').click();
});
it(`Share GRID view : Virtual column validation > belongs to`, () => {
// belongs to field validation
mainPage
.getCell("City", 1)
.click()
.find(".nc-icon.nc-unlink-icon")
.should("not.exist");
mainPage
.getCell("City", 1)
.click()
.find(".nc-icon.nc-action-icon.nc-arrow-expand")
.should("not.exist");
mainPage
.getCell("City", 1)
.find(".chips")
.contains("Kanchrapara")
.should("exist");
});
it(`Share GRID view : Virtual column validation > many to many`, () => {
// many-to-many field validation
mainPage
.getCell("Staff List", 1)
.click()
.find(".nc-icon.nc-unlink-icon")
.should("not.exist");
mainPage
.getCell("Staff List", 1)
.click()
.find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist");
mainPage
.getCell("Staff List", 1)
.click()
.find(".nc-icon.nc-action-icon.nc-arrow-expand")
.click({ force: true });
// // reload button
// Fix me : ncv2@fixme
// cy.getActiveModal().find(".nc-icon").should("exist");
// cy.getActiveModal()
// .find("button")
// .contains("Link to")
// .should("not.exist");
// cy.get('button.ant-modal-close:visible').last().click();
});
it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Address", 25);
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
cy.get(".nc-view-delete-icon").eq(0).click({ force: true });
cy.getActiveModal(".nc-modal-view-delete")
.find(".ant-btn-dangerous")
.click();
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
cy.get(".nc-view-item").its("length").should("eq", 1);
});
};
// below scenario's will be invoked twice, once for rest & then for graphql // below scenario's will be invoked twice, once for rest & then for graphql
viewTest("grid"); viewTest("grid");
}); });
describe(`${apiType.toUpperCase()} api - Grid view/ row-column update verification`, () => { describe(`${apiType.toUpperCase()} api - Grid view/ row-column update verification`, () => {
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
// Address table has belongs to, has many & many-to-many // Address table has belongs to, has many & many-to-many
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
// store base URL- to re-visit and delete form view later // store base URL- to re-visit and delete form view later
cy.url().then((url) => { cy.url().then((url) => {
storedURL = url; storedURL = url;
generateViewLink("rowColUpdate"); generateViewLink("rowColUpdate");
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
}); });
afterEach(() => { afterEach(() => {
cy.saveLocalStorage(); cy.saveLocalStorage();
}); });
after(() => { after(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage(); cy.saveLocalStorage();
}); });
it(`Generate default Shared GRID view URL`, () => { it(`Generate default Shared GRID view URL`, () => {
// add row // add row
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
cy.get(".nc-expand-col-Country").find(".nc-cell > input") cy.get(".nc-expand-col-Country")
.should("exist") .find(".nc-cell > input")
.first() .should("exist")
.clear({ force: true }) .first()
.type("a"); .clear({ force: true })
cy.getActiveDrawer() .type("a");
.find("button") cy.getActiveDrawer().find("button").contains("Save row").click();
.contains("Save row") cy.toastWait("updated successfully");
.click(); cy.getActiveDrawer().find("button").contains("Cancel").click();
cy.toastWait("updated successfully"); // add column
cy.getActiveDrawer() mainPage.addColumn("dummy", "Country");
.find("button")
.contains("Cancel") cy.signOut();
.click();
// add column // visit public view
mainPage.addColumn("dummy", "Country"); cy.log(viewURL["rowColUpdate"]);
cy.visit(viewURL["rowColUpdate"], {
cy.signOut(); baseUrl: null,
});
// visit public view cy.wait(5000);
cy.log(viewURL["rowColUpdate"]);
cy.visit(viewURL["rowColUpdate"], { // wait for public view page to load!
baseUrl: null, // wait for page rendering to complete
}); cy.get(".nc-grid-row").should("have.length", 25);
cy.wait(5000); });
// wait for public view page to load!
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 25);
});
it(`Share GRID view : new row visible`, () => { it(`Share GRID view : new row visible`, () => {
// verify row // verify row
// cy.get(`.v-pagination > li:contains('5') button`).click(); // cy.get(`.v-pagination > li:contains('5') button`).click();
cy.get(`.nc-pagination > .ant-pagination-item.ant-pagination-item-5`).click(); cy.get(
// wait for page rendering to complete `.nc-pagination > .ant-pagination-item.ant-pagination-item-5`
cy.get(".nc-grid-row").should("have.length", 10); ).click();
mainPage.getCell("Country", 10).contains("a").should("exist"); // wait for page rendering to complete
}); cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).contains("a").should("exist");
});
it(`Share GRID view : new column visible`, () => { it(`Share GRID view : new column visible`, () => {
// verify column headers // verify column headers
cy.get('[data-title="dummy"]').should("exist"); cy.get('[data-title="dummy"]').should("exist");
}); });
it(`Clean up`, () => { it(`Clean up`, () => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25) cy.openTableTab("Country", 25);
// delete row // delete row
mainPage.getPagination(5).click(); mainPage.getPagination(5).click();
// kludge: flicker on load // kludge: flicker on load
cy.wait(3000) cy.wait(3000);
// wait for page rendering to complete // wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10); cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).rightclick(); mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu") cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.find('.ant-dropdown-menu-item:contains("Delete Row")') .find('.ant-dropdown-menu-item:contains("Delete Row")')
.first() .first()
.click(); .click();
// delete column // delete column
mainPage.deleteColumn("dummy"); mainPage.deleteColumn("dummy");
mainPage.deleteCreatedViews(); mainPage.deleteCreatedViews();
});
}); });
});
}; };
/** /**

Loading…
Cancel
Save