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

Merge branch...

Merge branch '611-perte-de-charge-les-parametres-de-loi-ne-sont-pas-modifies-quand-on-change-le-type-de-perte' into 'devel'

Resolve "Perte de charge : les paramètres de loi ne sont pas modifiés quand on change le type de perte"

Closes #611

See merge request !210
parents 4cee8d98 35e8a20b
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!210Resolve "Perte de charge : les paramètres de loi ne sont pas modifiés quand on change le type de perte"
Pipeline #140246 passed
......@@ -90,6 +90,11 @@ export class CalculatorPage {
return element(by.id(id));
}
async isMatSelectPresent(id: string) {
const sel: ElementFinder = element(by.css("mat-select#" + id));
return await sel.isPresent();
}
async getSelectValueText(select: ElementFinder) {
return await select.element(by.css(".mat-select-value-text > span")).getText();
}
......@@ -176,6 +181,11 @@ export class CalculatorPage {
return tr.element(by.css("td:nth-of-type(" + n + ")"));
}
async isNgParamPresent(id: string) {
const inp: ElementFinder = element(by.css("ngparam-input input#" + id));
return await inp.isPresent();
}
async inputHasCalcModeButton(input: ElementFinder) {
// get parent (div.container)
const container = await this.findParentContainer(input);
......
import { ListPage } from "./list.po";
import { Navbar } from "./navbar.po";
import { browser, by, element } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { PreferencesPage } from "./preferences.po";
import { changeSelectValue } from "./util.po";
describe("Pressure loss - ", () => {
let listPage: ListPage;
let navBar: Navbar;
let calcPage: CalculatorPage;
let prefPage: PreferencesPage;
beforeAll(async () => {
listPage = new ListPage();
navBar = new Navbar();
calcPage = new CalculatorPage();
prefPage = new PreferencesPage();
});
beforeEach(async () => {
// enable evil option "empty fields on module creation"
await prefPage.navigateTo();
await prefPage.disableEvilEmptyFields();
await browser.sleep(200);
});
describe("modify pressure loss law displays the appropriate fields - ", () => {
it("Lechapt&Calmon", async () => {
// open "pressure loss" calculator
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(35);
await browser.sleep(200);
// select Lechapt-Calmon pressure loss law
const materialSelect = calcPage.getSelectById("select_pressurelosstype");
await changeSelectValue(materialSelect, 0);
await browser.sleep(200);
// check inputs presence
expect(await calcPage.isNgParamPresent("Q")).toBe(true);
expect(await calcPage.isNgParamPresent("D")).toBe(true);
expect(await calcPage.isNgParamPresent("J")).toBe(true); // en calcul (donc id=calc_J mais ça marche quand même !)
expect(await calcPage.isNgParamPresent("Lg")).toBe(true);
expect(await calcPage.isNgParamPresent("Kloc")).toBe(true);
// check material select
expect(await calcPage.isMatSelectPresent("select_material")).toBe(true);
});
it("Strickler", async () => {
browser.manage().window().setPosition(2000, 30);
// open "pressure loss" calculator
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(35);
await browser.sleep(200);
// select Strickler pressure loss law
const materialSelect = calcPage.getSelectById("select_pressurelosstype");
await changeSelectValue(materialSelect, 1);
await browser.sleep(200);
debugger
// check inputs presence
const ks = element(by.id("0_Ks"));
expect(await ks.isPresent()).toBe(true); // isNgParamPresent does not work on "0_Ks". Why ? Mystery...
expect(await calcPage.isNgParamPresent("Q")).toBe(true);
expect(await calcPage.isNgParamPresent("D")).toBe(true);
expect(await calcPage.isNgParamPresent("J")).toBe(true);
expect(await calcPage.isNgParamPresent("Lg")).toBe(true);
expect(await calcPage.isNgParamPresent("Kloc")).toBe(true);
});
});
});
......@@ -38,7 +38,7 @@ export class FormulairePressureLoss extends FormulaireFixedVar {
public update(sender: IObservable, data: any) {
// if (sender instanceof FieldSet && sender.id === "fs_pressureloss_law" && data.action === "propertyChange") {
if (data.action === "propertyChange") {
if (data.name === "pressurelosstype") {
if (data.name === "pressureLossType") {
// changement de propriété du FieldSet contenant le select de choix du type de perte de charge
// replace underlying pressure loss law without replacing whole Nub
......
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