Skip to content
Snippets Groups Projects

Resolve "PréBarrages: les changements de couleur du schéma ne sont pas instantanées"

2 files
+ 79
1
Compare changes
  • Side-by-side
  • Inline
Files
2
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { browser } from "protractor";
import { browser, by, element } from "protractor";
import { PreferencesPage } from "./preferences.po";
describe("Calculate button - ", () => {
@@ -71,4 +71,75 @@ describe("Calculate button - ", () => {
disabledStateClone = await calcButtonClone.getAttribute("disabled");
expect(disabledStateClone).toBe("true");
});
describe("check button status in prébarrages - ", () => {
it("invalid data in Q input", async () => {
// start page
await navBar.clickNewCalculatorButton();
await browser.sleep(200);
// open prébarrages calculator
await listPage.clickMenuEntryForCalcType(30);
await browser.sleep(200);
// Q input
const inputQ = element(by.id("Q"));
await inputQ.clear();
await browser.sleep(200);
await inputQ.sendKeys("-1");
await browser.sleep(200);
calcPage.checkCalcButtonEnabled(false);
// upstream item
const upstream = element(by.id("amont"));
// should be displayed in error
expect(await upstream.getAttribute('class')).toContain("node-error");
});
it("add basin, invalid data in Q input", async () => {
// start page
await navBar.clickNewCalculatorButton();
await browser.sleep(200);
// open prébarrages calculator
await listPage.clickMenuEntryForCalcType(30);
await browser.sleep(200);
// "add basin" button
const addBasinBtn = element(by.id("add-basin"));
await addBasinBtn.click();
await browser.sleep(200);
// upstream item
const upstream = element(by.id("amont"));
await upstream.click();
await browser.sleep(200);
// invalid data in Q input
const inputQ = element(by.id("Q"));
await inputQ.clear();
await browser.sleep(200);
await inputQ.sendKeys("-1");
await browser.sleep(200);
// calculate button disabled ?
calcPage.checkCalcButtonEnabled(false);
// upstream item displayed in error ?
expect(await upstream.getAttribute('class')).toContain("node-error");
// valid data in Q input
await inputQ.clear();
await browser.sleep(200);
await inputQ.sendKeys("1");
await browser.sleep(200);
// calculate button still disabled ? (the basin is not connected to anything)
calcPage.checkCalcButtonEnabled(false);
// upstream item displayed not in error ?
expect(await upstream.getAttribute('class')).not.toContain("node-error");
});
});
});
Loading