|
|
@ -106,22 +106,57 @@ export const genTest = (apiType, dbType) => { |
|
|
|
.find(".nc-column-edit") |
|
|
|
.find(".nc-column-edit") |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (newName !== oldName) { |
|
|
|
cy.getActiveMenu(".nc-dropdown-edit-column") |
|
|
|
cy.getActiveMenu(".nc-dropdown-edit-column") |
|
|
|
.find("input.nc-column-name-input", { timeout: 3000 }) |
|
|
|
.find("input.nc-column-name-input", { timeout: 3000 }) |
|
|
|
.should("exist") |
|
|
|
.should("exist") |
|
|
|
.clear() |
|
|
|
.clear() |
|
|
|
.type(newName); |
|
|
|
.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`);
|
|
|
|
|
|
|
|
if (newName !== oldName) { |
|
|
|
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"); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
@ -184,6 +224,12 @@ export const genTest = (apiType, dbType) => { |
|
|
|
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"); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|