diff --git a/e2e/predam-empty-fields.e2e-spec.ts b/e2e/predam-empty-fields.e2e-spec.ts index 68db87689b478f2cc5693494404d00bf927575e0..8c3c9789f0fd14336905ab5d2a1619b1efd009af 100644 --- a/e2e/predam-empty-fields.e2e-spec.ts +++ b/e2e/predam-empty-fields.e2e-spec.ts @@ -7,7 +7,7 @@ import { PreferencesPage } from "./preferences.po" /** * check that fields are empty on creation */ -describe("ngHyd − check that predam fields are empty on creation", () => { +describe("ngHyd − check that predam fields are empty", () => { let listPage: ListPage; let prefPage: PreferencesPage; let navBar: Navbar; @@ -26,6 +26,50 @@ describe("ngHyd − check that predam fields are empty on creation", () => { await browser.sleep(200); }); + async function checkEmptyInput(id: string) { + const inp = calcPage.getInputById(id); + const val = await inp.getAttribute("value"); + expect(val).toEqual(""); + } + + it("on creation", async () => { + //browser.manage().window().setPosition(2000, 30); + // open predam calculator + await navBar.clickNewCalculatorButton(); + await listPage.clickMenuEntryForCalcType(30); + await browser.sleep(200); + + // check upstream inputs + await checkEmptyInput("Q"); + // Z1 is calculated + await checkEmptyInput("Z2"); + + // check basin 1 inputs + let node = element(by.css("g.node.basin")); + await node.click(); + await browser.sleep(200); + await checkEmptyInput("0_S"); + await checkEmptyInput("0_ZF"); + + // check walls inputs + const walls = element.all(by.css("g.node.wall")); + expect(walls.count()).toEqual(2); + await walls.each(async (w) => { + await w.click(); + await browser.sleep(200); + await checkEmptyInput("0_ZDV"); + await checkEmptyInput("0_L"); + }); + + // check downstream basin inputs + node = element(by.id("aval")); + await node.click(); + await browser.sleep(200); + checkEmptyInput("Q"); + // Z1 is calculated + checkEmptyInput("Z2"); + }); + it("when a basin is added", async () => { // open predam calculator await navBar.clickNewCalculatorButton();