/** 
 | 
 * @file        ADSO-10204 
 | 
 * @description Select parent level items in the navigation panel (Products) 
 | 
 * @author      CHEAH Meng Yew (MengYew.CHEAH@3ds.com) 
 | 
 * @copyright   Dassault Systemes 
 | 
 */ 
 | 
 import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const'; 
 | 
 import { AppMP, Demo, Scenario  } from '../../../libmp/appmp'; 
 | 
 import { DataRowCheckBoxDecoration, StepList } from '../../../libappsop/listsop'; 
 | 
 import { ListProduct, ListProductColumn, StepNavigationPanel } from '../../../libmp/forms/navigationpanel/form.navigationpanel'; 
 | 
 import { dataFoodProducts, dataFoodProductsProvider } from '../../../libmp/data/data.product'; 
 | 
  
 | 
 describe('ADSO-10204 - Select parent level items in the navigation panel Products', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  const listNavProduct = appMP.formNavigation.listProduct; 
 | 
  let name: ListProductColumn; 
 | 
  let parent: ListProductColumn[] | undefined; 
 | 
  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.showProductsList()}`, async () => { 
 | 
    await appMP.formNavigation.toggleProductList(true); 
 | 
  }); 
 | 
  
 | 
  it(`Step 3 - ${StepNavigationPanel.checkProducts([dataFoodProducts.Lowfat.Name])}`, async () => { 
 | 
    // New mechanism to pass only the product name to 'dataFoodProductsProvider' to retrieve the ancestors recursively for easy maintenance 
 | 
    [name, parent] = listNavProduct.getHierarchy(dataFoodProductsProvider, dataFoodProducts.Lowfat); 
 | 
    const lowFatRow = await listNavProduct.getRow(name, parent); 
 | 
    await listNavProduct.toggleRowCheckbox(lowFatRow, true); 
 | 
    await lowFatRow.expandRow(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 4 - ${StepList.verifyChildrenRowsChecked (ListProduct.title, dataFoodProducts.Lowfat.Name)}`, async () => { 
 | 
    await listNavProduct.verifyChildrenRowsChecked(true, name, parent); 
 | 
  }); 
 | 
  
 | 
  it(`Step 5 - ${StepList.verifyCheckBoxRowDecoration (ListProduct.title, dataFoodProducts.Lowfat.Name, DataRowCheckBoxDecoration.DarkDecorated)}`, async () => { 
 | 
    await listNavProduct.verifyRowCheckBoxDecoration([dataFoodProductsProvider, dataFoodProducts.Lowfat], DataRowCheckBoxDecoration.DarkDecorated); 
 | 
  }); 
 | 
  
 | 
  it(`Step 6 - ${StepList.verifyCheckBoxRowDecoration (ListProduct.title, dataFoodProducts.FinishedGoods.Name, DataRowCheckBoxDecoration.LightDecorated)}`, async () => { 
 | 
    await listNavProduct.verifyRowCheckBoxDecoration([dataFoodProductsProvider, dataFoodProducts.FinishedGoods], DataRowCheckBoxDecoration.LightDecorated); 
 | 
  }); 
 | 
  
 | 
  it(`Step 7 - ${StepList.verifyCheckBoxRowDecoration (ListProduct.title, dataFoodProducts.AllProducts.Name, DataRowCheckBoxDecoration.LightDecorated)}`, async () => { 
 | 
    await listNavProduct.verifyRowCheckBoxDecoration([dataFoodProductsProvider, dataFoodProducts.AllProducts], DataRowCheckBoxDecoration.LightDecorated); 
 | 
  }); 
 | 
  
 | 
  it (`Step 8 - ${StepNavigationPanel.unCheckProducts ([dataFoodProducts.Lowfat.Name])}`, async () => { 
 | 
    const lowFatRow = await listNavProduct.getRow(name, parent); 
 | 
    await listNavProduct.toggleRowCheckbox(lowFatRow, false); 
 | 
    await lowFatRow.expandRow(); 
 | 
  }); 
 | 
  
 | 
  it (`Step 9 - ${StepList.verifyChildrenRowsUnchecked (ListProduct.title, dataFoodProducts.Lowfat.Name)}`, async () => { 
 | 
    await listNavProduct.verifyChildrenRowsChecked(false, name, parent); 
 | 
  }); 
 | 
  
 | 
  it (`Step 10 - ${StepList.verifyCheckBoxRowNoDecoration (ListProduct.title, dataFoodProducts.Lowfat.Name)}`, async () => { 
 | 
    await listNavProduct.verifyRowCheckBoxDecoration([dataFoodProductsProvider, dataFoodProducts.Lowfat], DataRowCheckBoxDecoration.None); 
 | 
  }); 
 | 
  
 | 
  it (`Step 11 - ${StepList.verifyCheckBoxRowNoDecoration (ListProduct.title, dataFoodProducts.FinishedGoods.Name)}`, async () => { 
 | 
    await listNavProduct.verifyRowCheckBoxDecoration([dataFoodProductsProvider, dataFoodProducts.FinishedGoods], DataRowCheckBoxDecoration.None); 
 | 
  }); 
 | 
  
 | 
  it (`Step 12 - ${StepList.verifyCheckBoxRowNoDecoration (ListProduct.title, dataFoodProducts.AllProducts.Name)}`, async () => { 
 | 
    await listNavProduct.verifyRowCheckBoxDecoration([dataFoodProductsProvider, dataFoodProducts.AllProducts], DataRowCheckBoxDecoration.None); 
 | 
  }); 
 | 
 }); 
 |