diff --git a/e2e/check-translations.e2e-spec.ts b/e2e/check-translations.e2e-spec.ts index af7abc20088b6f84eff0193cc06d957b451cd601..bfdaf3f88b21c320b54d6897c0d2297cc23f0757 100644 --- a/e2e/check-translations.e2e-spec.ts +++ b/e2e/check-translations.e2e-spec.ts @@ -9,7 +9,7 @@ import { SideNav } from "./sidenav.po"; * For all calculators, try to calculate every parameter: check that only one parameter * is set to CAL mode, trigger the calculation, check that result is not empty */ -fdescribe("ngHyd − check translation of all calculators", () => { +describe("ngHyd − check translation of all calculators", () => { let listPage: ListPage; let calcPage: CalculatorPage; let navBar: Navbar; @@ -37,15 +37,29 @@ fdescribe("ngHyd − check translation of all calculators", () => { beforeAll(async () => { await prefPage.navigateTo(); await prefPage.changeLanguage(i); - await browser.sleep(2000); + await browser.sleep(200); + await navBar.clickNewCalculatorButton(); + }); + + beforeEach(function () { + jasmine.addMatchers({ + toContain: function () { + return { + compare: function (actual, expected) { + const result = { + pass: actual.includes(expected), + message: "error" // short message to avoid whole page source being dumped on expect() failure + }; + return result; + } + }; + } + }); }); // for each calculator for (const ct of calcTypes) { it(" − check translations of calculator type [" + ct + "]", async () => { - // go to list page - await navBar.clickNewCalculatorButton(); - // click calculator button (instanciate) await listPage.clickMenuEntryForCalcType(ct); @@ -60,10 +74,12 @@ fdescribe("ngHyd − check translation of all calculators", () => { const hasResults = await calcPage.hasResults(); expect(hasResults).toBe(true); - // @TODO check absence of "*** message not found" in whole DOM - expect(" SOURCE CODE ").not.toContain("*** message not found"); + // check absence of "*** message not found" in whole DOM + expect(await browser.getPageSource()).not.toContain("*** message not found"); - // close calc + // empty session + await navBar.clickMenuButton(); + await browser.sleep(200); await sideNav.clickNewSessionButton(); browser.sleep(200); });