diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts index f2b98b2d9f606cd83c86316d46287b1e493676c1..91878a7380ec1d33e7fbedfab4b36a1c6abd00a7 100644 --- a/e2e/calculator.po.ts +++ b/e2e/calculator.po.ts @@ -441,4 +441,11 @@ export class CalculatorPage { n++; } } + + /** + * get help button related to calculator + */ + getCalculatorHelpButton() { + return element(by.css("#help-calc")); + } } diff --git a/e2e/documentation.e2e-spec.ts b/e2e/documentation.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea30f5ab58e3984971ee3828d59d9875bd6d37b3 --- /dev/null +++ b/e2e/documentation.e2e-spec.ts @@ -0,0 +1,55 @@ +import { ListPage } from "./list.po"; +import { CalculatorPage } from "./calculator.po"; +import { Navbar } from "./navbar.po"; +import { browser, by, element } from "protractor"; +import { PreferencesPage } from "./preferences.po"; + +describe("documentation − ", () => { + let listPage: ListPage; + let calcPage: CalculatorPage; + let prefPage: PreferencesPage; + let navbar: Navbar; + + beforeAll(() => { + calcPage = new CalculatorPage(); + prefPage = new PreferencesPage(); + navbar = new Navbar(); + listPage = new ListPage(); + + // browser.manage().window().setPosition(2000, 30); + }); + + async function checkMathjaxInHelp(lang: number) { + // change setup to French + await prefPage.navigateTo(); + await prefPage.changeLanguage(lang); + await browser.sleep(200); + + // start page + await navbar.clickNewCalculatorButton(); + + // open "fish ladder: fall" calculator + await listPage.clickMenuEntryForCalcType(12); + await browser.sleep(200); + + // click help + await calcPage.getCalculatorHelpButton().click(); + await browser.sleep(200); + + browser.getAllWindowHandles().then(async (handles) => { + browser.ignoreSynchronization = true; // deprecated but the only solution to work in the newly opened tab + browser.switchTo().window(handles[1]).then(async () => { + // check Mathjax element is present + expect(element.all(by.css("mjx-container")).isPresent()).toBe(true); + }); + }); + } + + it("check Mathjax formula are displayed in calculator French help", async () => { + await checkMathjaxInHelp(1); // fr + }); + + it("check Mathjax formula are displayed in calculator English help", async () => { + await checkMathjaxInHelp(0); // en + }); +});