Skip to content
Snippets Groups Projects
Commit 75199786 authored by mathias.chouet's avatar mathias.chouet
Browse files

e2e test looking for missing translations

parent e2ee7ca6
No related branches found
No related tags found
No related merge requests found
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { browser } from "protractor";
/**
* For all calculators, try to calculate every parameter: check that only one parameter
......@@ -18,7 +17,7 @@ describe("ngHyd − calculate all parameters of all calculators", () => {
navBar = new Navbar();
});
// get calculators list (IDs) @TODO read it from config !
// get calculators list (IDs) @TODO read it from config, but can't import jalhyd here :/
const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19 ];
// for each calculator
......
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { PreferencesPage } from "./preferences.po";
import { browser } from "protractor";
import { SideNav } from "./sidenav.po";
/**
* For all calculators, try to calculate every parameter: check that only one parameter
* is set to CAL mode, trigger the calculation, check that result is not empty
*/
fdescribe("ngHyd − check translation of all calculators", () => {
let listPage: ListPage;
let calcPage: CalculatorPage;
let navBar: Navbar;
let prefPage: PreferencesPage;
let sideNav: SideNav;
beforeAll(() => {
listPage = new ListPage();
calcPage = new CalculatorPage();
navBar = new Navbar();
prefPage = new PreferencesPage();
sideNav = new SideNav();
});
// get calculators list (IDs) @TODO read it from config, but can't import jalhyd here :/
const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19 ];
// options of "Language" selector on preferences page
const langs = [ "English", "Français" ];
// for each language
for (let i = 0; i < langs.length; i++) {
describe("language " + langs[i] + "", async () => {
beforeAll(async () => {
await prefPage.navigateTo();
await prefPage.changeLanguage(i);
await browser.sleep(2000);
});
// for each calculator
for (const ct of calcTypes) {
it(" − check translations of calculator type [" + ct + "]", async () => {
// go to list page
await navBar.clickNewCalculatorButton();
// click calculator button (instanciate)
await listPage.clickMenuEntryForCalcType(ct);
// just click the "compute" button with default values
// check that "compute" button is active
const calcButton = calcPage.getCalculateButton();
const disabledState = await calcButton.getAttribute("disabled");
expect(disabledState).not.toBe("true");
// click "compute" button
await calcButton.click();
// check that result is not empty
const hasResults = await calcPage.hasResults();
expect(hasResults).toBe(true);
// @TODO check absence of "*** message not found" in whole DOM
expect(" SOURCE CODE ").not.toContain("*** message not found");
// close calc
await sideNav.clickNewSessionButton();
browser.sleep(200);
});
}
});
}
});
......@@ -17,7 +17,7 @@ describe("ngHyd − clone all calculators with all possible <select> values", ()
navbar = new Navbar();
});
// get calculators list (IDs) @TODO read it from config !
// get calculators list (IDs) @TODO read it from config, but can't import jalhyd here :/
const calcTypes = [ 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19 ];
// for each calculator
......
......@@ -2,10 +2,15 @@ import { browser, by, element } from "protractor";
import * as path from "path";
export class SideNav {
getLoadSessionButton() {
return element(by.css("#side-nav-load-session"));
}
getNewSessionButton() {
return element(by.css("#side-nav-empty-session"));
}
getFileInput() {
return element(by.css(`dialog-load-session input[type="file"]`));
}
......@@ -14,12 +19,24 @@ export class SideNav {
return element(by.css(`dialog-load-session button[type="submit"]`));
}
getConfirmNewSessionButton() {
return element(by.css(`button#confirm-new-session`));
}
async clickLoadSessionButton() {
const ncb = this.getLoadSessionButton();
await browser.sleep(500);
await ncb.click();
}
async clickNewSessionButton() {
const ncb = this.getNewSessionButton();
await browser.sleep(200);
await ncb.click();
await browser.sleep(200);
await this.getConfirmNewSessionButton().click();
}
async loadSessionFile(file: string, click: boolean = true) {
const absolutePath = path.resolve(__dirname, file);
const input = this.getFileInput();
......
......@@ -3,10 +3,10 @@
<p [innerHTML]="uitextEmptySessionBody"></p>
</div>
<div mat-dialog-actions [attr.align]="'end'">
<button mat-raised-button color="primary" [mat-dialog-close]="false" cdkFocusInitial>
<button id="cancel-new-session" mat-raised-button color="primary" [mat-dialog-close]="false" cdkFocusInitial>
{{ uitextNo }}
</button>
<button mat-raised-button color="warn" [mat-dialog-close]="true">
<button id="confirm-new-session" mat-raised-button color="warn" [mat-dialog-close]="true">
{{ uitextYes }}
</button>
</div>
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