Browse Source

test: local storage handling for tableOps suite

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3667/head
Raju Udava 2 years ago
parent
commit
4582c0ed57
  1. 21
      scripts/cypress/integration/common/1a_table_operations.js
  2. 27
      scripts/cypress/integration/common/1b_table_column_operations.js
  3. 18
      scripts/cypress/integration/common/1c_sql_view.js
  4. 13
      scripts/cypress/integration/common/1e_meta_sync.js
  5. 31
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  6. 32
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  7. 361
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  8. 25
      scripts/cypress/integration/common/3b_formula_column.js
  9. 44
      scripts/cypress/integration/common/3c_lookup_column.js
  10. 46
      scripts/cypress/integration/common/3d_rollup_column.js
  11. 19
      scripts/cypress/integration/common/3f_link_to_another_record.js

21
scripts/cypress/integration/common/1a_table_operations.js

@ -7,18 +7,25 @@ export const genTest = (apiType, dbType) => {
describe(`${
dbType === "xcdb" ? "Meta - " : ""
}${apiType.toUpperCase()} api - Table`, () => {
before(() => {
cy.saveLocalStorage();
cy.wait(1000);
});
// before(() => {
// // standalone test
// // loginPage.loginAndOpenProject(apiType, dbType);
//
// // open a table to work on views
// //
// // cy.restoreLocalStorage();
// });
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
});
after(() => {
});
afterEach(() => {
cy.saveLocalStorage();
})
// after(() => {
// });
const name = "tablex";

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

@ -34,22 +34,26 @@ export const genTest = (apiType, dbType) => {
const randVal = "Test@1234.com";
const updatedRandVal = "Updated@1234.com";
before(() => {
cy.fileHook();
mainPage.tabReset();
cy.createTable(name);
});
// before(() => {
// cy.restoreLocalStorage();
// cy.createTable(name);
// })
beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage();
})
// delete table
after(() => {
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);
});
@ -167,6 +171,9 @@ export const genTest = (apiType, dbType) => {
// verify if everything is wiped off
mainPage.getCell("Title", 1).contains("a1").should("not.exist");
// clean-up
cy.deleteTable(name, dbType);
});
});
};

18
scripts/cypress/integration/common/1c_sql_view.js

@ -10,13 +10,17 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} SQL Views`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
});
// before(() => {
// cy.fileHook();
// mainPage.tabReset();
// });
beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
it(`XCDB: SQL View Column operations`, () => {
@ -168,10 +172,6 @@ export const genTest = (apiType, dbType) => {
cy.closeViewsTab("StaffList");
}
});
after(() => {
// void
});
});
};

13
scripts/cypress/integration/common/1e_meta_sync.js

@ -18,22 +18,23 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.restoreLocalStorage();
if (isXcdb()) {
cy.log(getProjectString());
projPrefix = `${getProjectString()}`;
dbCmd = `sqliteExec`;
tblDisplayPrefix = `${getProjectString()}`;
}
mainPage.tabReset();
mainPage.openMetaTab();
});
})
beforeEach(() => {
});
cy.restoreLocalStorage();
})
after(() => {
// mainPage.closeMetaTab();
});
afterEach(() => {
cy.saveLocalStorage();
})
it(`Create table`, () => {
// Create Table

31
scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js

@ -5,28 +5,25 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Table: belongs to, link record`, () => {
before(() => {
cy.fileHook();
mainPage.tabReset();
//
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
cy.openTableTab("Country", 25);
});
// before(() => {
// cy.restoreLocalStorage();
// cy.openTableTab("Country", 25);
// });
beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage();
});
after(() => {
cy.closeTableTab("City");
});
afterEach(() => {
cy.saveLocalStorage();
})
// after(() => {
// cy.closeTableTab("City");
// });
it("URL validation", () => {
cy.openTableTab("Country", 25);
// column name validation
// cy.get(`.project-tab:contains(Country):visible`).should("exist");
// URL validation
@ -103,6 +100,8 @@ export const genTest = (apiType, dbType) => {
.find('.nc-virtual-cell > .chips-wrapper > .chips > .group > .name')
.contains("Saudi Arabia")
.should('exist');
cy.closeTableTab("City");
})
});
};

32
scripts/cypress/integration/common/2b_table_with_m2m_column.js

