| /** | 
|  * @file        ADSO-51336 | 
|  * @description Verify production planning view along with Navigation | 
|  * @author      Zayn Shaikh (SHAIKH.zayn@3ds.com) | 
|  * @copyright   Dassault Systèmes | 
|  */ | 
|   | 
| import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; | 
| import { AppMP, Demo, Scenario } from '../../libmp/appmp'; | 
| import { DataFoodBaseEntityName, DataFoodBaseProductName, DataLowFatVanilla6 } from '../../libmp/data/data.navigation'; | 
| import { startOfPlanningYear } from '../../libmp/data/data.period'; | 
| import { StepNavigationPanel } from '../../libmp/forms/navigationpanel/form.navigationpanel'; | 
| import { StepMatrix } from '../../libappsop/matrixeditorsop'; | 
| import { CellColors, MatrixEditorProductionPlan } from '../../libmp/forms/form.productionplan'; | 
| import { dataFoodUnits, dataFoodUnitsProvider } from '../../libmp/data/data.unit'; | 
| import { dataFoodProducts } from '../../libmp/data/data.product'; | 
| import { DataHierarchy } from '../../libappsop/datahierarchy'; | 
|   | 
| describe('ADSO-51336 - Verify production planning view along with Navigation', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const formProductionPlan = appMP.viewProductionPlan.formProductionPlan; | 
|   const aprilSOP = `1-Apr-${startOfPlanningYear}`; | 
|   const maySOP = `1-May-${startOfPlanningYear}`; | 
|   const stockingDEWarehouse = DataFoodBaseEntityName.DEWarehouse; | 
|   const stockingDEWarehouseParent = [DataFoodBaseEntityName.Europe]; | 
|   const [unitDEPackaging, unitDEPackagingParents] = dataFoodUnitsProvider.getHierarchy(dataFoodUnits.DEPackaging); | 
|   | 
|   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); | 
|   }); | 
|   | 
|   it(`Setup - Open view ${appMP.viewProductionPlan.viewPath}`, async () => { | 
|     await appMP.viewProductionPlan.switchTo(); | 
|   }); | 
|   | 
|   it(`Step 1 - ${StepNavigationPanel.showEntitiesList()} ${StepNavigationPanel.checkStockingPoints([stockingDEWarehouse])}`, async () => { | 
|     await appMP.formNavigation.filterByEntity(stockingDEWarehouse, stockingDEWarehouseParent); | 
|   }); | 
|   | 
|   it(`Step 2 - ${StepMatrix.verifyTotalRow(MatrixEditorProductionPlan.title, 8)}`, async () => { | 
|     await formProductionPlan.meProductionPlan.verifyTotalRow(8); | 
|   }); | 
|   | 
|   it(`Step 3 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([DataFoodBaseProductName.LowfatVanilla6pk])}`, async () => { | 
|     await appMP.formNavigation.filterByProduct({ Name: DataFoodBaseProductName.LowfatVanilla6pk }, DataLowFatVanilla6.parents); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepMatrix.verifyTotalRow(MatrixEditorProductionPlan.title, 1)}`, async () => { | 
|     await formProductionPlan.meProductionPlan.verifyTotalRow(1); | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepMatrix.verifyCellColor(MatrixEditorProductionPlan.title, '0', aprilSOP, CellColors.hasSupply().Color)}`, async () => { | 
|     await formProductionPlan.meProductionPlan.verifyCellColor(0, aprilSOP, CellColors.hasSupply().Rgb); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepMatrix.verifyCellColor(MatrixEditorProductionPlan.title, '0', maySOP, CellColors.noSupply().Color)}`, async () => { | 
|     await formProductionPlan.meProductionPlan.verifyCellColor(0, maySOP, CellColors.noSupply().Rgb); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepNavigationPanel.clickHomeResetToRoot()}`, async () => { | 
|     await appMP.formNavigation.resetNaviToRoot(); | 
|     await appMP.formNavigation.toggleProductList(false); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepNavigationPanel.checkUnits([unitDEPackaging.Name])}`, async () => { | 
|     const parentsArr = unitDEPackagingParents.map((x: DataHierarchy) => x.Name); | 
|     await appMP.formNavigation.filterByEntity(unitDEPackaging.Name, parentsArr); | 
|   }); | 
|   | 
|   it(`Step 9 - ${StepMatrix.verifyTotalRow(MatrixEditorProductionPlan.title, 8)}`, async () => { | 
|     await formProductionPlan.meProductionPlan.verifyTotalRow(8); | 
|   }); | 
|   | 
|   it(`Step 10 - ${StepNavigationPanel.checkProducts([dataFoodProducts.LowfatStrawberry12pk.Name])}`, async () => { | 
|     await appMP.formNavigation.toggleProductList(); | 
|     const [strawberry12pk, parents] = appMP.formNavigation.listProduct.getHierarchy(dataFoodUnitsProvider, dataFoodProducts.LowfatStrawberry12pk); | 
|     await appMP.formNavigation.filterByProduct(strawberry12pk, parents!); | 
|   }); | 
|   | 
|   it(`Step 11 - ${StepMatrix.verifyTotalRow(MatrixEditorProductionPlan.title, 1)}`, async () => { | 
|     await formProductionPlan.meProductionPlan.verifyTotalRow(1); | 
|   }); | 
| }); |