From 160f906368f403659070c9235359de34ef2d0d9b Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Tue, 22 Oct 2019 12:11:15 +0200
Subject: [PATCH] Updated e2e for Solveur compliance

---
 e2e/calculate-all-params.e2e-spec.ts |  7 ++++++-
 e2e/check-translations.e2e-spec.ts   | 15 ++++++++-------
 e2e/clone-all-calc.e2e-spec.ts       |  7 ++++++-
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/e2e/calculate-all-params.e2e-spec.ts b/e2e/calculate-all-params.e2e-spec.ts
index 6f5632baf..9533c2fca 100644
--- a/e2e/calculate-all-params.e2e-spec.ts
+++ b/e2e/calculate-all-params.e2e-spec.ts
@@ -18,7 +18,12 @@ describe("ngHyd − calculate all parameters of all calculators", () => {
   });
 
   // get calculators list (IDs) @TODO read it from config, but can't import jalhyd here :/
-  const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21 ];
+  const calcTypes = [
+    0, 1, 2, 3, 4, 5, 6, 8, 9, 10,
+    11, 12, 13, 15, 17, 18, 19, 20,
+    21,
+    // 22 - Solveur is not calculated here because it is not independent
+  ];
 
   // for each calculator
   for (const ct of calcTypes) {
diff --git a/e2e/check-translations.e2e-spec.ts b/e2e/check-translations.e2e-spec.ts
index 2aef4ff34..b0c10f970 100644
--- a/e2e/check-translations.e2e-spec.ts
+++ b/e2e/check-translations.e2e-spec.ts
@@ -25,7 +25,7 @@ describe("ngHyd − check translation of all calculators", () => {
   });
 
   // get calculators list (IDs) @TODO read it from config, but can't import jalhyd here :/
-  const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21 ];
+  const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22 ];
 
   // options of "Language" selector on preferences page
   const langs = [ "English", "Français" ];
@@ -67,12 +67,13 @@ describe("ngHyd − check translation of all calculators", () => {
           // 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);
+          if (! disabledState) {
+            // click "compute" button
+            await calcButton.click();
+            // check that result is not empty
+            const hasResults = await calcPage.hasResults();
+            expect(hasResults).toBe(true);
+          }
 
           // check absence of "*** message not found" in whole DOM
           expect(await browser.getPageSource()).not.toContain("*** message not found");
diff --git a/e2e/clone-all-calc.e2e-spec.ts b/e2e/clone-all-calc.e2e-spec.ts
index e5b77dcd1..8c32c1ff6 100644
--- a/e2e/clone-all-calc.e2e-spec.ts
+++ b/e2e/clone-all-calc.e2e-spec.ts
@@ -18,7 +18,12 @@ describe("ngHyd − clone all calculators with all possible <select> values", ()
   });
 
   // get calculators list (IDs) @TODO read it from config, but can't import jalhyd here :/
-  const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21 ];
+  const calcTypes = [
+    0, 1, 2, 3, 4, 5, 6, 8, 9, 10,
+    11, 12, 13, 15, 17, 18, 19, 20,
+    21,
+    // 22 - Solveur is not cloned here because it is not independent
+  ];
 
   // for each calculator
   for (const ct of calcTypes) {
-- 
GitLab