Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cassiopee/nghyd
1 result
Show changes
Commits on Source (30)
Showing
with 193 additions and 55 deletions
......@@ -7,6 +7,7 @@
/src/assets/docs
/release
/build
/docs/pdf_build
# dependencies
/node_modules
......
......@@ -79,19 +79,34 @@ test:
script:
- npm run e2e
build:
.build:
stage: build
only:
- pushes
- tags
- schedules
- web
artifacts:
expire_in: 10 min
paths:
- dist/
script:
- npm run build
# -baseref option is used by npm to set the npm_config_basehref environment variable
# used in package.json
- npm run build-href -basehref=$BASEHREF
build-dev:
extends: .build
only:
- tags
- pushes
- schedules
- web
variables:
BASEHREF: "/cassiopee/$CI_COMMIT_REF_NAME/"
build-prod:
extends: .build
only:
- tags
- devel
variables:
BASEHREF: "/"
clean-stale-branches:
stage: clean-stale-branches
......@@ -109,7 +124,7 @@ deploy-dev:
- tags
- web
dependencies:
- build
- build-dev
script:
# Copie de la branche / du tag
- ./scripts/deploy-version.sh $CI_COMMIT_REF_NAME $DEV_LOGIN $DEV_HOST $DEV_PATH
......@@ -120,7 +135,7 @@ deploy-ovh-dev:
only:
- devel
dependencies:
- build
- build-prod
script:
# Copie de la branche / du tag
- ./scripts/deploy-version.sh prod-devel $PROD_LOGIN $PROD_HOST $PROD_DEV_PATH
......@@ -131,7 +146,7 @@ deploy-prod:
variables:
- $CI_COMMIT_REF_NAME == "stable"
dependencies:
- build
- build-prod
script:
- ./scripts/deploy-version.sh prod $PROD_LOGIN $PROD_HOST $PROD_PATH
......
......@@ -14,7 +14,7 @@ Requirements for developping Cassiopee can be achieved by manually install the r
* npm
* python3
* pandoc ^2 (optional, for PDF documentation only)
* texlive (optional, for PDF documentation only)
* texlive, texlive-bibtex-extra, texlive-latex-extra, latexmk (optional, for PDF documentation only)
Building the HTML documentation requires MkDocs and some extensions:
......
......@@ -5,6 +5,7 @@ import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser, by } from "protractor";
import { PreferencesPage } from "./preferences.po";
import { changeSelectValue } from "./util.po";
/**
* Uses an example configuration to calculate :
......@@ -62,7 +63,7 @@ describe("ngHyd − calculate with linked parameters", () => {
const Y = calcPage.getInputById("Y");
await calcPage.setParamMode(Y, "link");
const sel = await calcPage.getLinkedValueSelect(Y);
await calcPage.changeSelectValue(sel, 0);
await changeSelectValue(sel, 0);
await computeAndCheckPresenceOfResults();
});
......@@ -79,7 +80,7 @@ describe("ngHyd − calculate with linked parameters", () => {
const Y = calcPage.getInputById("Y");
await calcPage.setParamMode(Y, "link");
const sel = await calcPage.getLinkedValueSelect(Y);
await calcPage.changeSelectValue(sel, 0);
await changeSelectValue(sel, 0);
// vary W
const W = calcPage.getInputById("W");
await calcPage.setParamMode(W, "var");
......@@ -102,7 +103,7 @@ describe("ngHyd − calculate with linked parameters", () => {
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 0);
await changeSelectValue(sel, 0);
await computeAndCheckPresenceOfResults();
});
......@@ -122,7 +123,7 @@ describe("ngHyd − calculate with linked parameters", () => {
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 0);
await changeSelectValue(sel, 0);
await computeAndCheckPresenceOfResults();
});
......@@ -142,7 +143,7 @@ describe("ngHyd − calculate with linked parameters", () => {
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 0);
await changeSelectValue(sel, 0);
// vary W
const W = calcPage.getInputById("W");
await calcPage.setParamMode(W, "var");
......@@ -168,7 +169,7 @@ describe("ngHyd − calculate with linked parameters", () => {
const Y2 = calcPage.getInputById("Y");
await calcPage.setParamMode(Y2, "link");
const sel = await calcPage.getLinkedValueSelect(Y2);
await calcPage.changeSelectValue(sel, 0);
await changeSelectValue(sel, 0);
await computeAndCheckPresenceOfResults();
});
......
......@@ -331,13 +331,6 @@ export class CalculatorPage {
return calcButton;
}
async changeSelectValue(elt: ElementFinder, index: number) {
await elt.click();
const optionId = ".cdk-overlay-container mat-option:nth-of-type(" + (index + 1) + ")";
const option = element(by.css(optionId));
await option.click();
}
// find parent element of elt having class "container"
async findParentContainer(elt: ElementFinder): Promise<ElementFinder> {
let i = 8; // garde fous
......
......@@ -3,6 +3,7 @@ import { CalculatorPage } from "./calculator.po";
import { browser } from "protractor";
import { Navbar } from "./navbar.po";
import { PreferencesPage } from "./preferences.po";
import { changeSelectValue } from "./util.po";
/**
* Cloisons - différents tests qui n'ont pas tant de rapport que ça avec les cloisons :)
......@@ -44,7 +45,7 @@ describe("ngHyd − cloisons", () => {
await browser.sleep(300);
// 4. change LoiDebit
await calcPage.changeSelectValue(calcPage.getSelectById("select_loidebit"), 1);
await changeSelectValue(calcPage.getSelectById("select_loidebit"), 1);
await browser.sleep(300);
// 5. check number of inputs in CALC mode
......
......@@ -4,7 +4,7 @@ import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { browser } from "protractor";
import { PreferencesPage } from "./preferences.po";
import { scrollPageToTop } from "./util.po";
import { changeSelectValue, scrollPageToTop } from "./util.po";
/**
* Clone calculators
......@@ -54,7 +54,7 @@ describe("ngHyd − clone a calculator", () => {
k: 0.6,
Ks: 42
};
await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 3); // mode "parabolique"
await changeSelectValue(calcPage.getSelectById("select_section"), 3); // mode "parabolique"
await calcPage.getInputById("k").clear();
await calcPage.getInputById("k").sendKeys(sourceValues["k"]);
await calcPage.getInputById("Ks").clear();
......@@ -63,7 +63,7 @@ describe("ngHyd − clone a calculator", () => {
const debitSP = calcPage.getInputById("Q");
await calcPage.setParamMode(debitSP, "link");
await browser.sleep(500);
await calcPage.changeSelectValue(calcPage.getSelectById("linked_Q"), 1); // "Courbe de remous"
await changeSelectValue(calcPage.getSelectById("linked_Q"), 1); // "Courbe de remous"
await browser.sleep(500);
// otherwise clickCloneCalcButton() fails with "Element is not clickable at point"
......
......@@ -3,6 +3,7 @@ import { CalculatorPage } from "./calculator.po";
import { ListPage } from "./list.po";
import { Navbar } from "./navbar.po";
import { PreferencesPage } from "./preferences.po"
import { changeSelectValue } from "./util.po";
/**
* check that fields are empty on creation
......@@ -60,7 +61,7 @@ describe("ngHyd - Check that examples fields are not empty with 'empty fields on
// modify 1st structure discharge law
const dischargeSelect = calcPage.getSelectById("select_loidebit");
await calcPage.changeSelectValue(dischargeSelect, 1);
await changeSelectValue(dischargeSelect, 1);
await browser.sleep(200);
// open initial dialog
......
......@@ -3,6 +3,7 @@ import { browser, by } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { PreferencesPage } from "./preferences.po";
import { Navbar } from "./navbar.po";
import { changeSelectValue } from "./util.po";
/**
* Check that created/cloned structures have empty fields when
......@@ -45,7 +46,7 @@ describe("Lechapt&Calmon - ", () => {
// select last material type
const materialSelect = calcPage.getSelectById("select_material");
await calcPage.changeSelectValue(materialSelect, 8);
await changeSelectValue(materialSelect, 8);
await browser.sleep(200);
// run calculation
......@@ -58,7 +59,7 @@ describe("Lechapt&Calmon - ", () => {
const pl1 = await res1.all(by.css("td")).get(1).getText();
// select first material type
await calcPage.changeSelectValue(materialSelect, 0);
await changeSelectValue(materialSelect, 0);
await browser.sleep(200);
// run calculation
......
......@@ -3,6 +3,7 @@ import { ListPage } from "./list.po";
import { Navbar } from "./navbar.po";
import { PreferencesPage } from "./preferences.po";
import { CalculatorPage } from "./calculator.po";
import { changeSelectValue } from "./util.po";
describe("linked parameter in calculator with section - ", () => {
let listPage: ListPage;
......@@ -42,7 +43,7 @@ describe("linked parameter in calculator with section - ", () => {
await calcPage.setParamMode(inputQ, "link");
// change section type
await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 3); // mode "parabolique"
await changeSelectValue(calcPage.getSelectById("select_section"), 3); // mode "parabolique"
// check Q is still in linked mode
expect(await calcPage.inputIsInLinkedMode(inputQ)).toBe(true);
......
......@@ -5,7 +5,7 @@ import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser, by, element } from "protractor";
import { PreferencesPage } from "./preferences.po";
import { expectNumber } from "./util.po";
import { changeSelectValue, expectNumber } from "./util.po";
const fs = require("fs");
const path = require("path");
......@@ -122,7 +122,7 @@ describe("ngHyd − save and load sessions", () => {
await listPage.clickMenuEntryForCalcType(2); // Section paramétrée
await browser.sleep(500);
await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 2); // mode "trapezoidal"
await changeSelectValue(calcPage.getSelectById("select_section"), 2); // mode "trapezoidal"
await calcPage.getInputById("Ks").clear(); // coefficient de Strickler
await browser.sleep(1000);
......@@ -190,7 +190,7 @@ describe("ngHyd − save and load sessions", () => {
// select next select option (optionally looping)
const nextInd = (ind + 1) % optionCount;
await calcPage.changeSelectValue(sel, nextInd);
await changeSelectValue(sel, nextInd);
await browser.sleep(200);
// save session
......
......@@ -4,6 +4,7 @@ import { CalculatorPage } from "./calculator.po";
import { AppPage } from "./app.po";
import { PreferencesPage } from "./preferences.po";
import { Navbar } from "./navbar.po";
import { changeSelectValue } from "./util.po";
/**
* Check that created/cloned structures have empty fields when
......@@ -51,7 +52,7 @@ describe("ngHyd - check that created/cloned structures have empty fields - ", ()
// change 1st structure type to rectangular weir
const structSelect = calcPage.getSelectById("select_structure");
await calcPage.changeSelectValue(structSelect, 1);
await changeSelectValue(structSelect, 1);
await browser.sleep(200);
// check 1st structure empty fields
......@@ -91,7 +92,7 @@ describe("ngHyd - check that created/cloned structures have empty fields - ", ()
// change 1st structure type to rectangular weir
const structSelect = calcPage.getSelectById("select_structure");
await calcPage.changeSelectValue(structSelect, 1);
await changeSelectValue(structSelect, 1);
await browser.sleep(200);
// copy structure
......@@ -102,7 +103,7 @@ describe("ngHyd - check that created/cloned structures have empty fields - ", ()
// change 2nd structure type to rectangular gate
const selects = await element.all(by.css("mat-select#select_structure"));
const structSelect2 = selects[1];
await calcPage.changeSelectValue(structSelect2, 5);
await changeSelectValue(structSelect2, 5);
await browser.sleep(200);
// check empty fields
......@@ -135,12 +136,12 @@ describe("ngHyd - check that created/cloned structures have empty fields - ", ()
// change 1st structure type to rectangular weir
const structSelect = calcPage.getSelectById("select_structure");
await calcPage.changeSelectValue(structSelect, 1);
await changeSelectValue(structSelect, 1);
await browser.sleep(200);
// change discharge law to Larinier
const dischargeSelect = calcPage.getSelectById("select_loidebit");
await calcPage.changeSelectValue(dischargeSelect, 3);
await changeSelectValue(dischargeSelect, 3);
await browser.sleep(200);
// check empty fields
......
......@@ -5,7 +5,7 @@ import { browser, by, element } from "protractor";
import { AppPage } from "./app.po";
import { SideNav } from "./sidenav.po";
import { PreferencesPage } from "./preferences.po";
import { scrollPageToTop } from "./util.po";
import { changeSelectValue, scrollPageToTop } from "./util.po";
/**
* Clone calculators
......@@ -297,7 +297,7 @@ describe("ngHyd − Passe à Bassins", () => {
// change iteration
const pve = calcPage.getSelectById("pab-variating-element");
calcPage.changeSelectValue(pve, 3);
await changeSelectValue(pve, 3);
await browser.sleep(300);
// check absence of logs
expect(await calcPage.nbLogEntries()).toBe(2);
......
import { browser, by, element, ElementFinder } from "protractor";
import { changeSelectValue } from "./util.po";
export class PreferencesPage {
navigateTo() {
......@@ -43,10 +44,7 @@ export class PreferencesPage {
async changeLanguage(index: number) {
const select = this.getLanguageSelect();
await select.click();
const optionId = ".cdk-overlay-container mat-option#mat-option-" + index;
const option = element(by.css(optionId));
await option.click();
await changeSelectValue(select, index);
}
async enableEvilEmptyFields() {
......@@ -65,6 +63,23 @@ export class PreferencesPage {
}
}
/**
* enable/disable option "empty fields on module creation"
* @param b true to enable "empty fields on module creation" option, false to disable it (fill fields with default values)
*/
async setEmptyFields(b: boolean) {
await this.navigateTo();
await browser.sleep(200);
if (b) {
await this.enableEvilEmptyFields();
}
else {
await this.disableEvilEmptyFields();
}
await browser.sleep(200);
}
async setIterationCount(n: number) {
const input = this.getInputFromName("nmi");
input.clear();
......
......@@ -3,6 +3,7 @@ import { Navbar } from "./navbar.po";
import { browser } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { PreferencesPage } from "./preferences.po";
import { changeSelectValue } from "./util.po";
describe("Check fields are empty in 'pressure loss' calculator when created with 'empty fields' option -", () => {
let listPage: ListPage;
......@@ -32,7 +33,7 @@ describe("Check fields are empty in 'pressure loss' calculator when created with
// select Lechapt-Calmon pressure loss law
const materialSelect = calcPage.getSelectById("select_pressurelosstype");
await calcPage.changeSelectValue(materialSelect, 0);
await changeSelectValue(materialSelect, 0);
await browser.sleep(200);
expect(calcPage.checkEmptyOrFilledFields(["Q", "D", "Lg", "Kloc"], [true, true, true, true]));
......
......@@ -4,6 +4,7 @@ import { browser } from "protractor";
import { Navbar } from "./navbar.po";
import { PreferencesPage } from "./preferences.po";
import { SideNav } from "./sidenav.po";
import { changeSelectValue } from "./util.po";
/**
* Remous
......@@ -59,7 +60,7 @@ describe("ngHyd − remous", () => {
await browser.sleep(300);
// 2. Set to trapezoidal section with bank slope of 2m/m and 20 meter width bed
await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 2);
await changeSelectValue(calcPage.getSelectById("select_section"), 2);
await browser.sleep(300);
await calcPage.getInputById("LargeurFond").clear();
await browser.sleep(300);
......
......@@ -5,7 +5,7 @@ import { Navbar } from "./navbar.po";
import { browser, by, element } from "protractor";
import { SideNav } from "./sidenav.po";
import { PreferencesPage } from "./preferences.po";
import { scrollPageToTop } from "./util.po";
import { changeSelectValue, scrollPageToTop } from "./util.po";
/**
* Clone calculators
......@@ -76,7 +76,7 @@ describe("Solveur - ", () => {
expect(hasResults).toBe(true);
// change targetted Nub, check that targetted result changes too
await calcPage.changeSelectValue(ntc, 0);
await changeSelectValue(ntc, 0);
const nttV2 = await calcPage.getSelectValueText(ntt);
expect(nttV2).not.toContain("Puissance dissipée (PV)");
});
......@@ -111,9 +111,9 @@ describe("Solveur - ", () => {
// Go back to Solveur
await navbar.clickCalculatorTab(0);
await calcPage.changeSelectValue(calcPage.getSelectById("select_target_nub"), 1); // "Puissance / PV"
await changeSelectValue(calcPage.getSelectById("select_target_nub"), 1); // "Puissance / PV"
await browser.sleep(500);
await calcPage.changeSelectValue(calcPage.getSelectById("select_searched_param"), 2); // "Chute / Z2"
await changeSelectValue(calcPage.getSelectById("select_searched_param"), 2); // "Chute / Z2"
await browser.sleep(500);
await calcPage.getInputById("Ytarget").sendKeys("318");
......@@ -159,7 +159,7 @@ describe("Solveur - ", () => {
// modify searched parameter
const sel = calcPage.getSelectById("select_searched_param");
await calcPage.changeSelectValue(sel, 11);
await changeSelectValue(sel, 11);
await browser.sleep(300);
const selText = await calcPage.getSelectValueText(sel);
......
import { ListPage } from "./list.po";
import { Navbar } from "./navbar.po";
import { browser, by } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { PreferencesPage } from "./preferences.po";
import { SideNav } from "./sidenav.po";
describe("Check translation", () => {
let listPage: ListPage;
let navBar: Navbar;
let calcPage: CalculatorPage;
let prefPage: PreferencesPage;
let sideNav: SideNav;
beforeAll(async () => {
listPage = new ListPage();
navBar = new Navbar();
calcPage = new CalculatorPage();
prefPage = new PreferencesPage();
sideNav = new SideNav();
});
beforeEach(async () => {
prefPage.setEmptyFields(false);
});
it("variables in results", async () => {
// *** results in french ***
prefPage.changeLanguage(1); // fr
await browser.sleep(200);
// open "fish ladder: fall" calculator
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(12);
await browser.sleep(200);
// set Z2 to variated mode
const inpZ2 = calcPage.getInputById("Z2");
await calcPage.setParamMode(inpZ2, "var");
// run calculation
await calcPage.getCalculateButton().click();
await browser.sleep(500);
// "variable for X axis" select label
const selXaxis = calcPage.getSelectById("selectX");
expect(await calcPage.getMatselectCurrentOptionText(selXaxis)).toEqual("Cote aval");
// "variable for Y axis" select label
const selYaxis = calcPage.getSelectById("selectY");
expect(await calcPage.getMatselectCurrentOptionText(selYaxis)).toEqual("DH : Chute (m)");
// fixed results variables
const frr = calcPage.getAllFixedResultsRows();
let lbl1 = await frr.all(by.css("td")).get(0).getText();
expect(lbl1).toEqual("Cote amont (m)");
// variated results headers
const vrh = calcPage.getAllVariatedResultsTableHeaders();
let lbl2 = await vrh.get(0).getText();
expect(lbl2).toEqual("Cote aval");
let lbl3 = await vrh.get(1).getText();
expect(lbl3).toEqual("Chute (m)");
// *** results in english ***
// setup -> english
await navBar.clickMenuButton();
await browser.sleep(200);
const setupBtn = await sideNav.getSetupButton();
await setupBtn.click();
await browser.sleep(200);
await prefPage.changeLanguage(0); // en
await browser.sleep(200);
// back to calculator
await navBar.clickCalculatorTab(0);
await browser.sleep(200);
// "variable for X axis" select label
expect(await calcPage.getMatselectCurrentOptionText(selXaxis)).toEqual("Downstream elevation");
// "variable for Y axis" select label
expect(await calcPage.getMatselectCurrentOptionText(selYaxis)).toEqual("DH : Fall (m)");
// fixed results variables
lbl1 = await frr.all(by.css("td")).get(0).getText();
expect(lbl1).toEqual("Upstream elevation (m)");
// variated results headers
lbl2 = await vrh.get(0).getText();
expect(lbl2).toEqual("Downstream elevation");
lbl3 = await vrh.get(1).getText();
expect(lbl3).toEqual("Fall (m)");
});
});
import { ElementFinder, browser } from "protractor";
import { ElementFinder, browser, by, element } from "protractor";
/**
* scroll page to make element visible
......@@ -27,3 +27,11 @@ export function expectNumber(msg: string, val: number, expected: number) {
}
expect(val).toEqual(expected);
}
export async function changeSelectValue(elt: ElementFinder, index: number) {
await elt.click();
const optionId = ".cdk-overlay-container mat-option:nth-of-type(" + (index + 1) + ")";
const option = element(by.css(optionId));
await option.click();
await browser.sleep(200);
}
......@@ -20,7 +20,8 @@
"preprocess": "mkdir -p build; node scripts/preprocessors.js; npm run service-worker-version; bash scripts/fix-chartjs-plugin-zoom-2.0.0.sh",
"start": "npm run preprocess && npm run mkdocs && npm run ng serve -- --host 0.0.0.0 --poll 5000",
"build-no-pdf": "npm run preprocess && npm run mkdocs && npm run ng build -- --configuration production",
"build": "npm run preprocess && npm run mkdocs && npm run ng build -- --configuration production && npm run mkdocs2pdf",
"build": "npm run build-href -basehref=/",
"build-href": "npm run preprocess && npm run mkdocs && npm run ng build -- --configuration production --base-href=$npm_config_basehref && npm run mkdocs2pdf",
"update-dist-index-mimetypes": "node scripts/update-dist-index-mimetypes.js",
"electron": "npm run update-dist-index-mimetypes && \"node_modules/.bin/electron\" .",
"release-linux-nocompile": "npm run update-dist-index-mimetypes && \"node_modules/.bin/electron-builder\"",
......