Skip to content
Snippets Groups Projects
Commit fff63730 authored by AUBRY JEAN-PASCAL's avatar AUBRY JEAN-PASCAL
Browse files

fix: modification of defectives spec (nghyd #329)

Refs #659
parent e6451b05
No related branches found
No related tags found
2 merge requests!275Release v4.19.0,!256Mise à jour vers Angular 15
......@@ -57,6 +57,83 @@ describe("ngHyd − calculate with linked parameters", () => {
expect(hasResults).toBe(true);
}
it(" − bug nghyd#329 : unexpected ERR in results table", async () => {
await navBar.clickNewCalculatorButton();
await browser.pause(200);
// load session
await loadSession(navBar, sideNav, "./session/session-pab-chain-nghyd-329.json");
expect(await navBar.getAllCalculatorTabs().length).toBe(3);
// calculate PAB-Dimensions
await navBar.clickCalculatorTab(2);
await browser.pause(200);
// click "compute" button
const calcButton = await calcPage.getCalculateButton();
await calcButton.click();
await browser.pause(300);
// check that result is not empty
expect(await calcPage.hasResults()).toBe(true);
// check that ERR is not present in Volume line of results table
let frt = await calcPage.getFixedResultsTable();
let volumeRow = await calcPage.getNthRow(frt, 3);
let volumeCol = await calcPage.getNthColumn(volumeRow, 2);
let volume = await volumeCol.getText();
expect(Number(volume)).toBeCloseTo(44.565, 3);
// click PAB-Nombre tab
await navBar.clickCalculatorTab(0);
await browser.pause(200);
// go back to PAB-Dimensions
await navBar.clickCalculatorTab(2);
await browser.pause(200);
// check that ERR is not present in Volume line of results table
frt = await calcPage.getFixedResultsTable();
volumeRow = await calcPage.getNthRow(frt, 3);
volumeCol = await calcPage.getNthColumn(volumeRow, 2);
volume = await volumeCol.getText();
expect(Number(volume)).toBeCloseTo(44.565, 3);
});
it(" − a link target parameter should not be able to link to another parameter", async () => {
// create 1st PAB-Chute
await openCalculator(12, navBar, listPage);
// upstream water level should not have link mode (only one calculator)
let Z1_1 = await calcPage.getInputById("Z1");
expect(await calcPage.inputHasLinkModeButton(Z1_1)).toBe(false);
// create 2nd PAB-Chute
await openCalculator(12, navBar, listPage);
// back to 1st calculator
await navBar.clickCalculatorTab(0);
await browser.pause(200);
// upstream water level should have link mode (now there are 2 calculators)
Z1_1 = await calcPage.getInputById("Z1"); // re-request input to avoid "Request encountered a stale element - terminating request" warning (due to tab change)
expect(await calcPage.inputHasLinkModeButton(Z1_1)).toBe(true);
// back to 2nd calculator
await navBar.clickCalculatorTab(1);
await browser.pause(200);
// link upstream water level in 2nd calculator to upstream water level in 1st one
const Z1_2 = await calcPage.getInputById("Z1");
await calcPage.setParamMode(Z1_2, "link");
// back to 1st calculator
await navBar.clickCalculatorTab(0);
await browser.pause(200);
// upstream water level should not have link mode (already a link target)
Z1_1 = await calcPage.getInputById("Z1"); // re-request input to avoid "Request encountered a stale element - terminating request" warning (due to tab change)
expect(await calcPage.inputHasLinkModeButton(Z1_1)).toBe(false);
});
it(" − direct links : parameter linked to a single parameter", async () => {
// create a Régime uniforme
await openCalculator(3, navBar, listPage);
......@@ -261,81 +338,4 @@ describe("ngHyd − calculate with linked parameters", () => {
expect(td.getText()).not.toBe("");
});
});
it(" − bug nghyd#329 : unexpected ERR in results table", async () => {
await navBar.clickNewCalculatorButton();
await browser.pause(200);
// load session
await loadSession(navBar, sideNav, "./session/session-pab-chain-nghyd-329.json");
expect(await navBar.getAllCalculatorTabs().length).toBe(3);
// calculate PAB-Dimensions
await navBar.clickCalculatorTab(2);
await browser.pause(200);
// click "compute" button
const calcButton = await calcPage.getCalculateButton();
await calcButton.click();
await browser.pause(300);
// check that result is not empty
expect(await calcPage.hasResults()).toBe(true);
// check that ERR is not present in Volume line of results table
let frt = await calcPage.getFixedResultsTable();
let volumeRow = await calcPage.getNthRow(frt, 3);
let volumeCol = await calcPage.getNthColumn(volumeRow, 2);
let volume = await volumeCol.getText();
expect(Number(volume)).toBeCloseTo(44.565, 3);
// click PAB-Nombre tab
await navBar.clickCalculatorTab(0);
await browser.pause(200);
// go back to PAB-Dimensions
await navBar.clickCalculatorTab(2);
await browser.pause(200);
// check that ERR is not present in Volume line of results table
frt = await calcPage.getFixedResultsTable();
volumeRow = await calcPage.getNthRow(frt, 3);
volumeCol = await calcPage.getNthColumn(volumeRow, 2);
volume = await volumeCol.getText();
expect(Number(volume)).toBeCloseTo(44.565, 3);
});
it(" − a link target parameter should not be able to link to another parameter", async () => {
// create 1st PAB-Chute
await openCalculator(12, navBar, listPage);
// upstream water level should not have link mode (only one calculator)
let Z1_1 = await calcPage.getInputById("Z1");
expect(await calcPage.inputHasLinkModeButton(Z1_1)).toBe(false);
// create 2nd PAB-Chute
await openCalculator(12, navBar, listPage);
// back to 1st calculator
await navBar.clickCalculatorTab(0);
await browser.pause(200);
// upstream water level should have link mode (now there are 2 calculators)
Z1_1 = await calcPage.getInputById("Z1"); // re-request input to avoid "Request encountered a stale element - terminating request" warning (due to tab change)
expect(await calcPage.inputHasLinkModeButton(Z1_1)).toBe(true);
// back to 2nd calculator
await navBar.clickCalculatorTab(1);
await browser.pause(200);
// link upstream water level in 2nd calculator to upstream water level in 1st one
const Z1_2 = await calcPage.getInputById("Z1");
await calcPage.setParamMode(Z1_2, "link");
// back to 1st calculator
await navBar.clickCalculatorTab(0);
await browser.pause(200);
// upstream water level should not have link mode (already a link target)
Z1_1 = await calcPage.getInputById("Z1"); // re-request input to avoid "Request encountered a stale element - terminating request" warning (due to tab change)
expect(await calcPage.inputHasLinkModeButton(Z1_1)).toBe(false);
});
});
......@@ -83,42 +83,6 @@ describe("ngHyd − compute then reset chained results − ", () => {
}
});
it("when loading session-cascade-results.json, computation and results reset should be chained", async () => {
// load session file
await startPage.navigateTo();
await loadSession(navBar, sidenav, "./session/session-cascade-results.json");
expect(await navBar.getAllCalculatorTabs().length).toBe(3);
// 1. get down-most module (PAB Dimensions)
await navBar.clickCalculatorTabForUid("eHh5YX");
// click "compute" button
const calcButton = await calcPage.getCalculateButton();
await calcButton.click();
await browser.pause(200);
// check all 3 modules for results
for (let i = 0; i < 3; i++) {
await navBar.clickCalculatorTab(i);
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(true);
}
// 2. get up-most module (Macro-rugo)
await navBar.clickCalculatorTabForUid("MGg5OH");
// modify any input (for ex. "Ks")
await calcPage.getInputById("Ks").clearValue();
await calcPage.getInputById("Ks").setValue("42");
// check all 3 modules for absence of results
for (let i = 0; i < 3; i++) {
await navBar.clickCalculatorTab(i);
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(false);
}
});
it("when loading session-results-invalidation.json, results reset should not be triggered on calculation", async () => {
await newSession(navBar, sidenav);
......@@ -177,4 +141,40 @@ describe("ngHyd − compute then reset chained results − ", () => {
const hasResults4 = await calcPage.hasResults();
expect(hasResults4).toBe(false);
});
it("when loading session-cascade-results.json, computation and results reset should be chained", async () => {
// load session file
await startPage.navigateTo();
await loadSession(navBar, sidenav, "./session/session-cascade-results.json");
expect(await navBar.getAllCalculatorTabs().length).toBe(3);
// 1. get down-most module (PAB Dimensions)
await navBar.clickCalculatorTabForUid("eHh5YX");
// click "compute" button
const calcButton = await calcPage.getCalculateButton();
await calcButton.click();
await browser.pause(200);
// check all 3 modules for results
for (let i = 0; i < 3; i++) {
await navBar.clickCalculatorTab(i);
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(true);
}
// 2. get up-most module (Macro-rugo)
await navBar.clickCalculatorTabForUid("MGg5OH");
// modify any input (for ex. "Ks")
await calcPage.getInputById("Ks").clearValue();
await calcPage.getInputById("Ks").setValue("42");
// check all 3 modules for absence of results
for (let i = 0; i < 3; i++) {
await navBar.clickCalculatorTab(i);
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(false);
}
});
});
......@@ -28,7 +28,6 @@ describe("linked parameter - ", () => {
await prefPage.navigateTo();
await prefPage.disableEvilEmptyFields();
await browser.pause(200);
await navBar.clickNewCalculatorButton();
});
......@@ -59,44 +58,4 @@ describe("linked parameter - ", () => {
const inpZ2 = await calcPage.getInputById("Z2");
expect(await calcPage.inputIsInFixedMode(inpZ2)).toBe(true);
});
it("delete linked module and duplicate remaining one", async () => {
await newSession(navBar, sideNav);
// open "fish ladder: fall" calculator
await openCalculator(12, navBar, listPage);
// clone calculator
await calcPage.clickCloneCalcButton();
await browser.pause(200);
// set DH in link mode
let inpDH = await calcPage.getInputById("DH");
await calcPage.setParamMode(inpDH, "link");
await browser.pause(200);
// close 1st calculator
await navBar.middleClickCalculatorTab(0);
await browser.pause(200);
// check DH input is in "fixed" state in remaining calculator (not the aim of this test)
inpDH = await calcPage.getInputById("DH");
expect(await calcPage.inputIsInFixedMode(inpDH)).toBe(true);
// set DH to calculated mode
await calcPage.setParamMode(inpDH, "cal");
await browser.pause(100);
// clone calculator
await calcPage.clickCloneCalcButton();
await browser.pause(200);
// select 1st tab
await navBar.clickCalculatorTab(0);
await browser.pause(500);
// check DH input is in "calc" mode
inpDH = await calcPage.getInputById("DH");
expect(await calcPage.inputIsInCalculatedMode(inpDH)).toBe(true);
});
});
import { CalculatorPage } from "./calculator.po";
import { ListPage } from "./list.po";
import { Navbar } from "./navbar.po";
import { PreferencesPage } from "./preferences.po";
import { browser, $, $$, expect } from '@wdio/globals'
import { newSession, openCalculator } from "./util.po";
import { SideNav } from "./sidenav.po";
describe("linked parameter - ", () => {
let calcPage: CalculatorPage;
let prefPage: PreferencesPage;
let navBar: Navbar;
let listPage: ListPage;
let sideNav: SideNav;
beforeAll(() => {
calcPage = new CalculatorPage();
prefPage = new PreferencesPage();
navBar = new Navbar();
listPage = new ListPage();
sideNav = new SideNav();
});
beforeEach(async () => {
// browser.manage().window().setPosition(2000, 30);
// disable evil option "empty fields on module creation"
await prefPage.navigateTo();
await prefPage.disableEvilEmptyFields();
await browser.pause(200);
await navBar.clickNewCalculatorButton();
});
it("delete linked module", async () => {
// open "channel flow with hydraulic structures" example
const examples = await $$("#examples-list .load-example");
await examples[1].click();
await browser.pause(500);
// select "up/downstream elevations of a reach" tab
await navBar.clickCalculatorTab(1);
await browser.pause(500);
// close "solver" calculator
await navBar.middleClickCalculatorTab(3);
// reselect "up/downstream elevations of a reach" tab
await navBar.clickCalculatorTab(1);
await browser.pause(500);
// close second "parallel structures" calculator
await navBar.middleClickCalculatorTab(2);
// close first "parallel structures" calculator
await navBar.middleClickCalculatorTab(0);
// check Z2 input is in "fixed" state in remaining calculator
const inpZ2 = await calcPage.getInputById("Z2");
expect(await calcPage.inputIsInFixedMode(inpZ2)).toBe(true);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment