From 81b39985b5397b081fd045db07014c0201314627 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 3 Mar 2023 08:04:57 +0100
Subject: [PATCH 1/3] test(e2e): check that notes are displayed properly

refs #602
---
 e2e/notes.e2e-spec.ts | 92 +++++++++++++++++++++++++++++++++++++++++++
 e2e/sidenav.po.ts     | 10 +++++
 2 files changed, 102 insertions(+)
 create mode 100644 e2e/notes.e2e-spec.ts

diff --git a/e2e/notes.e2e-spec.ts b/e2e/notes.e2e-spec.ts
new file mode 100644
index 000000000..2419119a8
--- /dev/null
+++ b/e2e/notes.e2e-spec.ts
@@ -0,0 +1,92 @@
+import { browser, by, element } from "protractor";
+import { AppPage } from "./app.po";
+import { Navbar } from "./navbar.po";
+import { ListPage } from "./list.po";
+import { SideNav } from "./sidenav.po";
+
+describe("check calculator notes", () => {
+    let startPage: AppPage;
+    let navBar: Navbar;
+    let listPage: ListPage;
+    let sidenav: SideNav;
+
+    beforeEach(() => {
+        startPage = new AppPage();
+        navBar = new Navbar();
+        listPage = new ListPage();
+        sidenav = new SideNav();
+    });
+
+    it(" - notes should display properly when opened from a calculator", async () => {
+        await startPage.navigateTo();
+        await browser.sleep(200);
+
+        // open PAB: chute calculator
+        await listPage.clickMenuEntryForCalcType(12);
+        await browser.sleep(200);
+
+        // open notes
+        await navBar.clickMenuButton();
+        await browser.sleep(200);
+        await sidenav.clickNotesButton();
+        await browser.sleep(200);
+
+        // input some text
+        const ta = element(by.css("textarea"));
+        await ta.clear();
+        await ta.sendKeys("azerty123");
+        await browser.sleep(200);
+
+        // reopen calculator
+        await navBar.openNthCalculator(0);
+        await browser.sleep(200);
+
+        // reopen notes
+        await navBar.clickMenuButton();
+        await browser.sleep(200);
+        await sidenav.clickNotesButton();
+        await browser.sleep(200);
+
+        // check text
+        const md = element(by.css("markdown p"));
+        await browser.sleep(200);
+        expect(await md.getText()).toEqual("azerty123");
+    });
+
+    it(" - notes should display properly when opened from modules diagram", async () => {
+        await startPage.navigateTo();
+        await browser.sleep(200);
+
+        // open PAB: chute calculator
+        await listPage.clickMenuEntryForCalcType(12);
+        await browser.sleep(200);
+
+        // open notes
+        await navBar.clickMenuButton();
+        await browser.sleep(200);
+        await sidenav.clickNotesButton();
+        await browser.sleep(200);
+
+        // input some text
+        const ta = element(by.css("textarea"));
+        await ta.clear();
+        await ta.sendKeys("azerty123");
+        await browser.sleep(200);
+
+        // open modules diagram
+        await navBar.clickMenuButton();
+        await browser.sleep(200);
+        await sidenav.clickDiagramButton();
+        await browser.sleep(200);
+
+        // open notes
+        const notesLink = element(by.css("#show-notes a"));
+        notesLink.click();
+        await browser.sleep(200);
+
+        // check text
+        const md = element(by.css("markdown p"));
+        await browser.sleep(200);
+        expect(await md.getText()).toEqual("azerty123");
+    });
+});
diff --git a/e2e/sidenav.po.ts b/e2e/sidenav.po.ts
index 5b4060f52..596db0a86 100644
--- a/e2e/sidenav.po.ts
+++ b/e2e/sidenav.po.ts
@@ -31,6 +31,10 @@ export class SideNav {
         return element(by.css(`button#confirm-new-session`));
     }
 
+    getNotesButton() {
+        return element(by.css("#side-nav-session-props"));
+    }
+
     async clickLoadSessionButton() {
         const ncb = this.getLoadSessionButton();
         await browser.sleep(500);
@@ -60,4 +64,10 @@ export class SideNav {
             await this.getFileLoadButton().click();
         }
     }
+
+    async clickNotesButton() {
+        const nb = this.getNotesButton();
+        await browser.sleep(200);
+        await nb.click();
+    }
 }
-- 
GitLab


From 0793068d5879d10a5c7c0a1e5e2bdce97b41a6de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Tue, 14 Feb 2023 14:38:42 +0100
Subject: [PATCH 2/3] fix: session notes do not display properly

refs #602
---
 src/index.html | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/index.html b/src/index.html
index 5a2324c1d..ff5eb8617 100644
--- a/src/index.html
+++ b/src/index.html
@@ -14,8 +14,19 @@
    <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#ffffff">
 
    <meta name="viewport" content="width=device-width, initial-scale=1">
-  <link rel="manifest" href="manifest.webmanifest">
-  <meta name="theme-color" content="#1976d2">
+   <link rel="manifest" href="manifest.webmanifest">
+   <meta name="theme-color" content="#1976d2">
+
+   <!-- fix error message "When using the `katex` attribute you *have to* include KaTeX files to `angular.json` or use imports" -->
+   <!-- cf. nghyd#602 -->
+   <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css"
+      integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
+   <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js"
+      integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4"
+      crossorigin="anonymous"></script>
+   <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/contrib/auto-render.min.js"
+      integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
+      onload="renderMathInElement(document.body);"></script>
 </head>
 
 <body>
@@ -163,4 +174,4 @@
   <noscript>Please enable JavaScript to continue using this application.</noscript>
 </body>
 
-</html>
\ No newline at end of file
+</html>
-- 
GitLab


From fa05091068cb2f798c0e67535f1554ebc1400d71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Thu, 2 Mar 2023 14:55:04 +0100
Subject: [PATCH 3/3] fix: session notes do not display properly (angular.json
 solution)

refs #602
---
 angular.json   |  3 ++-
 src/index.html | 11 -----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/angular.json b/angular.json
index 7af026e53..1b463deca 100644
--- a/angular.json
+++ b/angular.json
@@ -49,7 +49,8 @@
             ],
             "scripts": [
               "node_modules/marked/marked.min.js",
-              "node_modules/katex/dist/katex.min.js"
+              "node_modules/katex/dist/katex.min.js",
+              "node_modules/katex/dist/contrib/auto-render.min.js"
             ],
             "allowedCommonJsDependencies": [
               "chartjs-plugin-zoom",
diff --git a/src/index.html b/src/index.html
index ff5eb8617..a1fbb0362 100644
--- a/src/index.html
+++ b/src/index.html
@@ -16,17 +16,6 @@
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="manifest" href="manifest.webmanifest">
    <meta name="theme-color" content="#1976d2">
-
-   <!-- fix error message "When using the `katex` attribute you *have to* include KaTeX files to `angular.json` or use imports" -->
-   <!-- cf. nghyd#602 -->
-   <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css"
-      integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
-   <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js"
-      integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4"
-      crossorigin="anonymous"></script>
-   <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/contrib/auto-render.min.js"
-      integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
-      onload="renderMathInElement(document.body);"></script>
 </head>
 
 <body>
-- 
GitLab