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. 50
      scripts/cypress/integration/common/1b_table_column_operations.js
  2. 51
      scripts/cypress/integration/common/4f_grid_view_share.js

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

@ -11,7 +11,8 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.get(".nc-add-new-row-btn").click();
// 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")
.find(".nc-cell > input")
.should("exist")
.first()
.clear()
@ -41,11 +42,11 @@ export const genTest = (apiType, dbType) => {
beforeEach(() => {
cy.restoreLocalStorage();
})
});
afterEach(() => {
cy.saveLocalStorage();
})
});
// // delete table
// after(() => {
@ -59,7 +60,6 @@ export const genTest = (apiType, dbType) => {
// 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 })
@ -71,17 +71,20 @@ export const genTest = (apiType, dbType) => {
.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')
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".nc-column-type-input")
.last()
.click();
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
cy.getActiveSelection(".nc-dropdown-column-type")
.find(".ant-select-item-option")
.contains("LongText")
.click();
cy.getActiveMenu('.nc-dropdown-edit-column')
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
@ -103,12 +106,13 @@ export const genTest = (apiType, dbType) => {
.click();
// rename column and verify
cy.getActiveMenu(".nc-dropdown-edit-column").find('input.nc-column-name-input', { timeout: 3000 })
.should('exist')
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')
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
@ -131,11 +135,14 @@ export const genTest = (apiType, dbType) => {
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 });
.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")
cy.get(".nc-expand-col-Title")
.find(".nc-cell > input")
.should("exist")
.first()
.clear()
@ -151,10 +158,7 @@ export const genTest = (apiType, dbType) => {
cy.get("body").type("{esc}");
mainPage.getCell("Title", 1).contains(randVal).should("not.exist");
mainPage
.getCell("Title", 1)
.contains(updatedRandVal)
.should("exist");
mainPage.getCell("Title", 1).contains(updatedRandVal).should("exist");
});
it("Delete Row", () => {
@ -179,9 +183,11 @@ export const genTest = (apiType, dbType) => {
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 });
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 });

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

@ -66,10 +66,11 @@ export const genTest = (apiType, dbType) => {
//
const viewTest = (viewType) => {
it(`Create ${viewType.toUpperCase()} view`, () => {
// create a normal public view
cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal(".nc-modal-view-create").find("button:contains(Submit)").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
@ -79,6 +80,7 @@ export const genTest = (apiType, dbType) => {
});
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")
@ -88,10 +90,11 @@ export const genTest = (apiType, dbType) => {
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");
@ -109,7 +112,7 @@ export const genTest = (apiType, dbType) => {
.its("length")
.should("eq", 1)
.then(() => {
cy.get('button.ant-modal-close:visible').click();
cy.get("button.ant-modal-close:visible").click();
});
cy.signOut();
@ -142,14 +145,8 @@ export const genTest = (apiType, dbType) => {
.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");
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`, () => {
@ -204,10 +201,7 @@ export const genTest = (apiType, dbType) => {
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");
mainPage.getCell("District", 1).contains("Tamil").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => {
@ -349,7 +343,9 @@ export const genTest = (apiType, dbType) => {
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.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
@ -392,20 +388,15 @@ export const genTest = (apiType, dbType) => {
it(`Generate default Shared GRID view URL`, () => {
// add row
cy.get(".nc-add-new-row-btn").click();
cy.get(".nc-expand-col-Country").find(".nc-cell > input")
cy.get(".nc-expand-col-Country")
.find(".nc-cell > input")
.should("exist")
.first()
.clear({ force: true })
.type("a");
cy.getActiveDrawer()
.find("button")
.contains("Save row")
.click();
cy.getActiveDrawer().find("button").contains("Save row").click();
cy.toastWait("updated successfully");
cy.getActiveDrawer()
.find("button")
.contains("Cancel")
.click();
cy.getActiveDrawer().find("button").contains("Cancel").click();
// add column
mainPage.addColumn("dummy", "Country");
@ -426,7 +417,9 @@ export const genTest = (apiType, dbType) => {
it(`Share GRID view : new row visible`, () => {
// verify row
// cy.get(`.v-pagination > li:contains('5') button`).click();
cy.get(`.nc-pagination > .ant-pagination-item.ant-pagination-item-5`).click();
cy.get(
`.nc-pagination > .ant-pagination-item.ant-pagination-item-5`
).click();
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).contains("a").should("exist");
@ -439,12 +432,12 @@ export const genTest = (apiType, dbType) => {
it(`Clean up`, () => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25)
cy.openTableTab("Country", 25);
// delete row
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000)
cy.wait(3000);
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);

Loading…
Cancel
Save