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

test(e2e): check calculated parameter remains the same when copying a structure

refs #567
parent 0c8bf1f8
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,28 @@ export class CalculatorPage {
return await button.isPresent();
}
/**
* @returns true if "fixed mode" button linked to an input is selected
*/
async inputIsInFixedMode(input: ElementFinder): Promise<boolean> {
// get parent (div.container)
const container = await this.findParentContainer(input);
// find fixed radio button
const button: ElementFinder = container.element(by.css("mat-button-toggle.radio_fix"));
return await button.getAttribute("ng-reflect-checked") === "true";
}
/**
* @returns true if "calculated mode" button linked to an input is selected
*/
async inputIsInCalculatedMode(input: ElementFinder): Promise<boolean> {
// get parent (div.container)
const container = await this.findParentContainer(input);
// find calc radio button
const button: ElementFinder = container.element(by.css("mat-button-toggle.radio_cal"));
return await button.getAttribute("ng-reflect-checked") === "true";
}
async hasResults() {
return (
await this.presentAndVisible("fixedvar-results fixed-results > .fixed-results-container")
......
import { ListPage } from "./list.po";
import { Navbar } from "./navbar.po";
import { browser, by, element } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { PreferencesPage } from "./preferences.po";
describe("Check calculated parameter remains the same when copying a structure", () => {
let listPage: ListPage;
let navBar: Navbar;
let calcPage: CalculatorPage;
let prefPage: PreferencesPage;
beforeAll(async () => {
listPage = new ListPage();
navBar = new Navbar();
calcPage = new CalculatorPage();
prefPage = new PreferencesPage();
});
beforeEach(async () => {
// disable evil option "empty fields on module creation"
await prefPage.navigateTo();
await prefPage.disableEvilEmptyFields();
await browser.sleep(200);
});
fit("", async () => {
// open "fish ladder: cross walls" calculator
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(10);
await browser.sleep(200);
// check L in first structure calc toggle is not checked
const L1 = calcPage.getInputById("0_L");
// const h11 = calcPage.getInputById("0_h1");
// set L to calculated in first structure
await calcPage.setParamMode(L1, "cal");
// check L calc toggle is checked
expect(await calcPage.inputIsInCalculatedMode(L1)).toBe(true);
// copy 1st structure
const copyStruct = calcPage.getCopyStructureButton();
await copyStruct.click();
// check L in first structure is still in "calc" state
expect(await calcPage.inputIsInCalculatedMode(L1)).toBe(true);
// // check L in second structure is still in "fix" state
const L2 = calcPage.getInputById("1_L");
expect(await calcPage.inputIsInFixedMode(L2)).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