From 089f3de8ce5d896980605cfce2ddd36ac0088cb7 Mon Sep 17 00:00:00 2001 From: Mathias Chouet <mathias.chouet@irstea.fr> Date: Tue, 5 May 2020 16:57:59 +0200 Subject: [PATCH] Updated e2e for new Section results --- e2e/calculator.po.ts | 19 ++++++++++++------- e2e/compute-reset-chained-links.e2e-spec.ts | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts index 2639f2077..fb065df26 100644 --- a/e2e/calculator.po.ts +++ b/e2e/calculator.po.ts @@ -121,22 +121,27 @@ export class CalculatorPage { async hasResults() { return ( - await element(by.css("fixedvar-results fixed-results > .fixed-results-container")).isPresent() + await this.presentAndVisible("fixedvar-results fixed-results > .fixed-results-container") || - await element(by.css("fixedvar-results results-chart > chart-results-container")).isPresent() + await this.presentAndVisible("fixedvar-results results-chart > chart-results-container") || - await element(by.css("section-results fixed-results > .fixed-results-container")).isPresent() + await this.presentAndVisible("section-results fixed-results > .fixed-results-container") || - await element(by.css("remous-results #main-chart")).isPresent() + await this.presentAndVisible("remous-results #main-chart") || - await element(by.css("pab-results pab-results-table")).isPresent() + await this.presentAndVisible("pab-results pab-results-table") || - await element(by.css("macrorugo-compound-results macrorugo-compound-results-table")).isPresent() + await this.presentAndVisible("macrorugo-compound-results macrorugo-compound-results-table") || - await element(by.css("jet-results .fixed-results-container")).isPresent() + await this.presentAndVisible("jet-results .fixed-results-container") ); } + async presentAndVisible(selector: string): Promise<boolean> { + const elt = element(by.css(selector)); + return await elt.isPresent() && await elt.isDisplayed(); + } + /** * For a given <table> element, check that values of all cells of all rows in <tbody> are * different from "NaN", "ERR" and optionally "" diff --git a/e2e/compute-reset-chained-links.e2e-spec.ts b/e2e/compute-reset-chained-links.e2e-spec.ts index c0ba8e5f4..75ac102b9 100644 --- a/e2e/compute-reset-chained-links.e2e-spec.ts +++ b/e2e/compute-reset-chained-links.e2e-spec.ts @@ -45,6 +45,7 @@ describe("ngHyd − compute then reset chained results − ", () => { // down-most module should have results let hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(true); // up-most should not await navbar.clickCalculatorTabForUid("ZTFxeW"); hasResults = await calcPage.hasResults(); -- GitLab