diff --git a/e2e/remous.e2e-spec.ts b/e2e/remous.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..d057fa5924364537982086f7d5400db86c945b86 --- /dev/null +++ b/e2e/remous.e2e-spec.ts @@ -0,0 +1,46 @@ +import { AppPage } from "./app.po"; +import { ListPage } from "./list.po"; +import { CalculatorPage } from "./calculator.po"; +import { browser } from "protractor"; +import { Navbar } from "./navbar.po"; + +/** + * Remous + */ +describe("ngHyd − remous", () => { + let startPage: AppPage; + let listPage: ListPage; + let calcPage: CalculatorPage; + let navBar: Navbar; + + beforeEach(() => { + startPage = new AppPage(); + listPage = new ListPage(); + calcPage = new CalculatorPage(); + navBar = new Navbar(); + }); + + it("when leaving calculated remous page then coming back to it, logs should not be duplicated", async () => { + await startPage.navigateTo(); + + // 1. create new Remous + await listPage.clickMenuEntryForCalcType(4); + await browser.sleep(300); + + // 2. calculate it, there should be 6 messages in the log + await calcPage.getCalculateButton().click(); + expect(await calcPage.nbLogEntries()).toBe(6); + await browser.sleep(300); + + // 3. go to home page (simplest example) + await navBar.clickNewCalculatorButton(); + await browser.sleep(300); + + // 4. go back to Remous + await navBar.clickCalculatorTab(0); + await browser.sleep(300); + + // 5. there should still be 6 messages in the log + expect(await calcPage.nbLogEntries()).toBe(6); + }); +}); diff --git a/src/app/results/remous-results.ts b/src/app/results/remous-results.ts index 60b6b6a7485ac3244311042a9fdb2b532b615b6a..6f0c84f42fcc5977a0165eb01ff36bae02a826c0 100644 --- a/src/app/results/remous-results.ts +++ b/src/app/results/remous-results.ts @@ -101,7 +101,7 @@ export class RemousResults extends CalculatorResults { this._xValues.setValues(0, Long, Dx); } - public get log() { + public get log(): cLog { return this._log; } @@ -134,6 +134,7 @@ export class RemousResults extends CalculatorResults { } } + this._log.clear(); this._log.addLog(this._result.globalLog); this._varResults = new VarResults();