| /** | 
|  * @file        ADSO-52492 | 
|  * @description Verify trip planning form | 
|  * @author      Pethaperumal Natarajan (Pethaperumal.NATARAJAN.intern@3ds.com) | 
|  * @copyright   Dassault Systèmes | 
|  */ | 
|   | 
| import { AppMP, Demo, Scenario } from '../../libmp/appmp'; | 
| import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; | 
| import { StepDialog } from '../../libappsop/dialogsop'; | 
| import { StepMatrix } from '../../libappsop/matrixeditorsop'; | 
| import { CellLocator } from '../../libappbase/matrixeditorbase'; | 
| import { startOfPlanningYear } from '../../libmp/data/data.period'; | 
| import { DataFoodPISP } from '../../libmp/data/data.pisp'; | 
| import { StepList } from '../../libappsop/listsop'; | 
| import { StepNavigationPanel } from '../../libmp/forms/navigationpanel/form.navigationpanel'; | 
| import { dataFoodProducts, dataFoodProductsProvider } from '../../libmp/data/data.product'; | 
| import { dataFoodUnits, dataFoodUnitsProvider } from '../../libmp/data/data.unit'; | 
| import { ListRow } from '../../e2elib/lib/src/pageobjects/list/listrow.component'; | 
| import { MatrixEditorTripPlan } from '../../libmp/forms/form.tripplan'; | 
| import { FormTripPlanningFields, FormTripPlanDetails, ListTripPlanDetails } from '../../libmp/forms/form.tripplandetails'; | 
| import { DataHierarchy } from '../../libappsop/datahierarchy'; | 
|   | 
| describe('ADSO-52492 - Verify trip planning form', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const formTripPlanDetails = appMP.viewTripPlan.formTripPlanDetails; | 
|   const meTripPlan = appMP.viewTripPlan.formTripPlan.meTripPlan; | 
|   const listTripPlanDetails = formTripPlanDetails.listTripPlanDetails; | 
|   const formNavigation = appMP.formNavigation; | 
|   const listEntity = formNavigation.listEntity; | 
|   const listProduct = formNavigation.listProduct; | 
|   const dcAustria = dataFoodUnits.DCAustria.Name; | 
|   const dcBulgaria = dataFoodUnits.DCBulgaria.Name; | 
|   | 
|   const cellLocation: CellLocator = { | 
|     columnName: `1-Feb-${startOfPlanningYear}`, | 
|     rowName: DataFoodPISP.GreekLemon12PkDCAustria, | 
|   }; | 
|   | 
|   let row: ListRow; | 
|   const verifyToggleFilterDefaultTrue: FormTripPlanningFields = { ToggleFilterByTransportationPlan: true }; | 
|   const toggleFilterFalse: FormTripPlanningFields = { ToggleFilterByTransportationPlan: false }; | 
|   | 
|   beforeAll(async () => { | 
|     jasmine.addMatchers(qCustomMatcher); | 
|     await appMP.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     await appMP.resetActiveView(appMP.viewTripPlan); | 
|     await appMP.cleanupAndLogout(); | 
|   }); | 
|   | 
|   afterEach(async () => { | 
|     await appMP.checkToastMessage(); | 
|   }); | 
|   | 
|   it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => { | 
|     // Wait for optimizer to finish as we need verify the plan | 
|     await appMP.createDemoDataset(Demo.Food, Scenario.Base, true); | 
|   }); | 
|   | 
|   it(`Step 2 - Open view ${appMP.viewTripPlan.viewPath}.`, async () => { | 
|     await appMP.viewTripPlan.switchTo(); | 
|   }); | 
|   | 
|   it(`Step 3 - ${StepDialog.verifyDialogValues(FormTripPlanDetails.title, verifyToggleFilterDefaultTrue)}`, async () => { | 
|     await formTripPlanDetails.cbFilterByTransportationPlan.verifyValue('true'); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepNavigationPanel.showEntitiesList()} ${StepNavigationPanel.checkStockingPoints([dcAustria])}`, async () => { | 
|     await formNavigation.toggleEntityList(true); | 
|   | 
|     row = await listEntity.getRow([dataFoodUnitsProvider, dataFoodUnits.DCAustria]); | 
|     await listEntity.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepMatrix.selectCells(MatrixEditorTripPlan.title, [cellLocation])}`, async () => { | 
|     await meTripPlan.selectCells([cellLocation]); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepList.verifyTotalRow(ListTripPlanDetails.title, 1)}`, async () => { | 
|     await listTripPlanDetails.verifyTotalRow(1); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepNavigationPanel.unCheckStockingPoints([dcAustria])}`, async () => { | 
|     await listEntity.toggleRowCheckbox(row, false); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepDialog.updateDialogValues(FormTripPlanDetails.title, toggleFilterFalse)}`, async () => { | 
|     await formTripPlanDetails.cbFilterByTransportationPlan.toggle(false); | 
|   }); | 
|   | 
|   it(`Step 9 - ${StepNavigationPanel.checkStockingPoints([dcBulgaria])}`, async () => { | 
|     row = await listEntity.getRow([dataFoodUnitsProvider, dataFoodUnits.DCBulgaria]); | 
|     await listEntity.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 10 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([dataFoodProducts.GreekLemon12pk.Name])}`, async () => { | 
|     await formNavigation.toggleProductList(true); | 
|     row = await listProduct.getRow([dataFoodProductsProvider, dataFoodProducts.GreekLemon12pk]); | 
|     await listProduct.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 11 - ${StepMatrix.verifyTotalRow(MatrixEditorTripPlan.title, 1)} ${StepMatrix.verifyRowExists(MatrixEditorTripPlan.title, DataFoodPISP.GreekLemon12PkDCBulgaria)}`, async () => { | 
|     await meTripPlan.verifyTotalRow(1); | 
|     await meTripPlan.verifyRowExist(DataFoodPISP.GreekLemon12PkDCBulgaria); | 
|   }); | 
|   | 
|   it(`Step 12 - ${StepList.verifyTotalRow(ListTripPlanDetails.title, 24)}`, async () => { | 
|     await listTripPlanDetails.verifyTotalRow(24); | 
|   }); | 
|   | 
|   it(`Step 13 - ${StepNavigationPanel.clickHomeResetToRoot()}`, async () => { | 
|     await appMP.formNavigation.resetNaviToRoot(); | 
|     await appMP.formNavigation.toggleProductList(false); | 
|   }); | 
|   | 
|   it(`Step 14 - ${StepNavigationPanel.checkUnits([dataFoodUnits.EUShip.Name])}`, async () => { | 
|     const [unitEUShip, unitEUShipParents] = dataFoodUnitsProvider.getHierarchy(dataFoodUnits.EUShip); | 
|     const parentsArr = unitEUShipParents.map((x: DataHierarchy) => x.Name); | 
|     await formNavigation.filterByEntity(unitEUShip.Name, parentsArr); | 
|   }); | 
|   | 
|   it(`Step 15 - ${StepList.verifyTotalRow(ListTripPlanDetails.title, 24)}`, async () => { | 
|     await listTripPlanDetails.verifyTotalRow(24); | 
|   }); | 
|   | 
|   it(`Step 16 - ${StepNavigationPanel.checkProducts([dataFoodProducts.GreekLemon12pk.Name])}`, async () => { | 
|     await formNavigation.toggleProductList(true); | 
|     row = await listProduct.getRow([dataFoodProductsProvider, dataFoodProducts.GreekLemon12pk]); | 
|     await listProduct.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 17 - ${StepList.verifyTotalRow(ListTripPlanDetails.title, 24)}`, async () => { | 
|     await listTripPlanDetails.verifyTotalRow(24); | 
|   }); | 
| }); |