From b98ed2dab6aa1a2c0c305ca9068dafdec7a570d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Sat, 28 May 2022 19:30:06 +0200 Subject: [PATCH] text(e2e): check all fields are empty on pre-dams calculator creation with "empty fields" option refs #546 --- e2e/predam-empty-fields.e2e-spec.ts | 46 ++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/e2e/predam-empty-fields.e2e-spec.ts b/e2e/predam-empty-fields.e2e-spec.ts index 68db87689..8c3c9789f 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(); -- GitLab