Skip to content
Snippets Groups Projects
Commit a00f5cda authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #329

when changing language, recalculating Nub that already had results was breaking chained results
parent f5ed5752
No related branches found
Tags 4.1.0
No related merge requests found
......@@ -265,4 +265,49 @@ describe("ngHyd − calculate with linked parameters", () => {
});
});
it(" − bug nghyd#329 : unexpected ERR in results table", async () => {
await startPage.navigateTo();
// load session
await navBar.clickMenuButton();
await browser.sleep(200);
await sidenav.clickLoadSessionButton();
await browser.sleep(200);
await sidenav.loadSessionFile("./session/session-pab-chain-nghyd-329.json");
await browser.sleep(200);
expect(await navBar.getAllCalculatorTabs().count()).toBe(3);
// calculate PAB-Dimensions
await navBar.clickCalculatorTab(2);
await browser.sleep(200);
// click "compute" button
const calcButton = calcPage.getCalculateButton();
await calcButton.click();
// check that result is not empty
expect(await calcPage.hasResults()).toBe(true);
// check that ERR is not present in Volume line of results table
let frt = calcPage.getFixedResultsTable();
let volumeRow = calcPage.getNthRow(frt, 3);
let volumeCol = calcPage.getNthColumn(volumeRow, 2);
let volume = await volumeCol.getText();
console.log(">> found volume (1)", volume);
expect(Number(volume)).toBeCloseTo(44.565, 3);
// click PAB-Nombre tab
await navBar.clickCalculatorTab(0);
await browser.sleep(200);
// go back to PAB-Dimensions
await navBar.clickCalculatorTab(2);
await browser.sleep(200);
// check that ERR is not present in Volume line of results table
frt = calcPage.getFixedResultsTable();
volumeRow = calcPage.getNthRow(frt, 3);
volumeCol = calcPage.getNthColumn(volumeRow, 2);
volume = await volumeCol.getText();
console.log(">> found volume (2)", volume);
expect(Number(volume)).toBeCloseTo(44.565, 3);
});
});
......@@ -85,6 +85,20 @@ export class CalculatorPage {
});
}
getFixedResultsTable() {
return element(by.css(".fixed-results-inner-container table"));
}
/** return nth <tr> of given <table>, starting at 1 */
getNthRow(table: ElementFinder, n: number) {
return table.element(by.css("tbody > tr:nth-of-type(" + n + ")"));
}
/** return nth <td> of given <tr>, starting at 1 */
getNthColumn(tr: ElementFinder, n: number) {
return tr.element(by.css("td:nth-of-type(" + n + ")"));
}
async inputHasCalcModeButton(input: ElementFinder) {
// get parent (div.container)
const container = await this.findParentContainer(input);
......
{
"header": {
"source": "jalhyd",
"format_version": "1.3",
"created": "2019-11-22T14:47:11.232Z"
},
"settings": {
"precision": 1e-7,
"maxIterations": 100,
"displayPrecision": 3
},
"documentation": "",
"session": [
{
"uid": "eWNjdG",
"props": {
"calcType": "PabNombre",
"nodeType": "None"
},
"meta": {
"title": "PAB : nombre"
},
"children": [],
"parameters": [
{
"symbol": "DHT",
"mode": "SINGLE",
"value": 3.18
},
{
"symbol": "N",
"mode": "SINGLE",
"value": 14
},
{
"symbol": "DH",
"mode": "CALCUL"
}
]
},
{
"uid": "dXM4em",
"props": {
"calcType": "PabPuissance",
"nodeType": "None"
},
"meta": {
"title": "PAB : puissance"
},
"children": [],
"parameters": [
{
"symbol": "DH",
"mode": "LINK",
"targetNub": "eWNjdG",
"targetParam": "DH"
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 2.8
},
{
"symbol": "V",
"mode": "CALCUL",
"value": 0.5
},
{
"symbol": "PV",
"mode": "SINGLE",
"value": 140
}
]
},
{
"uid": "bzNlaX",
"props": {
"calcType": "PabDimensions",
"nodeType": "None"
},
"meta": {
"title": "PAB : dimensions"
},
"children": [],
"parameters": [
{
"symbol": "L",
"mode": "SINGLE",
"value": 5
},
{
"symbol": "W",
"mode": "SINGLE",
"value": 5
},
{
"symbol": "Y",
"mode": "CALCUL"
},
{
"symbol": "V",
"mode": "LINK",
"targetNub": "dXM4em",
"targetParam": "V"
}
]
}
]
}
\ No newline at end of file
......@@ -412,9 +412,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
for (const fe of this.topFormElements) {
fe.updateLocalisation(localisation);
}
if (this.hasResults) {
this.doCompute(); // pour mettre à jour la langue des intitulés de résultats
}
}
public isDisplayed(id: string) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment