| /** | 
|  * @file        ADSO-52457 | 
|  * @description Verify period task in purchasing plan | 
|  * @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 { FormPurchasingPlanDetailsFields, FormPurchasingPlanDetails, ListPurchasingPlanDetails } from '../../libmp/forms/form.purchasingplandetails'; | 
| import { CellLocator } from '../../libappbase/matrixeditorbase'; | 
| import { startOfPlanningYear } from '../../libmp/data/data.period'; | 
| import { StepMatrix } from '../../libappsop/matrixeditorsop'; | 
| import { MatrixEditorPurchasingPlan } from '../../libmp/forms/form.purchasingplan'; | 
| import { StepList } from '../../libappsop/listsop'; | 
| import { StepNavigationPanel } from '../../libmp/forms/navigationpanel/form.navigationpanel'; | 
| import { dataFoodProducts, dataFoodProductsProvider } from '../../libmp/data/data.product'; | 
| import { DataFoodPISP } from '../../libmp/data/data.pisp'; | 
| import { dataFoodUnits, dataFoodUnitsProvider } from '../../libmp/data/data.unit'; | 
|   | 
| describe('ADSO-52457 - Verify period task in purchasing plan', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const formPurchasingPlanDetails = appMP.viewPurchasingPlan.formPurchasingPlanDetails; | 
|   const listPurchasingPlanDetails = formPurchasingPlanDetails.listPurchasingPlanDetails; | 
|   const mePurchasingPlan = appMP.viewPurchasingPlan.formPurchasingPlan.mePurchasingPlan; | 
|   const formNavigation = appMP.formNavigation; | 
|   const listEntity = formNavigation.listEntity; | 
|   const listProduct = formNavigation.listProduct; | 
|   const verifyToggleFilterDefaultTrue: FormPurchasingPlanDetailsFields = { ToggleFilterByPurchasingPlan: true }; | 
|   const toggleFilterFalse: FormPurchasingPlanDetailsFields = { ToggleFilterByPurchasingPlan: false }; | 
|   | 
|   const cellLocation: CellLocator = { | 
|     columnName: `1-Jan-${startOfPlanningYear}`, | 
|     rowName: DataFoodPISP.CupsInDEWarehousePackagingMaterial, | 
|   }; | 
|   | 
|   beforeAll(async () => { | 
|     jasmine.addMatchers(qCustomMatcher); | 
|     await appMP.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     await appMP.resetActiveView(appMP.viewPurchasingPlan); | 
|     await appMP.cleanupAndLogout(); | 
|   }); | 
|   | 
|   afterEach(async () => { | 
|     await appMP.checkToastMessage(); | 
|   }); | 
|   | 
|   it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => { | 
|     await appMP.createDemoDataset(Demo.Food, Scenario.Base, true); | 
|   }); | 
|   | 
|   it(`Step 2 - Open view ${appMP.viewPurchasingPlan.viewPath}.`, async () => { | 
|     await appMP.viewPurchasingPlan.switchTo(); | 
|   }); | 
|   | 
|   it(`Step 3 - ${StepDialog.verifyDialogValues(FormPurchasingPlanDetails.title, verifyToggleFilterDefaultTrue)}`, async () => { | 
|     await formPurchasingPlanDetails.cbFilterByPurchasingPlan.verifyValue('true'); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepMatrix.selectCells(MatrixEditorPurchasingPlan.title, [cellLocation])}`, async () => { | 
|     await mePurchasingPlan.selectCells([cellLocation]); | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepList.verifyTotalRow(ListPurchasingPlanDetails.title, 1)}`, async () => { | 
|     await listPurchasingPlanDetails.verifyTotalRow(1); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepDialog.updateDialogValues(FormPurchasingPlanDetails.title, toggleFilterFalse)}`, async () => { | 
|     await formPurchasingPlanDetails.cbFilterByPurchasingPlan.toggle(false); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepNavigationPanel.showEntitiesList()}`, async () => { | 
|     await formNavigation.toggleEntityList(true); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepNavigationPanel.checkStockingPoints([dataFoodUnits.DEWarehouseRawMaterial.Name])}`, async () => { | 
|     const row = await listEntity.getRow([dataFoodUnitsProvider, dataFoodUnits.DEWarehouseRawMaterial]); | 
|     await listEntity.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 9 - ${StepNavigationPanel.showProductsList()}`, async () => { | 
|     await formNavigation.toggleProductList(true); | 
|   }); | 
|   | 
|   it(`Step 10 - ${StepNavigationPanel.checkProducts([dataFoodProducts.Milk.Name])}`, async () => { | 
|     const [milkRow, parents] = listProduct.getHierarchy(dataFoodProductsProvider, dataFoodProducts.Milk); | 
|     const row = await listProduct.getRow(milkRow, parents); | 
|     await listProduct.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 11 - ${StepMatrix.verifyTotalRow(MatrixEditorPurchasingPlan.title, 1)} ${StepMatrix.verifyRowExists(MatrixEditorPurchasingPlan.title, DataFoodPISP.MilkInDEWarehouseRawMaterial)}`, async () => { | 
|     await mePurchasingPlan.verifyTotalRow(1); | 
|     await mePurchasingPlan.verifyRowExist(DataFoodPISP.MilkInDEWarehouseRawMaterial); | 
|   }); | 
|   | 
|   it(`Step 12 - ${StepList.verifyTotalRow(ListPurchasingPlanDetails.title, 24)}`, async () => { | 
|     await listPurchasingPlanDetails.verifyTotalRow(24); | 
|   }); | 
|   | 
|   it(`Step 13 - ${StepNavigationPanel.clickHomeResetToRoot()}`, async () => { | 
|     await formNavigation.resetNaviToRoot(); | 
|     await formNavigation.toggleProductList(false); | 
|   }); | 
|   | 
|   it(`Step 14 - ${StepNavigationPanel.checkUnits([dataFoodUnits.DEDairySupplier.Name])}`, async () => { | 
|     const row = await listEntity.getRow([dataFoodUnitsProvider, dataFoodUnits.DEDairySupplier]); | 
|     await listEntity.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 15 - ${StepList.verifyTotalRow(ListPurchasingPlanDetails.title, 24)}`, async () => { | 
|     await listPurchasingPlanDetails.verifyTotalRow(24); | 
|   }); | 
|   | 
|   it(`Step 16 - ${StepNavigationPanel.checkProducts([dataFoodProducts.Milk.Name])}`, async () => { | 
|     await formNavigation.toggleProductList(true); | 
|     const row = await listProduct.getRow([dataFoodProductsProvider, dataFoodProducts.Milk]); | 
|     await listProduct.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 17 - ${StepList.verifyTotalRow(ListPurchasingPlanDetails.title, 24)}`, async () => { | 
|     await listPurchasingPlanDetails.verifyTotalRow(24); | 
|   }); | 
| }); |