Commit cbcc1579 authored by Grand Francois's avatar Grand Francois
Browse files

refactor(e2e): migrate commit 19dc09ea (#609)

refs #618
Showing with 67 additions and 0 deletions
+67 -0
import { ListPage } from "./list.po";
import { PreferencesPage } from "./preferences.po";
import { Navbar } from "./navbar.po";
import { browser, $, $$, expect } from '@wdio/globals'
import { isElementDisplayed } from "./util.po";
//TODO à réactiver après fusion de #618 dans devel
xdescribe("MacroRugoRemous - ", () => {
let prefPage: PreferencesPage;
let listPage: ListPage;
let navBar: Navbar;
beforeAll(() => {
prefPage = new PreferencesPage();
listPage = new ListPage();
navBar = new Navbar();
});
beforeEach(async () => {
// disable evil option "empty fields on module creation"
await prefPage.navigateTo();
await browser.pause(200);
await prefPage.disableEvilEmptyFields();
await browser.pause(200);
});
it("check select empty message is present when no PAM is in the session", async () => {
// start page
await navBar.clickNewCalculatorButton();
await browser.pause(200);
// MacroRugoRemous calculator
await listPage.clickMenuEntryForCalcType(37);
browser.pause(200);
// const emptyMsg = element(by.css("div .message-when-empty"));
const emptyMsg = await $("div .message-when-empty");
expect(await isElementDisplayed(emptyMsg)).toBe(true);
});
it("check select empty message is not present when a PAM exists in the session", async () => {
// start page
await navBar.clickNewCalculatorButton();
await browser.pause(200);
// PAM calculator
await listPage.clickMenuEntryForCalcType(11);
browser.pause(200);
await navBar.clickNewCalculatorButton();
await browser.pause(200);
// MacroRugoRemous calculator
await listPage.clickMenuEntryForCalcType(37);
browser.pause(200);
const emptyMsg = $("div .message-when-empty");
expect(await isElementDisplayed(emptyMsg)).toBe(false);
});
});
......@@ -84,3 +84,10 @@ export async function loadSession(navbar: Navbar, sideNav: SideNav, path: string
await sideNav.loadSessionFile(path);
}
/**
* @returns true if an element exists and is displayed
*/
export async function isElementDisplayed(element) {
return await element.isExisting() && await element.isDisplayed();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment