| /** | 
|  * @file        ADSO-9503 | 
|  * @description Constraint on optimizer strategy with empty levels | 
|  * @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 { ListStrategy, ListStrategyContextMenuItem } from '../../libmp/forms/form.optimizerstrategies'; | 
| import { DialogStrategy, ListActiveGoals, ListActiveGoalsContextMenuItem } from '../../libmp/dialogs/dialog.strategy'; | 
| import { StepList } from '../../libappsop/listsop'; | 
| import { StepDialog } from '../../libappsop/dialogsop'; | 
| import { DialogGoal } from '../../libmp/dialogs/dialog.goal'; | 
| import { DataFoodStrategyName } from '../../libmp/data/data.strategy'; | 
| import { DataKPIName } from '../../libmp/data/data.kpi'; | 
|   | 
| describe('ADSO-9503 - Constraint on optimizer strategy with empty levels', () => { | 
|   const appMp = AppMP.getInstance(); | 
|   const listStrategy = appMp.viewOptimizerStrategies.frmOptimizerStrategies.listStrategy; | 
|   let dlgStrategy: DialogStrategy; | 
|   let listActiveGoals: ListActiveGoals; | 
|   let dlgEdit: DialogGoal; | 
|   | 
|   beforeAll(async () => { | 
|     jasmine.addMatchers(qCustomMatcher); | 
|     await appMp.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     await appMp.resetActiveView(appMp.viewScenarioAnalysisOverview); | 
|     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 view ${appMp.viewOptimizerStrategies.viewPath}`, async () => { | 
|     await appMp.viewOptimizerStrategies.switchTo(); | 
|   }); | 
|   | 
|   it(`Step 2 - ${StepList.selectRowAndClickMenu(ListStrategy.title, { Name: DataFoodStrategyName.Default }, ListStrategyContextMenuItem.Edit.Label)}`, async () => { | 
|     const row = await listStrategy.getRow({ Name: DataFoodStrategyName.Default }); | 
|     [dlgStrategy] = await listStrategy.selectContextMenu(ListStrategyContextMenuItem.Edit, row); | 
|   }); | 
|   | 
|   it(`Step 3 - ${StepList.selectRowAndClickMenu(ListActiveGoals.name, { KPI: DataKPIName.Fulfillment }, ListActiveGoalsContextMenuItem.Deactivate.Label)}`, async () => { | 
|     listActiveGoals = dlgStrategy.listActiveGoals; | 
|     const row = await listActiveGoals.getRow({ KPI: DataKPIName.Fulfillment }); | 
|     await listActiveGoals.selectContextMenu(ListActiveGoalsContextMenuItem.Deactivate, row); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepDialog.verifyOKDisabled()}`, async () => { | 
|     await dlgStrategy.verifyOKDisabled(); | 
|     // Disabled as there's empty level | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepList.selectRowAndClickMenu(ListActiveGoals.name, { KPI: DataKPIName.SourcingCost }, ListActiveGoalsContextMenuItem.Edit.Label)}`, async () => { | 
|     const row = await listActiveGoals.getRow({ KPI: DataKPIName.SourcingCost }); | 
|     [dlgEdit] = await listActiveGoals.selectContextMenu(ListActiveGoalsContextMenuItem.Edit, row); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepDialog.updateDialogValues(DialogGoal.title, { Level: '3' })}`, async () => { | 
|     // Edit to the level of the deactivated goal in previous step. This will ensure no empty levels. | 
|     await dlgEdit.updateDialogValues({ Level: '3' }); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepDialog.clickOK()}`, async () => { | 
|     await dlgEdit.clickOK(); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepDialog.verifyOKEnabled()}`, async () => { | 
|     // Enabled as there's no more empty level | 
|     await dlgStrategy.verifyOKEnabled(); | 
|   }); | 
|   | 
|   it(`Step 9 - ${StepDialog.clickCancel()}`, async () => { | 
|     // Strategy is global to all food scenarios thus don't change the data else will effect subsequent tests | 
|     await dlgStrategy.clickCancel(); | 
|   }); | 
| }); |