From 5a56f2eb08afe171999f1c1d526863e958809b6a Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Fri, 12 Jul 2019 17:48:56 +0200
Subject: [PATCH] added e2e test for variable PAB

---
 e2e/calculator.po.ts | 6 +++++-
 e2e/pab.e2e-spec.ts  | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts
index e94c27d19..1c1bd2a52 100644
--- a/e2e/calculator.po.ts
+++ b/e2e/calculator.po.ts
@@ -97,7 +97,11 @@ export class CalculatorPage {
   }
 
   async hasLog() {
-    return (await element.all(by.css("log-entry")).count()) > 0;
+    return await this.nbLogEntries() > 0;
+  }
+
+  async nbLogEntries() {
+    return await element.all(by.css("log-entry")).count();
   }
 
   async clickSaveCalcButton() {
diff --git a/e2e/pab.e2e-spec.ts b/e2e/pab.e2e-spec.ts
index 6d6ad1a5b..f9c78ac5b 100644
--- a/e2e/pab.e2e-spec.ts
+++ b/e2e/pab.e2e-spec.ts
@@ -164,7 +164,14 @@ describe("ngHyd − Passe à Bassins", () => {
       expect(hasResults).toBe(true);
 
       // check presence of logs
-      expect(await calcPage.hasLog()).toBe(true);
+      expect(await calcPage.nbLogEntries()).toBe(2);
+
+      // change iteration
+      const pve = calcPage.getSelectById("pab-variating-element");
+      calcPage.changeSelectValue(pve, 3);
+      await browser.sleep(300);
+      // check absence of logs
+      expect(await calcPage.nbLogEntries()).toBe(1);
     });
 
   });
-- 
GitLab