/** 
 | 
 * @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)); 
 | 
  }); 
 | 
}); 
 |