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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
 * @file        ADSO-10209 - Home button to deselect all items in the navigation panel
 * @description Home button to deselect all items in the navigation panel
 * @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 { DataFoodBaseProductName, DataFoodBaseSalesSegmentName } from '../../libmp/data/data.navigation';
import { ListEntityColumnName } from '../../libmp/forms/navigationpanel/form.navigationpanel';
import { LogMessage } from '../../libappbase/logmessage';
import { dataFoodUnits, dataFoodUnitsProvider } from '../../libmp/data/data.unit';
 
describe('ADSO-10209 - Home button to deselect all items in the navigation panel', () => {
  const appMP = AppMP.getInstance();
  const europe = dataFoodUnits.Europe.Name;
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    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 and get stocking point row
    await appMP.formNavigation.openNavigationPanel();
  });
 
  it('Step 2 - Open Stocking points and units list', async () => {
    await appMP.formNavigation.toggleEntityList(true);
  });
 
  it('Step 3 - Check unit Europe', async () => {
    const europeRow = await appMP.formNavigation.listEntity.getRow([dataFoodUnitsProvider, dataFoodUnits.Europe]);
    await appMP.formNavigation.listEntity.toggleRowCheckbox(europeRow, true);
 
    expect(await europeRow.isChecked()).toBe(true, LogMessage.list_checkboxNotChecked(europe));
  });
 
  it('Step 4 - Open Products list', async () => {
    await appMP.formNavigation.toggleProductList(true);
  });
 
  it('Step 5 - Check All Products', async () => {
    const allProductRow = await appMP.formNavigation.listProduct.getRow({Name: DataFoodBaseProductName.AllProducts});
    await appMP.formNavigation.listProduct.toggleRowCheckbox(allProductRow, true);
    expect(await allProductRow.isChecked()).toBe(true, LogMessage.list_checkboxNotChecked(DataFoodBaseProductName.AllProducts));
  });
 
  it('Step 6 - Open Sales Segments list', async () => {
    await appMP.formNavigation.toggleSalesSegmentList(true);
  });
 
  it('Step 7 - Check Target and Carrefour', async () => {
    const targetRow = await appMP.formNavigation.listSalesSegment.getRow({Name: DataFoodBaseSalesSegmentName.Target});
    const carrefourRow = await appMP.formNavigation.listSalesSegment.getRow({Name: DataFoodBaseSalesSegmentName.Carrefour});
 
    await appMP.formNavigation.listSalesSegment.toggleRowCheckbox(targetRow, true);
    await appMP.formNavigation.listSalesSegment.toggleRowCheckbox(carrefourRow, true);
 
    expect(await targetRow.isChecked()).toBe(true, LogMessage.list_checkboxNotChecked(DataFoodBaseSalesSegmentName.Target));
    expect(await carrefourRow.isChecked()).toBe(true, LogMessage.list_checkboxNotChecked(DataFoodBaseSalesSegmentName.Carrefour));
  });
 
  it('Step 8 - Click Home button and verify that all selections in the 3 lists are unchecked ', async () => {
    await appMP.formNavigation.resetNaviToRoot();
 
    const europeRow = await appMP.formNavigation.listEntity.getRowByCellValue(ListEntityColumnName.DisplayName, europe);
    expect(await europeRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(europe));
 
    const allProductRow = await appMP.formNavigation.listProduct.getRow({Name: DataFoodBaseProductName.AllProducts});
    expect(await allProductRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseProductName.AllProducts));
 
    const targetRow = await appMP.formNavigation.listSalesSegment.getRow({Name: DataFoodBaseSalesSegmentName.Target});
    expect(await targetRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseSalesSegmentName.Target));
 
    const carrefourRow = await appMP.formNavigation.listSalesSegment.getRow({Name: DataFoodBaseSalesSegmentName.Carrefour});
    expect(await carrefourRow.isChecked()).toBe(false, LogMessage.list_checkboxChecked(DataFoodBaseSalesSegmentName.Carrefour));
  });
});