diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts index 5fc98c54e65318a0b00a090f7f54e22c20f324a5..400f4b0abbc88cf80c09be86d6a159f9362823ea 100644 --- a/e2e/calculator.po.ts +++ b/e2e/calculator.po.ts @@ -145,6 +145,17 @@ export class CalculatorPage { return await button.getAttribute("ng-reflect-checked") === "true"; } + /** + * @returns true if "linked mode" button linked to an input is selected + */ + async inputIsInLinkedMode(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_link")); + return await button.getAttribute("ng-reflect-checked") === "true"; + } + async hasResults() { return ( await this.presentAndVisible("fixedvar-results fixed-results > .fixed-results-container") diff --git a/e2e/linked-parameter-section-type.e2e-spec.ts b/e2e/linked-parameter-section-type.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..b42c13d0f8ad8249514e3880592938bd726888bb --- /dev/null +++ b/e2e/linked-parameter-section-type.e2e-spec.ts @@ -0,0 +1,50 @@ +import { browser } from "protractor"; +import { ListPage } from "./list.po"; +import { Navbar } from "./navbar.po"; +import { PreferencesPage } from "./preferences.po"; +import { CalculatorPage } from "./calculator.po"; + +describe("linked parameter in calculator with section - ", () => { + 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); + }); + + it("modify section type", async () => { + browser.manage().window().setPosition(2000, 30); + + // open first "parametric section" calculator + await navBar.clickNewCalculatorButton(); + await listPage.clickMenuEntryForCalcType(2); + await browser.sleep(200); + + // open second "parametric section" calculator + await navBar.clickNewCalculatorButton(); + await listPage.clickMenuEntryForCalcType(2); + await browser.sleep(200); + + // set Q parameter to linked mode + const inputQ = calcPage.getInputById("Q"); + await calcPage.setParamMode(inputQ, "link"); + + // change section type + await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 3); // mode "parabolique" + + // check Q is still in linked mode + expect(await calcPage.inputIsInLinkedMode(inputQ)).toBe(true); + }); +});