diff --git a/e2e/calculate-linked-params.e2e-spec.ts b/e2e/calculate-linked-params.e2e-spec.ts index 5977c41ebf6ec618f8080c65d7eb1afdd4948611..85a6aa5a8218525f83c9e648c1eafeb5568d69ae 100644 --- a/e2e/calculate-linked-params.e2e-spec.ts +++ b/e2e/calculate-linked-params.e2e-spec.ts @@ -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); + }); + }); diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts index c324c85c35fd2981e3f79ea227d0dbe962da3a1c..0e6f9f322c5c18d0698058e68032838b87b42793 100644 --- a/e2e/calculator.po.ts +++ b/e2e/calculator.po.ts @@ -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); diff --git a/e2e/session/session-pab-chain-nghyd-329.json b/e2e/session/session-pab-chain-nghyd-329.json new file mode 100644 index 0000000000000000000000000000000000000000..05a8b60dbbe55a62f30d1541557953f799b0541a --- /dev/null +++ b/e2e/session/session-pab-chain-nghyd-329.json @@ -0,0 +1,109 @@ +{ + "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 diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index 5aa007c8aff8314b63f92235241162864c108912..438111702de544a58997daef9f92dd26a9da8c2f 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -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) {