| /** | 
|  * @file        ADSO-51993 | 
|  * @description Lock and unlock via supply planning matrix | 
|  * @author      Clarence (ccn7@3ds.com) | 
|  * @copyright   Dassault Systèmes | 
|  */ | 
| import { AppMP, Demo, Scenario } from '../../libmp/appmp'; | 
| import { StepGanttChart } from '../../libappsop/ganttchartsop'; | 
| import { StepMatrix } from '../../libappsop/matrixeditorsop'; | 
| import { DataProduct, DataMetalBaseProductName } from '../../libmp/data/data.product'; | 
| import { GanttChartCapacityPlanning } from '../../libmp/forms/form.capacityplanning'; | 
| import { MatrixEditorProductionPlan } from '../../libmp/forms/form.productionplan'; | 
| import { MatrixEditorSupplyPlanning, MatrixSupplyPlanningContextMenuItem } from '../../libmp/forms/form.supplyplanning'; | 
| import { CellLocator } from '../../libappbase/matrixeditorbase'; | 
| import { StepNavigationPanel } from '../../libmp/forms/navigationpanel'; | 
| import { dataMetalsUnits, dataMetalsUnitsProvider } from '../../libmp/data/data.unit'; | 
|   | 
| describe('ADSO-51993 - Lock and unlock via supply planning matrix', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const formNavPanel = appMP.formNavigation; | 
|   const meProductPlanning = appMP.viewSupplyPlanning.frmProductPlanning.meProductPlanning; | 
|   const meSupplyPlanning = appMP.viewSupplyPlanning.formSupplyPlanning.meSupplyPlanning; | 
|   const gcCapacityPlanning = appMP.viewSupplyPlanning.frmCapacityPlanning.ganttChartCapacityPlanning; | 
|   let originalQiyingCapacity = ''; | 
|   const selectCells: CellLocator[] = [{rowName: 'BC CB narrow in Qi-Ying', columnName: '1-Jan-2022', attributeId: 0}]; | 
|   const asiaUnit = dataMetalsUnits.AsiaUnit.Name; | 
|   | 
|   beforeAll(async () => { | 
|     await appMP.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     await appMP.resetActiveView(appMP.viewSupplyPlanning); | 
|     await appMP.cleanupAndLogout(); | 
|   }); | 
|   | 
|   afterEach(async () => { | 
|     await appMP.checkToastMessage(); | 
|   }); | 
|   | 
|   it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Metals, Scenario.Base)}.`, async () => { | 
|     await appMP.createDemoDataset(Demo.Metals, Scenario.Base, false); | 
|   }); | 
|   | 
|   it(`Step 2 - Open view ${appMP.viewSupplyPlanning.viewPath}.`, async () => { | 
|     await appMP.viewSupplyPlanning.switchTo(); | 
|   }); | 
|   | 
|   it(`Step 3 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([DataMetalBaseProductName.BCCBNarrow])}`, async () => { | 
|     await formNavPanel.openNavigationPanel(); | 
|     await formNavPanel.toggleProductList(); | 
|   | 
|     const row = await formNavPanel.listProduct.getRow(DataProduct.BCCBNarrow.Name, DataProduct.BCCBNarrow.Parents); | 
|     await formNavPanel.listProduct.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepNavigationPanel.showEntitiesList()} ${StepNavigationPanel.checkUnits([asiaUnit])}`, async () => { | 
|     await formNavPanel.toggleEntityList(); | 
|   | 
|     const row = await formNavPanel.listEntity.getRow([dataMetalsUnitsProvider, dataMetalsUnits.AsiaUnit]); | 
|     await formNavPanel.listEntity.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepMatrix.selectCells(MatrixEditorProductionPlan.title, selectCells)}`, async () => { | 
|     await meProductPlanning.selectCells(selectCells); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepMatrix.verifyRowExists(MatrixEditorSupplyPlanning.title, 'Operation: Slitters (Qi-Ying)')}`, async () => { | 
|     await meSupplyPlanning.verifyRowExist('Operation: Slitters (Qi-Ying)'); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepMatrix.rightClickCellSelectContextmenu(MatrixEditorSupplyPlanning.title, 'Operation: Slitters (Qi-Ying)', '1-Jan-2022', MatrixSupplyPlanningContextMenuItem.Lock.Label)}`, async () => { | 
|     await meSupplyPlanning.rightClickCellSelectContextmenu(MatrixSupplyPlanningContextMenuItem.Lock.Name, 'Operation: Slitters (Qi-Ying)', '', '1-Jan-2022'); | 
|   | 
|     // Get the capacity before we unlock the cell (to compare the value didn't change thereafter) | 
|     originalQiyingCapacity = await gcCapacityPlanning.getGanttChartNodeValue('Qi-Ying', 'Jan 2022', 'Feb 2022'); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepMatrix.rightClickCellSelectContextmenu(MatrixEditorSupplyPlanning.title, 'Operation: Slitters (Qi-Ying)', '1-Jan-2022', MatrixSupplyPlanningContextMenuItem.Unlock.Label)} ${StepGanttChart.verifyNodeValue(GanttChartCapacityPlanning.title, 'Qi-Ying', 'Jan 2022', 'Feb 2022', 'same as before unlock')}`, async () => { | 
|     await meSupplyPlanning.rightClickCellSelectContextmenu(MatrixSupplyPlanningContextMenuItem.Unlock.Name, 'Operation: Slitters (Qi-Ying)', '', '1-Jan-2022'); | 
|     await gcCapacityPlanning.verifyGanttChartValue('Qi-Ying', 'Jan 2022', 'Feb 2022', originalQiyingCapacity); | 
|   }); | 
| }); |