renhao
2023-09-21 1aa9f2bb83dd9e4b7517f1cbf06b0db53979bb31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
 * @file        ADSO-9367
 * @description Select scenario via Scenario Manager list and verify selected (green tick icon) and selected in action bar fixed (top right).
 * @author      Chan Clarence (ccn7@3ds.com)
 * @copyright   Dassault Systèmes
 */
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
import { AppMP } from '../../libmp/appmp';
import { ListScenarioContextMenuItem, ListScenarioOnDrawImage } from '../../libmp/forms/form.scenario';
 
describe('ADSO-9367 - Scenario selection via Scenario Manager list and verify selected (green tick icon)', () => {
  const appMP = AppMP.getInstance();
  const listScenario = appMP.viewScenarioAnalysisOverview.formScenario.lstScenario;
  const scenario1Name = '1';
  const scenario2Name = '2';
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.resetActiveView(appMP.viewScenarioAnalysisOverview);
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Step 1 - Open view ${appMP.viewScenarioAnalysisOverview.viewPath}`, async () => {
    await appMP.viewScenarioAnalysisOverview.switchTo();
  });
 
  it(`Step 2 - In Scenario Manager form, right click and select Create scenario menu. In dialog, enter Scenario name = ${scenario1Name} and click OK.<br>
      Verify scenario created and have a green tick at the front of the row.<br>
      Verify scenario ${scenario1Name} is selected at the top right dropdown (to indicate current active scenario).`, async () => {
    await listScenario.createEmptyScenario(scenario1Name);
 
    const row = await listScenario.getRow({Name: scenario1Name});
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario);
    await appMP.verifyActiveScenario(scenario1Name);
  });
 
  it(`Step 3 - Repeat previous step to create another scenario with name ${scenario2Name}. Perform same verification.`, async () => {
    await listScenario.createEmptyScenario(scenario2Name);
 
    const row = await listScenario.getRow({Name: scenario2Name});
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario);
    await appMP.verifyActiveScenario(scenario2Name);
  });
 
  it(`Step 4 - Right click scenario ${scenario1Name} and click Select menu to set as active scenario.<br>
      Verify a green tick at the front of the row.<br>
      Verify scenario ${scenario1Name} is selected at the top right dropdown (to indicate current active scenario).`, async () => {
    await listScenario.expandFolderAndSelectMenu(scenario1Name, ListScenarioContextMenuItem.Select);
 
    const row = await listScenario.getRow({Name: scenario1Name});
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario);
    await appMP.verifyActiveScenario(scenario1Name);
  });
 
  it(`Step 5 - Repeat previous step to select scenario ${scenario2Name}. Perform same verification.`, async () => {
    await listScenario.expandFolderAndSelectMenu(scenario2Name, ListScenarioContextMenuItem.Select);
 
    const row = await listScenario.getRow({Name: scenario2Name});
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario);
    await appMP.verifyActiveScenario(scenario2Name);
  });
});