@ -5,28 +5,24 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - M2M Column validation`, () => {
before(() => {
cy.fileHook();
mainPage.tabReset();
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
cy.openTableTab("Actor", 25);
});
// before(() => {
// cy.openTableTab("Actor", 25);
// });
beforeEach(() => {
cy.fileHook();
});
cy.restoreLocalStorage();
})
after(() => {
cy.closeTableTab("Actor");
});
afterEach(() => {
cy.saveLocalStorage();
})
// after(() => {
// cy.closeTableTab("Actor");
// });
it("Table column header, URL validation", () => {
cy.openTableTab("Actor", 25);
// column name validation
// cy.get(`.project-tab:contains(Actor):visible`).should("exist");
// URL validation
@ -117,6 +113,8 @@ export const genTest = (apiType, dbType) => {
.click();
cy.getActiveModal().find("button.ant-modal-close").click();
});
cy.closeTableTab("Actor");
});
});
};

361
scripts/cypress/integration/common/3a_filter_sort_fields_operations.js

@ -5,212 +5,195 @@ import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Filter, Fields, Sort`, () => {
before(() => {
// loginPage.loginAndOpenProject(apiType, dbType);
// open country table
describe(`${apiType.toUpperCase()} api - Grid operations`, () => {
// before(() => {
// // loginPage.loginAndOpenProject(apiType, dbType);
//
// // 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.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(() => {
cy.closeTableTab("Country");
// create new row using + button in header
//
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`, () => {
beforeEach(() => {
})
// check pagination
it("Check country table - Pagination", () => {
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");
});
// delete single row
//
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();
});
describe(`Row operations`, () => {
beforeEach(() => {
cy.fileHook();
})
// create new row using + button in header
//
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");
});
// delete single row
//
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();
});
// 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");
});
describe(`Sort operations`, () => {
beforeEach(() => {
cy.fileHook();
})
// 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();
});
it("Enable sort", () => {
mainPage.sortField("Country", "Z → A");
cy.contains("Zambia").should("exist");
});
it("Disable sort", () => {
mainPage.clearSort();
cy.contains("Zambia").should("not.exist");
});
it("Enable sort", () => {
mainPage.sortField("Country", "Z → A");
cy.contains("Zambia").should("exist");
});
describe("Field Operation", () => {
beforeEach(() => {
cy.fileHook();
})
it("Disable sort", () => {
mainPage.clearSort();
cy.contains("Zambia").should("not.exist");
});
it("Hide field", () => {
mainPage.hideField("LastUpdate");
});
it("Hide field", () => {
mainPage.hideField("LastUpdate");
});
it("Show field", () => {
mainPage.unhideField("LastUpdate");
});
it("Show field", () => {
mainPage.unhideField("LastUpdate");
});
describe("Filter operations", () => {
beforeEach(() => {
cy.fileHook();
})
it("Create Filter", () => {
mainPage.filterField("Country", "is equal", "India");
// cy.get("td:contains(India)").should("exist");
mainPage.getCell("Country", 1)
.contains("India")
.should("exist");
});
it("Delete Filter", () => {
// remove sort and check
mainPage.filterReset();
mainPage.getCell("Country", 1)
.contains("India")
.should("not.exist");
// cy.contains("td:contains(India)").should("not.exist");
});
it("Create Filter", () => {
mainPage.filterField("Country", "is equal", "India");
// cy.get("td:contains(India)").should("exist");
mainPage.getCell("Country", 1)
.contains("India")
.should("exist");
});
it("Delete Filter", () => {
// remove sort and check
mainPage.filterReset();
mainPage.getCell("Country", 1)
.contains("India")
.should("not.exist");
// cy.contains("td:contains(India)").should("not.exist");
cy.closeTableTab("Country");
});
});
};

25
scripts/cypress/integration/common/3b_formula_column.js

@ -11,17 +11,22 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} api - FORMULA`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// loginPage.loginAndOpenProject(apiType, dbType)
cy.openTableTab("City", 25);
});
// before(() => {
// // loginPage.loginAndOpenProject(apiType, dbType)
// cy.openTableTab("City", 25);
// });
beforeEach(() => {
});
cy.restoreLocalStorage();
})
after(() => {
cy.closeTableTab("City");
});
afterEach(() => {
cy.saveLocalStorage();
})
// after(() => {
// cy.closeTableTab("City");
// });
// Given rowname & expected result for first 10 entries, validate
// NOTE: Scroll issue with Cypress automation, to fix
@ -157,6 +162,8 @@ export const genTest = (apiType, dbType) => {
}
it("Formula: ADD, AVG, LEN", () => {
cy.openTableTab("City", 25);
addFormulaBasedColumn(
"NC_MATH_0",
"ADD({CityId}, {CountryId}) + AVG({CityId}, {CountryId}) + LEN({City})"
@ -217,6 +224,8 @@ export const genTest = (apiType, dbType) => {
if (dbType === 'mysql') editColumnByName("NC_MATH_2", "NC_NOW", `NOW()`);
else editColumnByName("NC_MATH_1", "NC_NOW", `NOW()`);
deleteColumnByName("NC_NOW");
cy.closeTableTab("City");
});
});
};

