|
|
@ -106,22 +106,57 @@ export const genTest = (apiType, dbType) => { |
|
|
|
.find(".nc-column-edit") |
|
|
|
.find(".nc-column-edit") |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-edit-column") |
|
|
|
if (newName !== oldName) { |
|
|
|
.find("input.nc-column-name-input", { timeout: 3000 }) |
|
|
|
cy.getActiveMenu(".nc-dropdown-edit-column") |
|
|
|
.should("exist") |
|
|
|
.find("input.nc-column-name-input", { timeout: 3000 }) |
|
|
|
.clear() |
|
|
|
.should("exist") |
|
|
|
.type(newName); |
|
|
|
.clear() |
|
|
|
|
|
|
|
.type(newName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cy.get("textarea.nc-formula-input") |
|
|
|
cy.get("textarea.nc-formula-input") |
|
|
|
.click() |
|
|
|
.click() |
|
|
|
.clear() |
|
|
|
.clear() |
|
|
|
.type(newFormula, { parseSpecialCharSequences: false }); |
|
|
|
.type(newFormula, { parseSpecialCharSequences: false }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.get(".ant-form-item-explain-error").should('not.exist'); |
|
|
|
|
|
|
|
|
|
|
|
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"); |
|
|
|
if (newName !== oldName) { |
|
|
|
|
|
|
|
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"); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// routine to edit a column with Circular Reference
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
const editCircularColumnByName = (columnName, newFormula) => { |
|
|
|
|
|
|
|
cy.get(`th:contains(${columnName}) .nc-icon.ant-dropdown-trigger`) |
|
|
|
|
|
|
|
.trigger("mouseover", { force: true }) |
|
|
|
|
|
|
|
.click({ force: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-column-operations") |
|
|
|
|
|
|
|
.find(".nc-column-edit") |
|
|
|
|
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.getActiveMenu(".nc-dropdown-edit-column") |
|
|
|
|
|
|
|
.find("input.nc-column-name-input", { timeout: 3000 }) |
|
|
|
|
|
|
|
.should("exist"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.get("textarea.nc-formula-input") |
|
|
|
|
|
|
|
.click() |
|
|
|
|
|
|
|
.clear() |
|
|
|
|
|
|
|
.type(newFormula, { parseSpecialCharSequences: false }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// clicking the Save button, should NOT submit the form
|
|
|
|
|
|
|
|
cy.get(".ant-btn-primary").contains("Save").click(); |
|
|
|
|
|
|
|
// therefore we can see the error
|
|
|
|
|
|
|
|
cy.get(".ant-form-item-explain-error").contains("Can’t save field because it causes a circular reference"); |
|
|
|
|
|
|
|
// then close the form without saving
|
|
|
|
|
|
|
|
cy.get(".ant-btn").contains("Cancel").click(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
// Test case
|
|
|
|
// Test case
|
|
|
|
|
|
|
|
|
|
|
@ -148,6 +183,11 @@ export const genTest = (apiType, dbType) => { |
|
|
|
let RESULT_MATH_2 = []; |
|
|
|
let RESULT_MATH_2 = []; |
|
|
|
let RESULT_WEEKDAY_0 = []; |
|
|
|
let RESULT_WEEKDAY_0 = []; |
|
|
|
let RESULT_WEEKDAY_1 = []; |
|
|
|
let RESULT_WEEKDAY_1 = []; |
|
|
|
|
|
|
|
let RESULT_CIRC_REF_0 = []; |
|
|
|
|
|
|
|
let RESULT_CIRC_REF_1 = []; |
|
|
|
|
|
|
|
let RESULT_CIRC_REF_2 = []; |
|
|
|
|
|
|
|
let RESULT_CIRC_REF_0_FINAL = []; |
|
|
|
|
|
|
|
let RESULT_CIRC_REF_2_FINAL = []; |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 10; i++) { |
|
|
|
for (let i = 0; i < 10; i++) { |
|
|
|
// CONCAT, LOWER, UPPER, TRIM
|
|
|
|
// CONCAT, LOWER, UPPER, TRIM
|
|
|
@ -175,15 +215,21 @@ export const genTest = (apiType, dbType) => { |
|
|
|
// only integer verification being computed, hence trunc
|
|
|
|
// only integer verification being computed, hence trunc
|
|
|
|
RESULT_MATH_2[i] = Math.trunc( |
|
|
|
RESULT_MATH_2[i] = Math.trunc( |
|
|
|
Math.log(cityId[i]) + |
|
|
|
Math.log(cityId[i]) + |
|
|
|
Math.exp(cityId[i]) + |
|
|
|
Math.exp(cityId[i]) + |
|
|
|
Math.pow(cityId[i], 3) + |
|
|
|
Math.pow(cityId[i], 3) + |
|
|
|
Math.sqrt(countryId[i]) |
|
|
|
Math.sqrt(countryId[i]) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// WEEKDAY: starts from Monday
|
|
|
|
// WEEKDAY: starts from Monday
|
|
|
|
RESULT_WEEKDAY_0[i] = 1; |
|
|
|
RESULT_WEEKDAY_0[i] = 1; |
|
|
|
// WEEKDAY: starts from Sunday
|
|
|
|
// WEEKDAY: starts from Sunday
|
|
|
|
RESULT_WEEKDAY_1[i] = 2; |
|
|
|
RESULT_WEEKDAY_1[i] = 2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RESULT_CIRC_REF_0[i] = city[i] |
|
|
|
|
|
|
|
RESULT_CIRC_REF_1[i] = city[i] |
|
|
|
|
|
|
|
RESULT_CIRC_REF_2[i] = city[i] + city[i] |
|
|
|
|
|
|
|
RESULT_CIRC_REF_0_FINAL[i] = city[i] + city[i] |
|
|
|
|
|
|
|
RESULT_CIRC_REF_2_FINAL[i] = city[i] + city[i] + city[i] + city[i] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
it("Formula: ADD, AVG, LEN", () => { |
|
|
|
it("Formula: ADD, AVG, LEN", () => { |
|
|
@ -248,6 +294,64 @@ export const genTest = (apiType, dbType) => { |
|
|
|
|
|
|
|
|
|
|
|
cy.closeTableTab("City"); |
|
|
|
cy.closeTableTab("City"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("Formula: Circular references", () => { |
|
|
|
|
|
|
|
cy.openTableTab("City", 25); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addFormulaBasedColumn( |
|
|
|
|
|
|
|
"NC_CIRC_REF_0", |
|
|
|
|
|
|
|
"{City}" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
addFormulaBasedColumn( |
|
|
|
|
|
|
|
"NC_CIRC_REF_1", |
|
|
|
|
|
|
|
"{NC_CIRC_REF_0}" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
editCircularColumnByName( |
|
|
|
|
|
|
|
"NC_CIRC_REF_0", |
|
|
|
|
|
|
|
"{NC_CIRC_REF_1}" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteColumnByName("NC_CIRC_REF_1"); |
|
|
|
|
|
|
|
deleteColumnByName("NC_CIRC_REF_0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.closeTableTab("City"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("Formula: Duplicated dependencies (neighbours)", () => { |
|
|
|
|
|
|
|
cy.openTableTab("City", 25); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addFormulaBasedColumn( |
|
|
|
|
|
|
|
"NC_CIRC_REF_0", |
|
|
|
|
|
|
|
"{City}" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
addFormulaBasedColumn( |
|
|
|
|
|
|
|
"NC_CIRC_REF_1", |
|
|
|
|
|
|
|
"{NC_CIRC_REF_0}" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
addFormulaBasedColumn( |
|
|
|
|
|
|
|
"NC_CIRC_REF_2", |
|
|
|
|
|
|
|
"CONCAT({NC_CIRC_REF_1},{NC_CIRC_REF_1})" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rowValidation("NC_CIRC_REF_0", RESULT_CIRC_REF_0); |
|
|
|
|
|
|
|
rowValidation("NC_CIRC_REF_1", RESULT_CIRC_REF_1); |
|
|
|
|
|
|
|
rowValidation("NC_CIRC_REF_2", RESULT_CIRC_REF_2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editColumnByName( |
|
|
|
|
|
|
|
"NC_CIRC_REF_0", |
|
|
|
|
|
|
|
"NC_CIRC_REF_0", |
|
|
|
|
|
|
|
"CONCAT({City},{City})" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rowValidation("NC_CIRC_REF_0", RESULT_CIRC_REF_0_FINAL); |
|
|
|
|
|
|
|
rowValidation("NC_CIRC_REF_2", RESULT_CIRC_REF_2_FINAL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteColumnByName("NC_CIRC_REF_2"); |
|
|
|
|
|
|
|
deleteColumnByName("NC_CIRC_REF_1"); |
|
|
|
|
|
|
|
deleteColumnByName("NC_CIRC_REF_0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.closeTableTab("City"); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|