load-linked-params.e2e-spec.ts 3.11 KB
Newer Older
1
import { AppPage } from "./app.po";
Mathias Chouet's avatar
Mathias Chouet committed
2
import { ListPage } from "./list.po";
3
4
5
6
7
8
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser } from "protractor";

/**
Mathias Chouet's avatar
Mathias Chouet committed
9
 * Load a session containing 5 calculators, having multiple linked parameters
10
11
12
 * from one to another
 * @TODO les valeurs des Select sont comparées au français, pas très générique :/
 */
13
describe("ngHyd − load session with multiple linked parameters − ", () => {
14
  let startPage: AppPage;
Mathias Chouet's avatar
Mathias Chouet committed
15
  let listPage: ListPage;
16
17
18
19
20
21
22
23
24
  let calcPage: CalculatorPage;
  let navbar: Navbar;
  let sidenav: SideNav;

  function init() {
      startPage = new AppPage();
      calcPage = new CalculatorPage();
      navbar = new Navbar();
      sidenav = new SideNav();
Mathias Chouet's avatar
Mathias Chouet committed
25
      listPage = new ListPage();
26
27
28
  }
  beforeEach(init);

Mathias Chouet's avatar
Mathias Chouet committed
29
   it("when loading session-liens-spaghetti.json, all links should point to the right target", async () => {
30
31
32
33
34
35
36
37
    await startPage.navigateTo();

    await navbar.clickMenuButton();
    await browser.sleep(200);

    await sidenav.clickLoadSessionButton();
    await browser.sleep(200);

Mathias Chouet's avatar
Mathias Chouet committed
38
    await sidenav.loadSessionFile("./session/session-liens-spaghetti.json");
39
    await browser.sleep(500);
40

41
    expect(await navbar.getAllCalculatorTabs().count()).toBe(5);
42
43
44

    // 1. check Section paramétrée
    await navbar.clickCalculatorTab(0);
Mathias Chouet's avatar
Mathias Chouet committed
45
    await browser.sleep(500);
46
47
48
49

    // check target params values
    const sp_lb = calcPage.getSelectById("linked_LargeurBerge");
    const sp_lbv = await calcPage.getSelectValueText(sp_lb);
Mathias Chouet's avatar
Mathias Chouet committed
50
    expect(sp_lbv).toContain("Largeur du déversoir (Ouvrages, ouvrage 3)");
51
52
53

    // 2. check Passe à macro-rugosités
    await navbar.clickCalculatorTab(1);
Mathias Chouet's avatar
Mathias Chouet committed
54
    await browser.sleep(500);
55
56

    // check target params values
Mathias Chouet's avatar
Mathias Chouet committed
57
58
    const mr_zf1 = calcPage.getSelectById("linked_ZF1");
    const mr_zf1v = await calcPage.getSelectValueText(mr_zf1);
Mathias Chouet's avatar
Mathias Chouet committed
59
    expect(mr_zf1v).toContain("Cote de l'eau amont (Ouvrages)");
60
61
62

    const mr_q = calcPage.getSelectById("linked_Q");
    const mr_qv = await calcPage.getSelectValueText(mr_q);
Mathias Chouet's avatar
Mathias Chouet committed
63
    expect(mr_qv).toContain("Débit (Sec. param., section)");
64
65
66

    // 3. check Lois d'ouvrages
    await navbar.clickCalculatorTab(2);
Mathias Chouet's avatar
Mathias Chouet committed
67
    await browser.sleep(500);
68
69

    // check target params values
Mathias Chouet's avatar
Mathias Chouet committed
70
71
    const lo_z2 = calcPage.getSelectById("linked_Z2");
    const lo_z2v = await calcPage.getSelectValueText(lo_z2);
Mathias Chouet's avatar
Mathias Chouet committed
72
    expect(lo_z2v).toContain("Cote de fond aval (Macro-rugo.)");
73

Mathias Chouet's avatar
Mathias Chouet committed
74
    const lo_l = calcPage.getSelectById("1_linked_L");
75
    const lo_lv = await calcPage.getSelectValueText(lo_l);
Mathias Chouet's avatar
Mathias Chouet committed
76
    expect(lo_lv).toContain("Largeur au miroir (Sec. param.)");
77

Mathias Chouet's avatar
Mathias Chouet committed
78
    const lo_w = calcPage.getSelectById("2_linked_W");
79
    const lo_wv = await calcPage.getSelectValueText(lo_w);
Mathias Chouet's avatar
Mathias Chouet committed
80
    expect(lo_wv).toContain("Ouverture de vanne (Ouvrages, ouvrage 2)");
81

82
83
    // 5. check Déver. dénoyés
    await navbar.clickCalculatorTab(4);
Mathias Chouet's avatar
Mathias Chouet committed
84
    await browser.sleep(500);
85
86
87
88

    // check target params values
    const lo_br = calcPage.getSelectById("linked_BR");
    const lo_brv = await calcPage.getSelectValueText(lo_br);
Mathias Chouet's avatar
Mathias Chouet committed
89
    expect(lo_brv).toContain("Largeur au miroir (Sec. param.)");
90
91
92
  });

});