Browse Source

test: CY formula, lookup, rollup, duration

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3343/head
Raju Udava 2 years ago
parent
commit
cafd0dd6b1
  1. 11
      scripts/cypress-v2/integration/common/3b_formula_column.js
  2. 7
      scripts/cypress-v2/integration/common/3c_lookup_column.js
  3. 24
      scripts/cypress-v2/integration/common/3d_rollup_column.js
  4. 24
      scripts/cypress-v2/integration/common/3e_duration_column.js

11
scripts/cypress-v2/integration/common/3b_formula_column.js

@ -15,6 +15,13 @@ export const genTest = (apiType, dbType) => {
mainPage.tabReset(); mainPage.tabReset();
// open a table to work on views // 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); cy.openTableTab("City", 25);
}); });
@ -88,9 +95,9 @@ export const genTest = (apiType, dbType) => {
.clear() .clear()
.type(newName); .type(newName);
cy.get('textarea.nc-formula-input').click().clear().type(newFormula); cy.get('textarea.nc-formula-input').click().clear().type(newFormula, { parseSpecialCharSequences: false });
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.toastWait(`Column created`); // cy.toastWait(`Column created`);
cy.get(`th[data-title="${oldName}"]`).should("not.exist"); cy.get(`th[data-title="${oldName}"]`).should("not.exist");
cy.get(`th[data-title="${newName}"]`).should("exist"); cy.get(`th[data-title="${newName}"]`).should("exist");
}; };

7
scripts/cypress-v2/integration/common/3c_lookup_column.js

@ -18,6 +18,13 @@ export const genTest = (apiType, dbType) => {
mainPage.tabReset(); mainPage.tabReset();
// open a table to work on views // 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); cy.openTableTab("City", 25);
}); });

24
scripts/cypress-v2/integration/common/3d_rollup_column.js

@ -9,6 +9,7 @@ export const genTest = (apiType, dbType) => {
// //
const fetchParentFromLabel = (label) => { const fetchParentFromLabel = (label) => {
cy.get("label").contains(label).parents(".ant-row").click(); cy.get("label").contains(label).parents(".ant-row").click();
cy.wait(500);
}; };
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
@ -16,6 +17,13 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.fileHook(); cy.fileHook();
mainPage.tabReset(); 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 // open a table to work on views
// //
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
@ -31,7 +39,7 @@ export const genTest = (apiType, dbType) => {
// Routine to create a new look up column // Routine to create a new look up column
// //
const addLookUpColumn = ( const addRollUpColumn = (
columnName, columnName,
childTable, childTable,
childCol, childCol,
@ -45,8 +53,8 @@ export const genTest = (apiType, dbType) => {
cy.getActiveMenu().find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu().find('input.nc-column-name-input', { timeout: 3000 })
.should('exist') .should('exist')
.clear() .clear()
.type(childCol); .type(columnName);
cy.get(".nc-column-type-input").last().click().type("Rollup"); cy.get(".nc-column-type-input").last().click().type("RollUp");
cy.getActiveSelection().find('.ant-select-item-option').contains("Rollup").click(); cy.getActiveSelection().find('.ant-select-item-option').contains("Rollup").click();
// Configure Child table & column names // Configure Child table & column names
@ -62,7 +70,7 @@ export const genTest = (apiType, dbType) => {
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.toastWait(`Column created`); cy.toastWait(`Column created`);
cy.get(`th[data-title="${childCol}"]`).should("exist"); cy.get(`th[data-title="${columnName}"]`).should("exist");
}; };
// routine to delete column // routine to delete column
@ -98,20 +106,20 @@ export const genTest = (apiType, dbType) => {
// Test case // Test case
it("Add Rollup column (City, City, count) & Delete", () => { it("Add Rollup column (City, City, count) & Delete", () => {
addLookUpColumn("RollUpCol_2", "City", "City", "count"); addRollUpColumn("RollUpCol", "City", "City", "count");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)' // Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
// intentionally verifying 4th item, as initial items are being masked out by list scroll down // intentionally verifying 4th item, as initial items are being masked out by list scroll down
mainPage.getCell("RollUpCol_2", 4) mainPage.getCell("RollUpCol", 4)
.contains("2") .contains("2")
.should("exist"); .should("exist");
// editColumnByName("RollUpCol_2", "RollUpCol_New"); // editColumnByName("RollUpCol_2", "RollUpCol_New");
deleteColumnByName("RollUpCol_2"); deleteColumnByName("RollUpCol");
}); });
it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { it.skip("Add Rollup column (City, CountryId, count) & Delete", () => {
addLookUpColumn("RollUpCol_1", "City", "CountryId", "count"); addRollUpColumn("RollUpCol_1", "City", "CountryId", "count");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)' // Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`) cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`)

24
scripts/cypress-v2/integration/common/3e_duration_column.js

@ -20,6 +20,13 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.fileHook(); cy.fileHook();
mainPage.tabReset(); 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.createTable(tableName); cy.createTable(tableName);
}); });
@ -97,14 +104,21 @@ export const genTest = (apiType, dbType) => {
cy.wait(500) cy.wait(500)
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
} else { } else {
mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true }); // mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true });
cy.get(".nc-row-expand")
.eq(index-1)
.click({ force: true });
} }
cy.get(".duration-cell-wrapper > input").first().should('exist').type(cellValue); cy.get(".duration-cell-wrapper > input").first().should('exist').type(cellValue);
cy.getActiveModal().find("button").contains("Save row").click({ force: true }); cy.getActiveDrawer().find("button").contains("Save row").click({ force: true });
cy.toastWait("Row updated successfully"); cy.toastWait("Row updated successfully");
mainPage.getCell(colName, index).find('input').then(($e) => { cy.getActiveDrawer().find("button").contains("Cancel").click({ force: true });
expect($e[0].value).to.equal(expectedValue) // mainPage.getCell(colName, index).find('input').then(($e) => {
}) // expect($e[0].value).to.equal(expectedValue)
// })
mainPage.getCell(colName, index)
.contains(expectedValue)
.should("exist");
} }
/////////////////////////////////////////////////// ///////////////////////////////////////////////////

Loading…
Cancel
Save