yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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-10396
 * @description Default settings of smart plan
 * @author      Chan Clarence (ccn7@3ds.com)
 * @copyright   Dassault Systèmes
 */
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
import { AppMP, Demo, Scenario } from '../../libmp/appmp';
import { startOfPlanningYear } from '../../libmp/data/data.period';
import { DataFoodStrategyName } from '../../libmp/data/data.strategy';
import { DialogSmartPlan, DialogSmartPlanDirectionRadioButton } from '../../libmp/dialogs/dialog.smartplan';
 
describe('ADSO-10396 - Default settings of smart plan', () => {
  const appMP = AppMP.getInstance();
  let dlgSmartPlan: DialogSmartPlan;
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.viewSupplyPlanning.reset();
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => {
    await appMP.createDemoDataset(Demo.Food, Scenario.Base, false);
  });
 
  it(`Step 2 - Open view ${appMP.viewSupplyPlanning.viewPath}`, async () => {
    await appMP.viewSupplyPlanning.switchTo();
  });
 
  it(`Step 3 - In Product Planning matrix, right-click any PISPIP cell and click Smart plan menu.<br><br>
      Verify in the Smart plan dialog default settings as below:<br>
      (General tab) Save my preferences button = disabled<br>
      Restore default button = disabled<br>
      Strategy = Default <br>
      Override locked planning = unchecked<br>
      (Advanced tab) Smart plan direction = middle out<br>
      Limit the units used by smart plan = unchecked<br>
      Checkbox Only plan one step upstream hidden.`, async () => {
    dlgSmartPlan = await appMP.viewSupplyPlanning.frmProductPlanning.meProductPlanning.startSettingSmartPlanDirection(0, `1-Jan-${startOfPlanningYear}`);
 
    // Verify General tab (buttons disabled and checkbox uncheck)
    await dlgSmartPlan.verifyDialogEnabled({ BtnSavePreferencesEnabled: 'false', BtnRestoreDefaultEnabled: 'false' });
    await dlgSmartPlan.verifyDialogValues({ Strategy: DataFoodStrategyName.Default, OverrideLockedPlan: 'false' });
 
    // Verify Advanced tab (Smart plan direction = Middle-out and checkboxes uncheck)
    await dlgSmartPlan.pnlAdvanced.clickTab();
    await dlgSmartPlan.verifyDialogValues({ SmartPlanDirection: DialogSmartPlanDirectionRadioButton.MiddleOut, LimitUnits: 'false' });
    await dlgSmartPlan.verifyDialogUIVisible({ OnlyPlanOneStepUpstream: 'false' }); // Default hidden
  });
 
  it(`Step 4 - (Advanced tab) Set Smart plan direction = Upstream.<br>
      Verify checkbox Only plan one step upstream is now shown (and uncheck).`, async () => {
    await dlgSmartPlan.updateDialogValues({ SmartPlanDirection: DialogSmartPlanDirectionRadioButton.Upstream });
    await dlgSmartPlan.verifyDialogUIVisible({ OnlyPlanOneStepUpstream: 'true' });
    await dlgSmartPlan.verifyDialogValues({ OnlyPlanOneStepUpstream: 'false' });
  });
 
  it('Step 5 - Click Cancel to dismiss dialog.', async () => {
    await dlgSmartPlan.clickCancel();
  });
});