44
scripts/cypress/integration/common/3c_lookup_column.js

@ -13,28 +13,32 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
// open a table to work on views
//
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
cy.openTableTab("City", 25);
});
// before(() => {
// cy.fileHook();
// mainPage.tabReset();
// // open a table to work on views
// //
//
// // // kludge: wait for page load to finish
// // cy.wait(1000);
// // // close team & auth tab
// // cy.get('button.ant-tabs-tab-remove').should('exist').click();
// // cy.wait(1000);
//
// cy.openTableTab("City", 25);
// });
beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage();
});
after(() => {
cy.closeTableTab("City");
});
afterEach(() => {
cy.saveLocalStorage();
})
// after(() => {
// cy.closeTableTab("City");
// });
// Routine to create a new look up column
//
@ -74,6 +78,8 @@ export const genTest = (apiType, dbType) => {
// Test case
it("Add Lookup column (Address, PostalCode) & Delete", () => {
cy.openTableTab("City", 25);
addLookUpColumn("Address", "PostalCode");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
@ -82,6 +88,8 @@ export const genTest = (apiType, dbType) => {
.should("exist");
deleteColumnByName("PostalCode");
cy.closeTableTab("City");
});
it.skip("Add Lookup column (Country, CountryId) & Delete", () => {

46
scripts/cypress/integration/common/3d_rollup_column.js

@ -14,28 +14,32 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
// open a table to work on views
//
cy.openTableTab("Country", 25);
});
// before(() => {
// cy.fileHook();
// mainPage.tabReset();
//
// // // kludge: wait for page load to finish
// // cy.wait(1000);
// // // close team & auth tab
// // cy.get('button.ant-tabs-tab-remove').should('exist').click();
// // cy.wait(1000);
//
// // open a table to work on views
// //
// cy.openTableTab("Country", 25);
// });
beforeEach(() => {
cy.fileHook();
});
cy.restoreLocalStorage();
})
after(() => {
cy.closeTableTab("Country");
});
afterEach(() => {
cy.saveLocalStorage();
})
// after(() => {
// cy.closeTableTab("Country");
// });
// Routine to create a new look up column
//
@ -106,6 +110,8 @@ export const genTest = (apiType, dbType) => {
// Test case
it("Add Rollup column (City, City, count) & Delete", () => {
cy.openTableTab("Country", 25);
addRollUpColumn("RollUpCol", "City", "City", "count");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
@ -116,6 +122,8 @@ export const genTest = (apiType, dbType) => {
// editColumnByName("RollUpCol_2", "RollUpCol_New");
deleteColumnByName("RollUpCol");
cy.closeTableTab("Country");
});
it.skip("Add Rollup column (City, CountryId, count) & Delete", () => {

19
scripts/cypress/integration/common/3f_link_to_another_record.js

@ -103,15 +103,14 @@ export const genTest = (apiType, dbType) => {
cy.wait(1000);
}
before(() => {
// required for standalone test
// loginPage.loginAndOpenProject(apiType, dbType);
cy.createTable("Sheet1");
cy.createTable("Sheet2");
// before(() => {
// // required for standalone test
// // loginPage.loginAndOpenProject(apiType, dbType);
// });
afterEach(() => {
cy.saveLocalStorage();
});
})
beforeEach(() => {
cy.restoreLocalStorage();
@ -120,6 +119,8 @@ export const genTest = (apiType, dbType) => {
after(() => {
// Cleanup
//
cy.restoreLocalStorage();
cy.openTableTab("Sheet1", 0);
mainPage.deleteColumn("Link1-2hm");
mainPage.deleteColumn("Link1-2mm");
@ -127,12 +128,16 @@ export const genTest = (apiType, dbType) => {
cy.deleteTable("Sheet1");
cy.deleteTable("Sheet2");
cy.saveLocalStorage();
});
///////////////////////////////////////////////////
// Test case
it("Create Link columns", () => {
cy.createTable("Sheet1");
cy.createTable("Sheet2");
cy.openTableTab("Sheet1", 0);
addRow(1, "1a");
addRow(2, "1b");

Loading…
Cancel
Save