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