Skip to content
Snippets Groups Projects
Commit 3ba22e3d authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch '159-amelioration-du-systeme-de-parametres-lies' into 'master'

Resolve "Amélioration du système de paramètres liés"

Closes #159, #186, #184, #168, #183, #174, #177, #134, #167, #172, #171, and #166

See merge request !40
parents 4ebcc431 e697fb81
No related branches found
No related tags found
1 merge request!40Resolve "Amélioration du système de paramètres liés"
Showing
with 1886 additions and 53 deletions
import { AppPage } from "./app.po";
import { ListPage } from "./list.po"; import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po"; import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser } from "protractor";
/** /**
* For all calculators, try to calculate every parameter: check that only one parameter * For all calculators, try to calculate every parameter: check that only one parameter
...@@ -32,11 +28,9 @@ describe("ngHyd − calculate all parameters of all calculators", () => { ...@@ -32,11 +28,9 @@ describe("ngHyd − calculate all parameters of all calculators", () => {
// get all parameters IDs // get all parameters IDs
const inputs = await calcPage.getParamInputsHavingCalcMode(); const inputs = await calcPage.getParamInputsHavingCalcMode();
// console.log("> Inputs having calc", inputs.length);
if (inputs.length > 0) { if (inputs.length > 0) {
// for each param // for each param
for (const input of inputs) { for (const input of inputs) {
// console.log(">> Trying", await input.getAttribute("id"));
// click "calc" mode button for this parameter // click "calc" mode button for this parameter
await calcPage.setParamMode(input, "cal"); await calcPage.setParamMode(input, "cal");
// check that only 1 button is in "calc" state // check that only 1 button is in "calc" state
...@@ -45,7 +39,7 @@ describe("ngHyd − calculate all parameters of all calculators", () => { ...@@ -45,7 +39,7 @@ describe("ngHyd − calculate all parameters of all calculators", () => {
// check that "compute" button is active // check that "compute" button is active
const calcButton = calcPage.getCalculateButton(); const calcButton = calcPage.getCalculateButton();
const disabledState = await calcButton.getAttribute("disabled"); const disabledState = await calcButton.getAttribute("disabled");
expect(disabledState).not.toBe("disabled"); expect(disabledState).not.toBe("true");
// click "compute" button // click "compute" button
await calcButton.click(); await calcButton.click();
// check that result is not empty // check that result is not empty
......
import { AppPage } from "./app.po";
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser } from "protractor";
/**
* Uses an example configuration to calculate :
* - with a parameter linked to a single parameter
* - with a parameter linked to a single parameter, plus local variated parameter
* - with a parameter linked to a variated parameter
* - with a parameter linked to a single result
* - with a parameter linked to a single result, plus local variated parameter
* - with a parameter linked to a variated result
* - with a parameter linked to a single extra result
* - with a parameter linked to a single extra result, plus local variated parameter
* - with a parameter linked to a variated extra result
*
* => plus all those combinations in indeirect link mode (linked parameter target
* is also a linked parameter)
*/
describe("ngHyd − calculate with linked parameters", () => {
let listPage: ListPage;
let calcPage: CalculatorPage;
let navBar: Navbar;
let startPage: AppPage;
beforeEach(() => {
listPage = new ListPage();
calcPage = new CalculatorPage();
navBar = new Navbar();
startPage = new AppPage();
});
async function computeAndCheckPresenceOfResults() {
// check that "compute" button is active
const calcButton = calcPage.getCalculateButton();
const disabledState = await calcButton.getAttribute("disabled");
expect(disabledState).not.toBe("true");
// click "compute" button
await calcButton.click();
// check that result is not empty
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(true);
}
it(" − direct links : parameter linked to a single parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (R uniforme)
const Y = calcPage.getInputById("Y");
await calcPage.setParamMode(Y, "link");
const sel = await calcPage.getLinkedValueSelect(Y);
await calcPage.changeSelectValue(sel, 1);
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a single parameter, plus local variated parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (R uniforme)
const Y = calcPage.getInputById("Y");
await calcPage.setParamMode(Y, "link");
const sel = await calcPage.getLinkedValueSelect(Y);
await calcPage.changeSelectValue(sel, 1);
// vary W
const W = calcPage.getInputById("W");
await calcPage.setParamMode(W, "var");
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a variated parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// vary Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "var");
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (R uniforme)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 1);
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a single result", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// calculate Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "cal");
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (R uniforme)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 1);
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a single result, plus local variated parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// calculate Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "cal");
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (R uniforme)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 1);
// vary W
const W = calcPage.getInputById("W");
await calcPage.setParamMode(W, "var");
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a variated result", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// vary Q
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "var");
// calculate Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "cal");
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (R uniforme)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 1);
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a single extra result", async () => {
// create a Déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
// create a Régime uniforme
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(3);
// link Q to CvQT (Déversoirs dénoyés)
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "link");
const sel = await calcPage.getLinkedValueSelect(Q);
await calcPage.changeSelectValue(sel, 1);
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a single extra result, plus local variated parameter", async () => {
// create a Déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
// create a Régime uniforme
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(3);
// link Q to CvQT (Déversoirs dénoyés)
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "link");
const sel = await calcPage.getLinkedValueSelect(Q);
await calcPage.changeSelectValue(sel, 1);
// vary YB
const YB = calcPage.getInputById("YB");
await calcPage.setParamMode(YB, "var");
await computeAndCheckPresenceOfResults();
});
it(" − direct links : parameter linked to a variated extra result", async () => {
// create a Déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
// vary BR
const BR = calcPage.getInputById("BR");
await calcPage.setParamMode(BR, "var");
// create a Régime uniforme
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(3);
// link Q to CvQT (Déversoirs dénoyés)
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "link");
const sel = await calcPage.getLinkedValueSelect(Q);
await calcPage.changeSelectValue(sel, 1);
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a single parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Y to Y (R uniforme)
const Yproxy = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (Sec param)
const Y = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const sel = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 3);
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a single parameter, plus local variated parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Y to Y (R uniforme)
const Yproxy = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (Sec param)
const Y = calcPage.getInputById("Y");
await calcPage.setParamMode(Y, "link");
const sel = await calcPage.getLinkedValueSelect(Y);
await calcPage.changeSelectValue(sel, 3);
// vary W
const W = calcPage.getInputById("W");
await calcPage.setParamMode(W, "var");
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a variated parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// vary Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "var");
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Y to Y (R uniforme)
const Yproxy = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (Sec param)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 3);
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a single result", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// calculate Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "cal");
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Y to Y (R uniforme)
const Yproxy = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (Sec param)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 3);
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a single result, plus local variated parameter", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// calculate Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "cal");
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Y to Y (R uniforme)
const Yproxy = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (Sec param)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 3);
// vary W
const W = calcPage.getInputById("W");
await calcPage.setParamMode(W, "var");
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a variated result", async () => {
// create a Régime uniforme
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(3);
// vary Q
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "var");
// calculate Y
const Y1 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y1, "cal");
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Y to Y (R uniforme)
const Yproxy = calcPage.getInputById("Y");
await calcPage.setParamMode(Yproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Yproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a PAB : dimensions
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(5);
// link Y to Y (Sec param)
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 3);
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a single extra result", async () => {
// create a Déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Q to CvQT (Déversoirs dénoyés)
const Qproxy = calcPage.getInputById("Q");
await calcPage.setParamMode(Qproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Qproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a Régime uniforme
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(3);
// link Q to CvQT (Sec param)
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "link");
const sel = await calcPage.getLinkedValueSelect(Q);
await calcPage.changeSelectValue(sel, 3);
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a single extra result, plus local variated parameter", async () => {
// create a Déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Q to CvQT (Déversoirs dénoyés)
const Qproxy = calcPage.getInputById("Q");
await calcPage.setParamMode(Qproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Qproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a Régime uniforme
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(3);
// link Q to CvQT (Sec param)
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "link");
const sel = await calcPage.getLinkedValueSelect(Q);
await calcPage.changeSelectValue(sel, 3);
// vary YB
const YB = calcPage.getInputById("YB");
await calcPage.setParamMode(YB, "var");
await computeAndCheckPresenceOfResults();
});
it(" − indirect links : parameter linked to a variated extra result", async () => {
// create a Déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
// vary BR
const BR = calcPage.getInputById("BR");
await calcPage.setParamMode(BR, "var");
// create a Section paramétrée
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(2);
// link Q to CvQT (Déversoirs dénoyés)
const Qproxy = calcPage.getInputById("Q");
await calcPage.setParamMode(Qproxy, "link");
const selYproxy = await calcPage.getLinkedValueSelect(Qproxy);
await calcPage.changeSelectValue(selYproxy, 1);
// create a Régime uniforme
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(3);
// link Q to CvQT (Sec param)
const Q = calcPage.getInputById("Q");
await calcPage.setParamMode(Q, "link");
const sel = await calcPage.getLinkedValueSelect(Q);
await calcPage.changeSelectValue(sel, 3);
await computeAndCheckPresenceOfResults();
});
});
...@@ -29,6 +29,10 @@ export class CalculatorPage { ...@@ -29,6 +29,10 @@ export class CalculatorPage {
return element(by.css("mat-select#" + id)); return element(by.css("mat-select#" + id));
} }
async getSelectValueText(select: ElementFinder) {
return await select.element(by.css(".mat-select-value-text > span")).getText();
}
getInputById(id: string) { getInputById(id: string) {
return element(by.css("input#" + id)); return element(by.css("input#" + id));
} }
...@@ -46,6 +50,14 @@ export class CalculatorPage { ...@@ -46,6 +50,14 @@ export class CalculatorPage {
return element.all(by.css('mat-button-toggle.radio_cal[ng-reflect-checked="true"]')); return element.all(by.css('mat-button-toggle.radio_cal[ng-reflect-checked="true"]'));
} }
getAddStructureButton() {
return element(by.css("fieldset-container .hyd-window-btns button.add-structure"));
}
getAllLinkButtons() {
return element.all(by.css("mat-button-toggle.radio_link"));
}
scrollTo(elt: ElementFinder) { scrollTo(elt: ElementFinder) {
browser.controlFlow().execute(function() { browser.controlFlow().execute(function() {
browser.executeScript("arguments[0].scrollIntoView(true)", elt.getWebElement()); browser.executeScript("arguments[0].scrollIntoView(true)", elt.getWebElement());
...@@ -108,11 +120,23 @@ export class CalculatorPage { ...@@ -108,11 +120,23 @@ export class CalculatorPage {
await button.click(); await button.click();
// for "var" mode, close the modal // for "var" mode, close the modal
if (mode === "var") { if (mode === "var") {
await browser.sleep(500); await browser.sleep(500); // wait for the modal to appear
await element(by.css("dialog-edit-param-values .mat-dialog-actions button")).click(); await element(by.css("dialog-edit-param-values .mat-dialog-actions button")).click();
await browser.sleep(500); // wait for the navbar to reappear after modal dismissal
} }
} }
/**
* @param elt an <input> element
*/
async getLinkedValueSelect(elt: ElementFinder): Promise<ElementFinder> {
// get parent (div.container)
const container = await this.findParentContainer(elt) as ElementFinder;
// find <select>
const select = container.element(by.css("param-link mat-select"));
return select;
}
/** /**
* Returns an object containing all the calculator's inputs values, indexed * Returns an object containing all the calculator's inputs values, indexed
* by parameter ID * by parameter ID
......
...@@ -2,7 +2,6 @@ import { AppPage } from "./app.po"; ...@@ -2,7 +2,6 @@ import { AppPage } from "./app.po";
import { ListPage } from "./list.po"; import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po"; import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po"; import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser } from "protractor"; import { browser } from "protractor";
/** /**
...@@ -13,14 +12,12 @@ describe("ngHyd − clone a calculator", () => { ...@@ -13,14 +12,12 @@ describe("ngHyd − clone a calculator", () => {
let listPage: ListPage; let listPage: ListPage;
let calcPage: CalculatorPage; let calcPage: CalculatorPage;
let navbar: Navbar; let navbar: Navbar;
let sidenav: SideNav;
beforeEach(() => { beforeEach(() => {
startPage = new AppPage(); startPage = new AppPage();
listPage = new ListPage(); listPage = new ListPage();
calcPage = new CalculatorPage(); calcPage = new CalculatorPage();
navbar = new Navbar(); navbar = new Navbar();
sidenav = new SideNav();
}); });
it("when cloning a calculator, the clone should have the same values for all parameters", async () => { it("when cloning a calculator, the clone should have the same values for all parameters", async () => {
...@@ -75,22 +72,7 @@ describe("ngHyd − clone a calculator", () => { ...@@ -75,22 +72,7 @@ describe("ngHyd − clone a calculator", () => {
const displayedVal = await calcPage.getInputById(k).getAttribute("value"); const displayedVal = await calcPage.getInputById(k).getAttribute("value");
expect(displayedVal).toBe("" + v); expect(displayedVal).toBe("" + v);
}); });
});
it("cloning a parallel-structures calculator should work", async () => {
await startPage.navigateTo();
// create source module to clone
await navbar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(8); // Lois d'ouvrages
await browser.sleep(500);
// otherwise clickCloneCalcButton() fails with "Element is not clickable at point"
// await browser.executeScript("window.scrollTo(0, 0);");
await calcPage.clickCloneCalcButton();
await browser.sleep(500);
// check existence of the cloned module // @TODO check linked value (see above)
expect(await navbar.getAllCalculatorTabs().count()).toBe(2);
}); });
}); });
import { AppPage } from "./app.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser } from "protractor";
/**
* Load a session containing 3 calculators, having linked parameters
* from one to another, triggers computation from the top-most, triggers
* results reset from the bottom-most.
* Does it once with parameters linked to parameters, once with parameters
* linked to results.
*/
describe("ngHyd − compute then reset chained results", () => {
let startPage: AppPage;
let calcPage: CalculatorPage;
let navbar: Navbar;
let sidenav: SideNav;
function init() {
startPage = new AppPage();
calcPage = new CalculatorPage();
navbar = new Navbar();
sidenav = new SideNav();
}
beforeEach(init);
it("when loading session-cascade-params.json, computation should not be chained, but results reset should", async () => {
// load session file
await startPage.navigateTo();
await navbar.clickMenuButton();
await browser.sleep(200);
await sidenav.clickLoadSessionButton();
await browser.sleep(200);
await sidenav.loadSessionFile("./session-cascade-params.json");
await browser.sleep(500);
expect(await navbar.getAllCalculatorTabs().count()).toBe(3);
// 1. get down-most module
await navbar.clickCalculatorTabForUid("dWs5bm");
// check that "compute" button is active
const calcButton = calcPage.getCalculateButton();
const disabledState = await calcButton.getAttribute("disabled");
expect(disabledState).not.toBe("true");
// click "compute" button
await calcButton.click();
// only down-most module should have results
let hasResults = await calcPage.hasResults();
// other two should not
await navbar.clickCalculatorTabForUid("OGFzOH");
hasResults = await calcPage.hasResults();
expect(hasResults).toBe(false);
await navbar.clickCalculatorTabForUid("NWp1a3");
hasResults = await calcPage.hasResults();
expect(hasResults).toBe(false);
// 2. get up-most module
await navbar.clickCalculatorTabForUid("OGFzOH");
// modify any input (for ex. "Ks")
await calcPage.getInputById("Ks").clear();
await calcPage.getInputById("Ks").sendKeys("42");
// check all 3 modules for absence of results
for (let i = 0; i < 3; i++) {
await navbar.clickCalculatorTab(i);
hasResults = await calcPage.hasResults();
expect(hasResults).toBe(false);
}
});
it("when loading session-cascade-results.json, computation and results reset should be chained", async () => {
// load session file
await startPage.navigateTo();
await navbar.clickMenuButton();
await browser.sleep(200);
await sidenav.clickLoadSessionButton();
await browser.sleep(200);
await sidenav.loadSessionFile("./session-cascade-results.json");
await browser.sleep(500);
expect(await navbar.getAllCalculatorTabs().count()).toBe(3);
// 1. get down-most module (PAB Dimensions)
await navbar.clickCalculatorTabForUid("bGZqcz");
// check that "compute" button is active
const calcButton = calcPage.getCalculateButton();
const disabledState = await calcButton.getAttribute("true");
expect(disabledState).not.toBe("true");
// click "compute" button
await calcButton.click();
// check all 3 modules for results
for (let i = 0; i < 3; i++) {
await navbar.clickCalculatorTab(i);
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(true);
}
// 2. get up-most module (Macro-rugo)
await navbar.clickCalculatorTabForUid("dnRiY2");
// modify any input (for ex. "Ks")
await calcPage.getInputById("Ks").clear();
await calcPage.getInputById("Ks").sendKeys("42");
// check all 3 modules for absence of results
for (let i = 0; i < 3; i++) {
await navbar.clickCalculatorTab(i);
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(false);
}
});
});
import { AppPage } from "./app.po";
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
/**
* Load a session containing 4 calculators, having multiple linked parameters
* from one to another
* @TODO les valeurs des Select sont comparées au français, pas très générique :/
*/
describe("ngHyd − load session with multiple linked parameters − ", () => {
let startPage: AppPage;
let listPage: ListPage;
let calcPage: CalculatorPage;
function init() {
startPage = new AppPage();
calcPage = new CalculatorPage();
listPage = new ListPage();
}
beforeEach(init);
it("when creating parallel structures, devices should be linkable to one another", async () => {
// 1. check Lois d'ouvrages
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(8);
await calcPage.getAddStructureButton().click();
const nb1 = await calcPage.getAllLinkButtons().count();
expect(nb1).toBe(8); // link buttons on children but not on parent
// 2. check Passe à bassin: Cloisons
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(10);
await calcPage.getAddStructureButton().click();
const nb2 = await calcPage.getAllLinkButtons().count();
expect(nb2).toBe(4); // link buttons on children but not on parent
// 3. check Lois de déversoirs dénoyés
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(9);
await calcPage.getAddStructureButton().click();
const nb3 = await calcPage.getAllLinkButtons().count();
expect(nb3).toBe(6); // link buttons on children but not on parent
});
});
import { AppPage } from "./app.po";
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser } from "protractor";
/**
* Load a session containing 4 calculators, having multiple linked parameters
* from one to another
* @TODO les valeurs des Select sont comparées au français, pas très générique :/
*/
describe("ngHyd − load session with multiple linked parameters − ", () => {
let startPage: AppPage;
let listPage: ListPage;
let calcPage: CalculatorPage;
let navbar: Navbar;
let sidenav: SideNav;
function init() {
startPage = new AppPage();
calcPage = new CalculatorPage();
navbar = new Navbar();
sidenav = new SideNav();
listPage = new ListPage();
}
beforeEach(init);
it("when loading session-liens-spaghetti.json, all links should point to the right target", async () => {
await startPage.navigateTo();
await navbar.clickMenuButton();
await browser.sleep(200);
await sidenav.clickLoadSessionButton();
await browser.sleep(200);
await sidenav.loadSessionFile("./session-liens-spaghetti.json");
await browser.sleep(500);
expect(await navbar.getAllCalculatorTabs().count()).toBe(5);
// 1. check Section paramétrée
await navbar.clickCalculatorTab(0);
// check target params values
const sp_lb = calcPage.getSelectById("linked_LargeurBerge");
const sp_lbv = await calcPage.getSelectValueText(sp_lb);
expect(sp_lbv).toEqual("L (Ouvrages, ouvrage 3)");
// 2. check Passe à macro-rugosités
await navbar.clickCalculatorTab(1);
// check target params values
const mr_b = calcPage.getSelectById("linked_B");
const mr_bv = await calcPage.getSelectValueText(mr_b);
expect(mr_bv).toEqual("L (résultat de Ouvrages)");
const mr_q = calcPage.getSelectById("linked_Q");
const mr_qv = await calcPage.getSelectValueText(mr_q);
expect(mr_qv).toEqual("Q (R. uniforme)");
// 3. check Lois d'ouvrages
await navbar.clickCalculatorTab(2);
// check target params values
const lo_z1 = calcPage.getSelectById("linked_Z1");
const lo_z1v = await calcPage.getSelectValueText(lo_z1);
expect(lo_z1v).toEqual("ZF1 (Macro-rugo.)");
const lo_l = calcPage.getSelectById("linked_L"); // attention ID non unique, voir nghyd#173
const lo_lv = await calcPage.getSelectValueText(lo_l);
expect(lo_lv).toEqual("L (résultat de Ouvrages)");
const lo_w = calcPage.getSelectById("linked_W"); // attention ID non unique, voir nghyd#173
const lo_wv = await calcPage.getSelectValueText(lo_w);
expect(lo_wv).toEqual("W (Ouvrages, ouvrage 2)");
const lo_cd = calcPage.getSelectById("linked_Cd"); // attention ID non unique, voir nghyd#173
const lo_cdv = await calcPage.getSelectValueText(lo_cd);
expect(lo_cdv).toEqual("Cd (Ouvrages, ouvrage 1)");
// 4. check Régime uniforme
await navbar.clickCalculatorTab(3);
// check target params values
const lo_q = calcPage.getSelectById("linked_Q");
const lo_qv = await calcPage.getSelectValueText(lo_q);
expect(lo_qv).toEqual("CvQT (Déver. dénoyés, résultat complémentaire)");
// 5. check Déver. dénoyés
await navbar.clickCalculatorTab(4);
// check target params values
const lo_br = calcPage.getSelectById("linked_BR");
const lo_brv = await calcPage.getSelectValueText(lo_br);
expect(lo_brv).toEqual("LargeurBerge (Sec. param.)");
});
});
...@@ -5,6 +5,10 @@ export class Navbar { ...@@ -5,6 +5,10 @@ export class Navbar {
return element.all(by.css("#tabs-container > button.calculator-button")); return element.all(by.css("#tabs-container > button.calculator-button"));
} }
getCalculatorTabForUid(uid: string) {
return element(by.css("#tabs-container > button.calculator-button.calculator-uid-" + uid));
}
getNewCalculatorButton() { getNewCalculatorButton() {
return element(by.css("#new-calculator")); return element(by.css("#new-calculator"));
} }
...@@ -18,6 +22,11 @@ export class Navbar { ...@@ -18,6 +22,11 @@ export class Navbar {
await tabs.get(n).click(); await tabs.get(n).click();
} }
async clickCalculatorTabForUid(uid: string) {
const tab = this.getCalculatorTabForUid(uid);
await tab.click();
}
async clickRandomCalculatorTab(n: number) { async clickRandomCalculatorTab(n: number) {
const tabs = this.getAllCalculatorTabs(); const tabs = this.getAllCalculatorTabs();
const l = await tabs.count(); const l = await tabs.count();
......
{"session":[{"uid":"NHY0cX","props":{"calcType":5,"nodeType":0},"meta":{"title":"PAB : dimensions"},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"L","mode":"SINGLE","value":2},{"symbol":"W","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.5},{"symbol":"V","mode":"CALCUL"}]},{"uid":"YzAwMW","props":{"calcType":11,"nodeType":0},"meta":{"title":"Macro-rugo."},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"ZF1","mode":"SINGLE","value":12.5},{"symbol":"L","mode":"SINGLE","value":6},{"symbol":"B","mode":"SINGLE","value":1},{"symbol":"If","mode":"SINGLE","value":0.05},{"symbol":"Q","mode":"CALCUL"},{"symbol":"Y","mode":"SINGLE","value":0.6},{"symbol":"Ks","mode":"SINGLE","value":0.01},{"symbol":"C","mode":"SINGLE","value":0.05},{"symbol":"PBD","mode":"SINGLE","value":0.5},{"symbol":"PBH","mode":"SINGLE","value":0.8},{"symbol":"Cd0","mode":"SINGLE","value":1.5}]},{"uid":"dGc5MD","props":{"calcType":8,"nodeType":0},"meta":{"title":"Ouvrages"},"structures":[{"uid":"NjZob3","props":{"calcType":7,"nodeType":5,"structureType":1,"loiDebit":1},"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"SINGLE","value":0.5},{"symbol":"L","mode":"SINGLE","value":2},{"symbol":"Cd","mode":"SINGLE","value":0.6}]}],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"SINGLE","value":102},{"symbol":"Z2","mode":"SINGLE","value":101.5}]},{"uid":"OGZ4cm","props":{"varCalc":"Hs","calcType":2,"nodeType":2},"meta":{"title":"Sec. param."},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"SINGLE","value":1.2},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.8},{"symbol":"LargeurBerge","mode":"SINGLE","value":2.5}]},{"uid":"ZTNvMD","props":{"methodeResolution":0,"calcType":4,"nodeType":2},"meta":{"title":"Remous"},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Yamont","mode":"SINGLE","value":0.15},{"symbol":"Yaval","mode":"SINGLE","value":0.4},{"symbol":"Long","mode":"SINGLE","value":100},{"symbol":"Dx","mode":"SINGLE","value":5},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"SINGLE","value":1.2},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.2863766123093061},{"symbol":"LargeurBerge","mode":"SINGLE","value":2.5}]},{"uid":"eWllan","props":{"calcType":1,"nodeType":0},"meta":{"title":"Lechapt-Calmon"},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Q","mode":"SINGLE","value":3},{"symbol":"D","mode":"SINGLE","value":1.2},{"symbol":"J","mode":"CALCUL"},{"symbol":"Lg","mode":"SINGLE","value":100},{"symbol":"L","mode":"SINGLE","value":"1.863"},{"symbol":"M","mode":"SINGLE","value":"2"},{"symbol":"N","mode":"SINGLE","value":"5.33"}]}]} {
\ No newline at end of file "session": [
{
"uid": "NHY0cX",
"props": {
"calcType": 5,
"nodeType": 0
},
"meta": {
"title": "PAB : dimensions"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 2
},
{
"symbol": "W",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "V",
"mode": "CALCUL"
}
]
},
{
"uid": "YzAwMW",
"props": {
"calcType": 11,
"nodeType": 0
},
"meta": {
"title": "Macro-rugo."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "ZF1",
"mode": "SINGLE",
"value": 12.5
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 6
},
{
"symbol": "B",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.05
},
{
"symbol": "Q",
"mode": "CALCUL"
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.6
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 0.01
},
{
"symbol": "C",
"mode": "SINGLE",
"value": 0.05
},
{
"symbol": "PBD",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "PBH",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "Cd0",
"mode": "SINGLE",
"value": 1.5
}
]
},
{
"uid": "dGc5MD",
"props": {
"calcType": 8,
"nodeType": 0
},
"meta": {
"title": "Ouvrages"
},
"structures": [
{
"uid": "NjZob3",
"props": {
"calcType": 7,
"nodeType": 5,
"structureType": 1,
"loiDebit": 1
},
"parameters": [
{
"symbol": "ZDV",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "W",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 2
},
{
"symbol": "Cd",
"mode": "SINGLE",
"value": 0.6
}
]
}
],
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Q",
"mode": "CALCUL"
},
{
"symbol": "Z1",
"mode": "SINGLE",
"value": 102
},
{
"symbol": "Z2",
"mode": "SINGLE",
"value": 101.5
}
]
},
{
"uid": "OGZ4cm",
"props": {
"varCalc": "Hs",
"calcType": 2,
"nodeType": 2
},
"meta": {
"title": "Sec. param."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 1.2
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "SINGLE",
"value": 2.5
}
]
},
{
"uid": "ZTNvMD",
"props": {
"methodeResolution": 0,
"calcType": 4,
"nodeType": 2
},
"meta": {
"title": "Remous"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Yamont",
"mode": "SINGLE",
"value": 0.15
},
{
"symbol": "Yaval",
"mode": "SINGLE",
"value": 0.4
},
{
"symbol": "Long",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "Dx",
"mode": "SINGLE",
"value": 5
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 1.2
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.2863766123093061
},
{
"symbol": "LargeurBerge",
"mode": "SINGLE",
"value": 2.5
}
]
},
{
"uid": "eWllan",
"props": {
"calcType": 1,
"nodeType": 0
},
"meta": {
"title": "Lechapt-Calmon"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 3
},
{
"symbol": "D",
"mode": "SINGLE",
"value": 1.2
},
{
"symbol": "J",
"mode": "CALCUL"
},
{
"symbol": "Lg",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "L",
"mode": "SINGLE",
"value": "1.863"
},
{
"symbol": "M",
"mode": "SINGLE",
"value": "2"
},
{
"symbol": "N",
"mode": "SINGLE",
"value": "5.33"
}
]
}
]
}
\ No newline at end of file
{
"session": [
{
"uid": "OGFzOH",
"props": {
"varCalc": "Hs",
"calcType": 2,
"nodeType": 2
},
"meta": {
"title": "Sec. param."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 1.2
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "SINGLE",
"value": 2.5
}
]
},
{
"uid": "NWp1a3",
"props": {
"calcType": 3,
"nodeType": 2
},
"meta": {
"title": "R. uniforme"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "CALCUL"
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "LINK",
"targetNub": "OGFzOH",
"targetParam": "LargeurBerge"
}
]
},
{
"uid": "dWs5bm",
"props": {
"calcType": 3,
"nodeType": 2
},
"meta": {
"title": "R. uniforme 1"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "CALCUL"
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "LINK",
"targetNub": "NWp1a3",
"targetParam": "LargeurBerge"
}
]
}
]
}
\ No newline at end of file
{
"session": [
{
"uid": "dnRiY2",
"props": {
"calcType": 11,
"nodeType": 0
},
"meta": {
"title": "Macro-rugo."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "ZF1",
"mode": "SINGLE",
"value": 12.5
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 6
},
{
"symbol": "B",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "If",
"mode": "CALCUL"
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 1.57
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.6
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 0.01
},
{
"symbol": "C",
"mode": "SINGLE",
"value": 0.05
},
{
"symbol": "PBD",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "PBH",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "Cd0",
"mode": "SINGLE",
"value": 1.5
}
]
},
{
"uid": "YjZyND",
"props": {
"calcType": 3,
"nodeType": 2
},
"meta": {
"title": "R. uniforme"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "LINK",
"targetNub": "dnRiY2",
"targetParam": "Q_GuideTech"
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "CALCUL"
}
]
},
{
"uid": "bGZqcz",
"props": {
"calcType": 5,
"nodeType": 0
},
"meta": {
"title": "PAB : dimensions"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 2
},
{
"symbol": "W",
"mode": "LINK",
"targetNub": "YjZyND",
"targetParam": "LargeurBerge"
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "V",
"mode": "CALCUL"
}
]
}
]
}
\ No newline at end of file
{
"session": [
{
"uid": "OW9rd3",
"props": {
"varCalc": "Hs",
"calcType": 2,
"nodeType": 2
},
"meta": {
"title": "Sec. param."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 1.2
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "LINK",
"targetNub": "dmh4Z3",
"targetParam": "L"
}
]
},
{
"uid": "dTB3ZG",
"props": {
"calcType": 11,
"nodeType": 0
},
"meta": {
"title": "Macro-rugo."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "ZF1",
"mode": "SINGLE",
"value": 12.5
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 6
},
{
"symbol": "B",
"mode": "LINK",
"targetNub": "ZW9icn",
"targetParam": "L"
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.05
},
{
"symbol": "Q",
"mode": "LINK",
"targetNub": "OGhuZj",
"targetParam": "Q"
},
{
"symbol": "Y",
"mode": "CALCUL"
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 0.01
},
{
"symbol": "C",
"mode": "SINGLE",
"value": 0.05
},
{
"symbol": "PBD",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "PBH",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "Cd0",
"mode": "MINMAX",
"min": 0.75,
"max": 3,
"step": 0.1125
}
]
},
{
"uid": "ZW9icn",
"props": {
"calcType": 8,
"nodeType": 0
},
"meta": {
"title": "Ouvrages"
},
"structures": [
{
"uid": "cjdyYW",
"props": {
"calcType": 7,
"nodeType": 5,
"structureType": 1,
"loiDebit": 1
},
"parameters": [
{
"symbol": "ZDV",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "W",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "L",
"mode": "CALCUL"
},
{
"symbol": "Cd",
"mode": "SINGLE",
"value": 0.6
}
]
},
{
"uid": "Ynpnaj",
"props": {
"calcType": 7,
"nodeType": 5,
"structureType": 1,
"loiDebit": 1
},
"parameters": [
{
"symbol": "ZDV",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "W",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "L",
"mode": "LINK",
"targetNub": "ZW9icn",
"targetParam": "L"
},
{
"symbol": "Cd",
"mode": "SINGLE",
"value": 0.6
}
]
},
{
"uid": "dmh4Z3",
"props": {
"calcType": 7,
"nodeType": 5,
"structureType": 1,
"loiDebit": 1
},
"parameters": [
{
"symbol": "ZDV",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "W",
"mode": "LINK",
"targetNub": "Ynpnaj",
"targetParam": "W"
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 2
},
{
"symbol": "Cd",
"mode": "LINK",
"targetNub": "cjdyYW",
"targetParam": "Cd"
}
]
}
],
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 0.5
},
{
"symbol": "Z1",
"mode": "LINK",
"targetNub": "dTB3ZG",
"targetParam": "ZF1"
},
{
"symbol": "Z2",
"mode": "SINGLE",
"value": 101.5
}
]
},
{
"uid": "OGhuZj",
"props": {
"calcType": 3,
"nodeType": 2
},
"meta": {
"title": "R. uniforme"
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "LINK",
"targetNub": "NGlpMn",
"targetParam": "CvQT"
},
{
"symbol": "If",
"mode": "MINMAX",
"min": 0.0005,
"max": 0.002,
"step": 0.00007500000000000001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "CALCUL"
}
]
},
{
"uid": "NGlpMn",
"props": {
"calcType": 9,
"nodeType": 0
},
"meta": {
"title": "Déver. dénoyés"
},
"structures": [
{
"uid": "M29rcW",
"props": {
"calcType": 7,
"nodeType": 5,
"structureType": 0,
"loiDebit": 7
},
"parameters": [
{
"symbol": "ZDV",
"mode": "SINGLE",
"value": 100
},
{
"symbol": "L",
"mode": "SINGLE",
"value": 2
},
{
"symbol": "Cd",
"mode": "SINGLE",
"value": 0.4
}
]
}
],
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Q",
"mode": "CALCUL"
},
{
"symbol": "Z1",
"mode": "SINGLE",
"value": 102
},
{
"symbol": "BR",
"mode": "LINK",
"targetNub": "OW9rd3",
"targetParam": "LargeurBerge"
},
{
"symbol": "ZR",
"mode": "SINGLE",
"value": 99
}
]
}
]
}
\ No newline at end of file
{"session":[{"uid":"N2U4OH","props":{"varCalc":"Hs","calcType":2,"nodeType":4},"meta":{"title":"Sec. param."},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"SINGLE","value":1.2},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.8},{"symbol":"LargeurBerge","mode":"SINGLE","value":4},{"symbol":"k","mode":"SINGLE","value":0.5}]}]} {
\ No newline at end of file "session": [
{
"uid": "N2U4OH",
"props": {
"varCalc": "Hs",
"calcType": 2,
"nodeType": 4
},
"meta": {
"title": "Sec. param."
},
"parameters": [
{
"symbol": "Pr",
"mode": "SINGLE",
"value": 0.0001
},
{
"symbol": "Ks",
"mode": "SINGLE",
"value": 40
},
{
"symbol": "Q",
"mode": "SINGLE",
"value": 1.2
},
{
"symbol": "If",
"mode": "SINGLE",
"value": 0.001
},
{
"symbol": "YB",
"mode": "SINGLE",
"value": 1
},
{
"symbol": "Y",
"mode": "SINGLE",
"value": 0.8
},
{
"symbol": "LargeurBerge",
"mode": "SINGLE",
"value": 4
},
{
"symbol": "k",
"mode": "SINGLE",
"value": 0.5
}
]
}
]
}
\ No newline at end of file
master 54-ameliorer-le-filtre-de-choix-des-parametres-pouvant-etre-lies
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
<!-- calculators list as a tabs bar--> <!-- calculators list as a tabs bar-->
<div id="tabs-container" [hidden]="! tabsFitInNavbar"> <div id="tabs-container" [hidden]="! tabsFitInNavbar">
<button mat-raised-button color="primary" *ngFor="let c of calculators" class="calculator-button" [title]="c.title" <button mat-raised-button color="primary" *ngFor="let c of calculators" class="" [title]="c.title"
[routerLink]="['/calculator/',c.uid]" [color]="c.active ? '' : 'primary'" [class.active]="c.active" [routerLink]="['/calculator/',c.uid]" [color]="c.active ? '' : 'primary'" (click)="setActiveCalc(c.uid)"
(click)="setActiveCalc(c.uid)"> [ngClass]="['calculator-button', 'calculator-uid-' + c.uid, c.active ? 'active' : '' ]">
<span class="calc-name"> <span class="calc-name">
{{ c.title }} {{ c.title }}
......
...@@ -115,7 +115,7 @@ button:focus { ...@@ -115,7 +115,7 @@ button:focus {
border-bottom: none; border-bottom: none;
} }
.calculator-button.mat-raised-button { .calculator-button.mat-raised-button {
height: calc(#{$navbar_height} - 3px); height: calc(#{$navbar_height} - 5px);
&:not([class*="mat-elevation-z"]) { &:not([class*="mat-elevation-z"]) {
box-shadow: -1px -2px 2px 0 rgba(0,0,0,.4),1px -2px 5px 0 rgba(0,0,0,.1); box-shadow: -1px -2px 2px 0 rgba(0,0,0,.4),1px -2px 5px 0 rgba(0,0,0,.1);
......
...@@ -18,6 +18,7 @@ import { nghydDateRev } from "../date_revision"; ...@@ -18,6 +18,7 @@ import { nghydDateRev } from "../date_revision";
import { DialogConfirmEmptySessionComponent } from "./components/dialog-confirm-empty-session/dialog-confirm-empty-session.component"; import { DialogConfirmEmptySessionComponent } from "./components/dialog-confirm-empty-session/dialog-confirm-empty-session.component";
import { DialogLoadSessionComponent } from "./components/dialog-load-session/dialog-load-session.component"; import { DialogLoadSessionComponent } from "./components/dialog-load-session/dialog-load-session.component";
import { DialogSaveSessionComponent } from "./components/dialog-save-session/dialog-save-session.component"; import { DialogSaveSessionComponent } from "./components/dialog-save-session/dialog-save-session.component";
import { NotificationsService } from "./services/notifications/notifications.service";
@Component({ @Component({
...@@ -66,6 +67,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -66,6 +67,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
private router: Router, private router: Router,
private formulaireService: FormulaireService, private formulaireService: FormulaireService,
private httpService: HttpService, private httpService: HttpService,
private notificationsService: NotificationsService,
private confirmEmptySessionDialog: MatDialog, private confirmEmptySessionDialog: MatDialog,
private saveSessionDialog: MatDialog, private saveSessionDialog: MatDialog,
private loadSessionDialog: MatDialog, private loadSessionDialog: MatDialog,
...@@ -76,6 +78,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -76,6 +78,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
ServiceFactory.instance.applicationSetupService = appSetupService; ServiceFactory.instance.applicationSetupService = appSetupService;
ServiceFactory.instance.i18nService = intlService; ServiceFactory.instance.i18nService = intlService;
ServiceFactory.instance.formulaireService = formulaireService; ServiceFactory.instance.formulaireService = formulaireService;
ServiceFactory.instance.notificationsService = notificationsService;
this.router.events.subscribe((event: Event) => { this.router.events.subscribe((event: Event) => {
// close side navigation when clicking a calculator tab // close side navigation when clicking a calculator tab
...@@ -217,16 +220,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -217,16 +220,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
// interface Observer // interface Observer
update(sender: any, data: any): void { update(sender: any, data: any): void {
if (sender instanceof ErrorService) { if (sender instanceof FormulaireService) {
// on ouvre un dialogue avec le message d'erreur reçu
// if (this._displayErrorDialog) {
// let dialogRef = this.dialog.open(AlertDialog);
// let ad: AlertDialog = dialogRef.componentInstance;
// ad.text = String(data);
// }
// else
console.log(data);
} else if (sender instanceof FormulaireService) {
switch (data["action"]) { switch (data["action"]) {
case "createForm": case "createForm":
// add newly created form to calculators list // add newly created form to calculators list
......
...@@ -19,6 +19,7 @@ import { ...@@ -19,6 +19,7 @@ import {
MatCardModule, MatCardModule,
MatTableModule, MatTableModule,
MatSnackBarModule, MatSnackBarModule,
MatBadgeModule,
ErrorStateMatcher, ErrorStateMatcher,
MatButtonToggleModule MatButtonToggleModule
} from "@angular/material"; } from "@angular/material";
...@@ -43,6 +44,7 @@ import { FormulaireService } from "./services/formulaire/formulaire.service"; ...@@ -43,6 +44,7 @@ import { FormulaireService } from "./services/formulaire/formulaire.service";
import { I18nService } from "./services/internationalisation/internationalisation.service"; import { I18nService } from "./services/internationalisation/internationalisation.service";
import { HttpService } from "./services/http/http.service"; import { HttpService } from "./services/http/http.service";
import { ApplicationSetupService } from "./services/app-setup/app-setup.service"; import { ApplicationSetupService } from "./services/app-setup/app-setup.service";
import { NotificationsService } from "./services/notifications/notifications.service";
import { AppComponent } from "./app.component"; import { AppComponent } from "./app.component";
import { NgParamInputComponent } from "./components/ngparam-input/ngparam-input.component"; import { NgParamInputComponent } from "./components/ngparam-input/ngparam-input.component";
...@@ -52,7 +54,6 @@ import { ParamComputedComponent } from "./components/param-computed/param-comput ...@@ -52,7 +54,6 @@ import { ParamComputedComponent } from "./components/param-computed/param-comput
import { ParamFieldLineComponent } from "./components/param-field-line/param-field-line.component"; import { ParamFieldLineComponent } from "./components/param-field-line/param-field-line.component";
import { ParamValuesComponent } from "./components/param-values/param-values.component"; import { ParamValuesComponent } from "./components/param-values/param-values.component";
import { SelectFieldLineComponent } from "./components/select-field-line/select-field-line.component"; import { SelectFieldLineComponent } from "./components/select-field-line/select-field-line.component";
import { CheckFieldLineComponent } from "./components/check-field-line/check-field-line.component";
import { CalculatorResultsComponent } from "./components/calculator-results/calculator-results.component"; import { CalculatorResultsComponent } from "./components/calculator-results/calculator-results.component";
import { FixedVarResultsComponent } from "./components/fixedvar-results/fixedvar-results.component"; import { FixedVarResultsComponent } from "./components/fixedvar-results/fixedvar-results.component";
import { SectionResultsComponent } from "./components/section-results/section-results.component"; import { SectionResultsComponent } from "./components/section-results/section-results.component";
...@@ -104,6 +105,7 @@ const appRoutes: Routes = [ ...@@ -104,6 +105,7 @@ const appRoutes: Routes = [
ChartModule, ChartModule,
HttpClientModule, HttpClientModule,
FlexLayoutModule, FlexLayoutModule,
MatBadgeModule,
MatButtonModule, MatButtonModule,
MatButtonToggleModule, MatButtonToggleModule,
MatCardModule, MatCardModule,
...@@ -140,7 +142,6 @@ const appRoutes: Routes = [ ...@@ -140,7 +142,6 @@ const appRoutes: Routes = [
CalculatorListComponent, CalculatorListComponent,
CalculatorNameComponent, CalculatorNameComponent,
CalculatorResultsComponent, CalculatorResultsComponent,
CheckFieldLineComponent,
DialogConfirmCloseCalcComponent, DialogConfirmCloseCalcComponent,
DialogConfirmEmptySessionComponent, DialogConfirmEmptySessionComponent,
DialogEditParamComputedComponent, DialogEditParamComputedComponent,
...@@ -189,6 +190,7 @@ const appRoutes: Routes = [ ...@@ -189,6 +190,7 @@ const appRoutes: Routes = [
FormulaireService, FormulaireService,
HttpService, HttpService,
I18nService, I18nService,
NotificationsService,
{ {
provide: ErrorStateMatcher, provide: ErrorStateMatcher,
useClass: ImmediateErrorStateMatcher useClass: ImmediateErrorStateMatcher
......
...@@ -83,7 +83,7 @@ export class ApplicationSetupComponent extends BaseComponent implements Observer ...@@ -83,7 +83,7 @@ export class ApplicationSetupComponent extends BaseComponent implements Observer
public storePreferences() { public storePreferences() {
this.appSetupService.saveValuesIntoLocalStorage(); this.appSetupService.saveValuesIntoLocalStorage();
this.snackBar.open(this.intlService.localizeText("INFO_SNACKBAR_SETTINGS_SAVED"), "OK", { this.snackBar.open(this.intlService.localizeText("INFO_SNACKBAR_SETTINGS_SAVED"), "OK", {
duration: 1200 duration: 2500
}); });
} }
...@@ -91,7 +91,7 @@ export class ApplicationSetupComponent extends BaseComponent implements Observer ...@@ -91,7 +91,7 @@ export class ApplicationSetupComponent extends BaseComponent implements Observer
const text = this.intlService.localizeText("INFO_SNACKBAR_DEFAULT_SETTINGS_RESTORED"); const text = this.intlService.localizeText("INFO_SNACKBAR_DEFAULT_SETTINGS_RESTORED");
this.appSetupService.restoreDefaultValues().then(() => { this.appSetupService.restoreDefaultValues().then(() => {
this.snackBar.open(text, "OK", { this.snackBar.open(text, "OK", {
duration: 1200 duration: 2500
}); });
}); });
} }
......
...@@ -34,7 +34,7 @@ export class NgBaseParam extends Observable { ...@@ -34,7 +34,7 @@ export class NgBaseParam extends Observable {
} }
public checkValue(val: number) { public checkValue(val: number) {
return this._param.checkValue(val); return this._param.checkValueAgainstDomain(val);
} }
public checkMin(min: number): boolean { public checkMin(min: number): boolean {
...@@ -71,11 +71,11 @@ export class NgBaseParam extends Observable { ...@@ -71,11 +71,11 @@ export class NgBaseParam extends Observable {
msg = ServiceFactory.instance.i18nService.localizeText("ERROR_PARAM_NULL"); msg = ServiceFactory.instance.i18nService.localizeText("ERROR_PARAM_NULL");
} else { } else {
try { try {
this._param.checkValue(v); this._param.checkValueAgainstDomain(v);
valid = true; valid = true;
} catch (e) { } catch (e) {
if (e instanceof Message) { if (e instanceof Message) {
// @TODO ici au début le service de localisation n'a pas encore chargé ses messages… // ici au début le service de localisation n'a pas encore chargé ses messages…
msg = ServiceFactory.instance.i18nService.localizeMessage(e); msg = ServiceFactory.instance.i18nService.localizeMessage(e);
} else { } else {
msg = "invalid value"; msg = "invalid value";
...@@ -92,8 +92,8 @@ export class NgBaseParam extends Observable { ...@@ -92,8 +92,8 @@ export class NgBaseParam extends Observable {
templateUrl: "../generic-input/generic-input.component.html", templateUrl: "../generic-input/generic-input.component.html",
}) })
export class BaseParamInputComponent extends GenericInputComponent { export class BaseParamInputComponent extends GenericInputComponent {
constructor(private intlService: I18nService, cdRef: ChangeDetectorRef) { constructor(intlService: I18nService, cdRef: ChangeDetectorRef) {
super(cdRef); super(cdRef, intlService);
} }
/** /**
......
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