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. 57
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  8. 25
      scripts/cypress/integration/common/3b_formula_column.js
  9. 42
      scripts/cypress/integration/common/3c_lookup_column.js
  10. 44
      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");
});
});
};

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

@ -5,24 +5,29 @@ 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
cy.openTableTab("Country", 25);
});
after(() => {
cy.closeTableTab("Country");
});
describe(`${apiType.toUpperCase()} api - Grid operations`, () => {
// before(() => {
// // loginPage.loginAndOpenProject(apiType, dbType);
//
// // open country table
// cy.openTableTab("Country", 25);
// });
//
// after(() => {
// cy.closeTableTab("Country");
// });
describe(`Pagination`, () => {
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
// check pagination
it("Check country table - Pagination", () => {
cy.openTableTab("Country", 25);
cy.get(".nc-pagination").should("exist");
// verify > pagination option
@ -37,12 +42,6 @@ export const genTest = (apiType, dbType) => {
.getPagination(1)
.should("have.class", "ant-pagination-item-active");
});
});
describe(`Row operations`, () => {
beforeEach(() => {
cy.fileHook();
})
// create new row using + button in header
//
@ -158,12 +157,7 @@ export const genTest = (apiType, dbType) => {
mainPage.getPagination(1).click();
});
});
describe(`Sort operations`, () => {
beforeEach(() => {
cy.fileHook();
})
it("Enable sort", () => {
mainPage.sortField("Country", "Z → A");
@ -174,12 +168,6 @@ export const genTest = (apiType, dbType) => {
mainPage.clearSort();
cy.contains("Zambia").should("not.exist");
});
});
describe("Field Operation", () => {
beforeEach(() => {
cy.fileHook();
})
it("Hide field", () => {
mainPage.hideField("LastUpdate");
@ -188,12 +176,6 @@ export const genTest = (apiType, dbType) => {
it("Show field", () => {
mainPage.unhideField("LastUpdate");
});
});
describe("Filter operations", () => {
beforeEach(() => {
cy.fileHook();
})
it("Create Filter", () => {
mainPage.filterField("Country", "is equal", "India");
@ -210,7 +192,8 @@ export const genTest = (apiType, dbType) => {
.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");
});
});
};

42
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
// 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);
});
// // // 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", () => {

44
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
// before(() => {
// cy.fileHook();
// mainPage.tabReset();
//
cy.openTableTab("Country", 25);
});
// // // 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