From e648460ee20b52a2346ffaf510f9c79acba0ed1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Wed, 17 May 2023 16:23:33 +0200
Subject: [PATCH] test(e2e): predams: check that results are not displayed when
 dichotomy convergence error occurred along with another error

refs #614
---
 e2e/predam-log.e2e-spec.ts | 50 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/e2e/predam-log.e2e-spec.ts b/e2e/predam-log.e2e-spec.ts
index 0e7e99fe..07c936d1 100644
--- a/e2e/predam-log.e2e-spec.ts
+++ b/e2e/predam-log.e2e-spec.ts
@@ -128,4 +128,54 @@ describe("predams - ", () => {
         const hasResults = await calcPage.hasResults();
         expect(hasResults).toBe(true);
     });
+
+    it("check results (dichotomy did not converge + submergence error)", async () => {
+        await startPage.navigateTo();
+        await browser.pause(200);
+
+        // open predams example
+        const examples = await $$("#examples-list .load-example");
+        await examples[6].click();
+        await browser.pause(500);
+
+        // modify iteration count,precision (should trigger submergence+dichotomy non convergence errors)
+        await prefPage.navigateTo();
+        await browser.pause(200);
+        await prefPage.setIterationCount(20);
+        await prefPage.setComputePrecision(1e-15);
+
+        // back to module
+        await navBar.openNthCalculator(0);
+        await browser.pause(500);
+
+        // click "Amont-B2" 
+        const nodes = await $$("g.nodes > g");
+        const node = nodes[9];
+        await scrollToElement(node);
+        await browser.pause(100);
+        await node.click();
+        await browser.pause(200);
+
+        // change discharge law to Larinier
+        const sel = await calcPage.getSelectById("select_loidebit");
+        await changeSelectValue(sel, 3);
+        await browser.pause(100);
+
+        // calculate module
+        const calcBtn = await calcPage.getCalculateButton();
+        await calcBtn.click();
+        await browser.pause(300);
+
+        // check that results are empty
+        const hasResults = await calcPage.hasResults();
+        expect(hasResults).toBe(false);
+
+        // check log messages
+        expect(await calcPage.hasLog()).toBe(true);
+        expect(await calcPage.nbLogEntries()).toBe(4);
+        expect(await calcPage.nthLogEntryIsWarning(0)).toBe(true);
+        expect(await calcPage.nthLogEntryIsError(1)).toBe(true);
+        expect(await calcPage.nthLogEntryIsWarning(2)).toBe(true);
+        expect(await calcPage.nthLogEntryIsError(3)).toBe(true);
+    });
 });
-- 
GitLab