/** 
 | 
 * @file        ADSO-10203 
 | 
 * @description Select parent level items in the navigation panel (units) 
 | 
 * @testcategory Web - Navigation 
 | 
 * @author      Meng Yew Cheah (MengYew.CHEAH@3ds.com) 
 | 
 * @copyright   Dassault Systemes 
 | 
 */ 
 | 
 import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const'; 
 | 
 import { AppMP, Demo, Scenario } from '../../../libmp/appmp'; 
 | 
 import { ListEntityColumn, StepNavigationPanel } from '../../../libmp/forms/navigationpanel/form.navigationpanel'; 
 | 
 import { dataFoodUnits, dataFoodUnitsProvider } from '../../../libmp/data/data.unit'; 
 | 
 import { DataRowCheckBoxDecoration, StepList } from '../../../libappsop/listsop'; 
 | 
 import { ListEntity } from '../../../libmp/forms/form.unit'; 
 | 
 import { ListRow } from '../../../e2elib/lib/src/pageobjects/list/listrow.component'; 
 | 
  
 | 
 describe('ADSO-10203 -  Select parent level items in the navigation panel (units)', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  const listNavEntity = appMP.formNavigation.listEntity; 
 | 
  let name: ListEntityColumn; 
 | 
  let parent: ListEntityColumn[] | undefined; 
 | 
  let targetRow: ListRow; 
 | 
  
 | 
  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 - ${StepNavigationPanel.openNavigationPanel()}`, async () => { 
 | 
    await appMP.formNavigation.openNavigationPanel(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 2 - ${StepNavigationPanel.showEntitiesList()}`, async () => { 
 | 
    await appMP.formNavigation.toggleEntityList(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 3 - ${StepNavigationPanel.checkUnits([dataFoodUnits.Transportation.Name])}`, async () => { 
 | 
    // New mechanism to pass only the Unit name to 'dataFoodUnitProvider' to retrieve the ancestors recursively for easy maintenance 
 | 
    [name, parent] = listNavEntity.getHierarchy(dataFoodUnitsProvider, dataFoodUnits.Transportation); 
 | 
    targetRow = await listNavEntity.getRow(name, parent); 
 | 
    await listNavEntity.toggleRowCheckbox(targetRow, true); 
 | 
    await targetRow.expandRow(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 4 - ${StepList.verifyChildrenRowsChecked(ListEntity.title, dataFoodUnits.Transportation.Name)} `, async () => { 
 | 
    await listNavEntity.verifyChildrenRowsChecked(true, name, parent); 
 | 
  }); 
 | 
  
 | 
  it(`Step 5 - ${StepList.verifyCheckBoxRowDecoration (ListEntity.title, dataFoodUnits.Transportation.Name, DataRowCheckBoxDecoration.DarkDecorated)}`, async () => { 
 | 
    await listNavEntity.verifyRowCheckBoxDecoration([dataFoodUnitsProvider, dataFoodUnits.Transportation], DataRowCheckBoxDecoration.DarkDecorated); 
 | 
  }); 
 | 
  
 | 
  it(`Step 6 - ${StepList.verifyCheckBoxRowDecoration (ListEntity.title, dataFoodUnits.Europe.Name, DataRowCheckBoxDecoration.LightDecorated)}`, async () => { 
 | 
    await listNavEntity.verifyRowCheckBoxDecoration([dataFoodUnitsProvider, dataFoodUnits.Europe], DataRowCheckBoxDecoration.LightDecorated); 
 | 
  }); 
 | 
  
 | 
  it (`Step 7 - ${StepNavigationPanel.uncheckUnits ([dataFoodUnits.Transportation.Name])}`, async () => { 
 | 
    const target = await listNavEntity.getRow(name, parent); 
 | 
    await listNavEntity.toggleRowCheckbox(target, false); 
 | 
    await target.expandRow(); 
 | 
  }); 
 | 
  
 | 
  it (`Step 8 - ${StepList.verifyChildrenRowsUnchecked (ListEntity.title, dataFoodUnits.Transportation.Name)}`, async () => { 
 | 
    await listNavEntity.verifyChildrenRowsChecked(false, name, parent); 
 | 
  }); 
 | 
  
 | 
  it(`Step 9 - ${StepList.verifyCheckBoxRowDecoration (ListEntity.title, dataFoodUnits.Transportation.Name, DataRowCheckBoxDecoration.None)}`, async () => { 
 | 
    await listNavEntity.verifyRowCheckBoxDecoration([dataFoodUnitsProvider, dataFoodUnits.Transportation], DataRowCheckBoxDecoration.None); 
 | 
  }); 
 | 
  
 | 
  it(`Step 10 - ${StepList.verifyCheckBoxRowDecoration (ListEntity.title, dataFoodUnits.Europe.Name, DataRowCheckBoxDecoration.None)}`, async () => { 
 | 
    await listNavEntity.verifyRowCheckBoxDecoration([dataFoodUnitsProvider, dataFoodUnits.Europe], DataRowCheckBoxDecoration.None); 
 | 
  }); 
 | 
 }); 
 |