Skip to content
Snippets Groups Projects
Commit f635446d authored by François Grand's avatar François Grand
Browse files

test: check field 'number of falls' of the 'generate fish ladder' dialog is...

test: check field 'number of falls' of the 'generate fish ladder' dialog is empty with the 'enable empty fields on new calculators' option

refs #516
parent 335f07ad
No related branches found
No related tags found
2 merge requests!133Release version 4.15.0,!126Resolve "Cloisons > Générer une PAB: vider les champs"
import { ListPage } from "./list.po";
import { PreferencesPage } from "./preferences.po";
import { browser, by, element } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { AppPage } from "./app.po";
import { Navbar } from "./navbar.po";
/**
* Check that when "empty fields on calculator creation" is enabled
* fields are empty in the "generate fish ladder" dialog of the
* cross walls calculator
*/
describe("ngHyd - check the cross walls calculator has empty fields - ", () => {
let prefPage: PreferencesPage;
let listPage: ListPage;
let calcPage: CalculatorPage;
let navBar: Navbar;
beforeAll(() => {
prefPage = new PreferencesPage();
listPage = new ListPage();
calcPage = new CalculatorPage();
navBar = new Navbar();
});
beforeEach(async () => {
// enable evil option "empty fields on module creation"
await prefPage.navigateTo();
await browser.sleep(200);
await prefPage.enableEvilEmptyFields();
await browser.sleep(200);
});
/**
* check that a input set is in a given (empty/filled) state
* @param inputIds id of the inputs to check
* @param emptys empty/not empty state array
*/
async function checkFields(inputIds: string[], emptys: boolean[]) {
let n = 0;
for (const id of inputIds) {
const inp = await calcPage.getInputById(id);
const txt = await inp.getAttribute("value");
expect(txt === "").toEqual(emptys[n]);
n++;
}
}
async function fillInput(symbol: string) {
const inp = calcPage.getInputById(symbol);
await inp.clear();
await inp.sendKeys("1");
}
it("in the 'generate fish ladder' dialog", async () => {
// open cross walls calculator
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(10);
await browser.sleep(200);
// fill inputs
await fillInput("Q");
await fillInput("Z1");
await fillInput("LB");
await fillInput("BB");
await fillInput("PB");
await fillInput("0_h1");
await fillInput("0_L");
await fillInput("0_CdWSL");
// calculate
const calcButton = calcPage.getCalculateButton();
await calcButton.click();
await browser.sleep(200);
// click "generate PAB" button
const genButton = calcPage.getGeneratePabButton();
await genButton.click();
await browser.sleep(200);
await checkFields(["generatePabNbBassins"], [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