limj
2023-10-24 93652435728de839582440eefd5122c281181d35
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
/**
 * @file        ADSO-10199 - Select leaf level items in the navigation panel (stocking point)
 * @description Select leaf level items in the navigation panel (stocking point)
 * @testcategory Web - Navigation
 * @author      Jayden Chew (jayden.chew@3ds.com)
 * @copyright   Dassault Systemes
 */
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const';
import { AppMP, Demo, Scenario } from '../../../libmp/appmp';
import { DataFoodBaseEntityName } from '../../../libmp/data/data.navigation';
import { LogMessage } from '../../../libappbase/logmessage';
import { ListEntityColumnName } from '../../../libmp/forms/navigationpanel/form.navigationpanel';
 
describe('ADSO-10199 - Select leaf level items in the navigation panel (stocking point)', () => {
  const appMP = AppMP.getInstance();
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.viewStockCapacity.reset();
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Setup - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => {
    await appMP.createDemoDataset(Demo.Food, Scenario.Base, false);
  });
 
  it('Step 1 - Open navigation panel', async () => {
    // Navigation panel form should show up directly after login
 
    // Open navigation panel
    await appMP.formNavigation.openNavigationPanel();
    // Verify if navigation panel form is visible 'FormNavigationPanel'
    expect(await appMP.formNavigation.isVisible()).toBe(true, LogMessage.form_notVisible('Navigation'));
  });
 
  it('Step 2 - Open Stocking points and units list', async () => {
    await appMP.formNavigation.toggleEntityList(true);
    expect(await appMP.formNavigation.listEntity.isVisible()).toBe(true, LogMessage.list_notVisible('Entitiy'));
  });
 
  it('Step 3 - Check HU Warehouse and DC - Austria', async () => {
    const europeRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.Europe);
    await europeRow.expandRow();
 
    // The hierarchy list from parent to child is not recursive, hence we need to pass in Parent to move the focus from depth 0 to depth 1
    await appMP.formNavigation.listEntity.toggleEntityRowCheckbox(true, DataFoodBaseEntityName.DCAustria, [DataFoodBaseEntityName.Europe]);
    // The focus is now at depth 1, HUWarehouse is same level as DCAustria. It's okay not to pass in parent to save the searching time from parent to child
    await appMP.formNavigation.listEntity.toggleEntityRowCheckbox(true, DataFoodBaseEntityName.HUWarehouse);
 
    const dcAustriaRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.DCAustria);
    expect(await dcAustriaRow.isChecked()).toBe(true, LogMessage.list_checkboxNotChecked(DataFoodBaseEntityName.DCAustria));
    const huWarehouseRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.HUWarehouse);
    expect(await huWarehouseRow.isChecked()).toBe(true, LogMessage.list_checkboxNotChecked(DataFoodBaseEntityName.HUWarehouse));
  });
 
  it('Step 4 - Verify parent unit Europe has a light blue triangle on the bottom right of the checkbox', async () => {
    const europeRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.Europe);
    const lightBlueTriagleExist = (await europeRow.isLightDecorated()) && (await europeRow.isDecorated());
    expect(lightBlueTriagleExist).toBe(true, 'light blue triangle on the bottom right of the checkbox is missing.');
  });
 
  it('Step 5 - Uncheck HU Warehouse and DC - Austria', async () => {
    const europeRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.Europe);
    await appMP.formNavigation.listEntity.toggleEntityRowCheckbox(false, DataFoodBaseEntityName.DCAustria);
    await appMP.formNavigation.listEntity.toggleEntityRowCheckbox(false, DataFoodBaseEntityName.HUWarehouse);
    const dcAustriaRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.DCAustria);
    expect(await dcAustriaRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseEntityName.DCAustria));
    const huWarehouseRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.HUWarehouse);
    expect(await huWarehouseRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseEntityName.HUWarehouse));
    // Verify the light blue triangle on the checkbox
    const lightBlueTriagleExist = (await europeRow.isLightDecorated()) && (await europeRow.isDecorated());
    expect(lightBlueTriagleExist).toBe(false, 'light blue triangle on the bottom right of the checkbox exist.');
  });
 
  it(`Step 6 - Open view ${appMP.viewStockCapacity.viewPath} and verify selection in the navigation panel remains the same`, async () => {
    await appMP.viewStockCapacity.switchTo();
    const formScenarioAnalysisStockingPointCapacity = appMP.viewStockCapacity.frmScenarioAnalysisStockingPointCapacity;
    expect(await formScenarioAnalysisStockingPointCapacity.isVisible()).toBe(true, LogMessage.form_notVisible('ScenarioAnalysisStockingPointCapacity'));
    const europeRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.Europe);
    const dcAustriaRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.DCAustria);
    const huWarehouseRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, DataFoodBaseEntityName.HUWarehouse);
    expect(await europeRow.isLightDecorated()).toBe(false, 'light blue triangle on the bottom right of the checkbox exist.');
    expect(await dcAustriaRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseEntityName.DCAustria));
    expect(await huWarehouseRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseEntityName.HUWarehouse));
    const lightBlueTriagleExist = (await europeRow.isLightDecorated()) && (await europeRow.isDecorated());
    expect(lightBlueTriagleExist).toBe(false, 'light blue triangle on the bottom right of the checkbox exist.');
  });
});