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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
 * @file        ADSO-9915
 * @description User KPI selection for a given view does not impact other users preferences
 * @author      Pethaperumal Natarajan (Pethaperumal.NATARAJAN.intern@3ds.com)
 * @copyright   Dassault Systèmes
 */
 
import { AppMP, Demo, QuintiqUser, Scenario, StepAppMP, Timeout } from '../../libmp/appmp';
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
import { FormKPI, GaugeKPIDashboard, PanelKPIDashboard, PanelKPISelection, StepFormKPI } from '../../libmp/forms/form.kpi';
import { DataKPIName } from '../../libmp/data/data.kpi';
import { StepForm } from '../../libappsop/formsop';
import { StepGauge } from '../../libappsop/gaugesop';
 
describe('ADSO-9915 - User KPI selection for a given view does not impact other users preferences', () => {
  const appMP = AppMP.getInstance();
  const formKPI = appMP.frmKPI;
  const listKPISelection = formKPI.panelKPISelection.lstKPISelection;
  const gaugeKPIDashboard = formKPI.panelKPIDashboard.gaugeKPIDashboard;
 
  const kpiSupplyPlanningUser01 = [DataKPIName.Fulfillment, DataKPIName.Margin];
  const kpiSupplyPlanningUser02 = [DataKPIName.Sales];
  const verifyExactMatch = true;
  const clearViewCache = false; // Must override false so that auto view cache NOT turned OFF
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login(undefined, clearViewCache);
  });
 
  afterAll(async () => {
    await appMP.disableAutoViewSave(); // revert to original value as we turn ON at beginning of this test (via appMP.login)
    await appMP.resetActiveView(appMP.viewSupplyPlanning);
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Metals, Scenario.Base)}`, async () => {
    await appMP.createDemoDataset(Demo.Metals, Scenario.Base, false);
  });
 
  it(`Step 2 - Open view ${appMP.viewSupplyPlanning.viewPath}.`, async () => {
    await appMP.viewSupplyPlanning.switchTo();
  });
 
  it(`Step 3 - ${StepForm.clickPanel(FormKPI.title, PanelKPISelection.title)}`, async () => {
    await formKPI.openKPISelectionPanel();
  });
 
  it(`Step 4 - ${StepFormKPI.deselectAllKPI()} ${StepFormKPI.selectKPI(kpiSupplyPlanningUser01)}`, async () => {
    await listKPISelection.deselectAllKPI();
    await listKPISelection.selectKPI(kpiSupplyPlanningUser01, Timeout.Short);
  });
 
  it(`Step 5 - ${StepForm.clickPanel(FormKPI.title, PanelKPIDashboard.title)}`, async () => {
    await formKPI.openKPIDashboardPanel();
  });
 
  it(`Step 6 - ${StepGauge.verifyGaugesPresent(GaugeKPIDashboard.title, kpiSupplyPlanningUser01, verifyExactMatch)}`, async () => {
    await gaugeKPIDashboard.verifyGaugesPresent(kpiSupplyPlanningUser01, verifyExactMatch);
  });
 
  it(`Step 7 - ${StepAppMP.logout()} ${StepAppMP.loginAs(QuintiqUser.QuintiqService)}`, async () => {
    await appMP.logout();
    await appMP.login(QuintiqUser.QuintiqService, clearViewCache);
  });
 
  it(`Step 8 - Open view ${appMP.viewSupplyPlanning.viewPath}.`, async () => {
    await appMP.viewSupplyPlanning.switchTo();
  });
 
  it(`Step 9 - ${StepForm.clickPanel(FormKPI.title, PanelKPISelection.title)}`, async () => {
    await formKPI.openKPISelectionPanel();
  });
 
  it(`Step 10 - ${StepFormKPI.deselectAllKPI()} ${StepFormKPI.selectKPI(kpiSupplyPlanningUser02)}`, async () => {
    await listKPISelection.deselectAllKPI();
    await listKPISelection.selectKPI(kpiSupplyPlanningUser02, Timeout.Short);
  });
 
  it(`Step 11 - ${StepForm.clickPanel(FormKPI.title, PanelKPIDashboard.title)}`, async () => {
    await formKPI.openKPIDashboardPanel();
  });
 
  it(`Step 12 - ${StepGauge.verifyGaugesPresent(GaugeKPIDashboard.title, kpiSupplyPlanningUser02, verifyExactMatch)}`, async () => {
    await gaugeKPIDashboard.verifyGaugesPresent(kpiSupplyPlanningUser02, verifyExactMatch);
  });
 
  it(`Step 13 - ${StepAppMP.logout()} ${StepAppMP.loginAs(QuintiqUser.Administrator)}`, async () => {
    await appMP.logout();
    await appMP.login(QuintiqUser.Administrator, clearViewCache);
  });
 
  it(`Step 14 - Open view ${appMP.viewSupplyPlanning.viewPath}.`, async () => {
    await appMP.viewSupplyPlanning.switchTo();
  });
 
  it(`Step 15 - ${StepForm.clickPanel(FormKPI.title, PanelKPIDashboard.title)}`, async () => {
    await formKPI.openKPIDashboardPanel();
  });
 
  it(`Step 16 - ${StepGauge.verifyGaugesPresent(GaugeKPIDashboard.title, kpiSupplyPlanningUser01, verifyExactMatch)}`, async () => {
    await gaugeKPIDashboard.verifyGaugesPresent(kpiSupplyPlanningUser01, verifyExactMatch);
  });
});