| /** | 
|  * @file        ADSO-9348 | 
|  * @description Scenario comparison - Add KPIs to the matrix | 
|  * @author      Kee Jie Yi (jke5@3ds.com) | 
|  * @copyright   Dassault Systèmes | 
|  */ | 
| import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; | 
| import { AppMP } from '../../libmp/appmp'; | 
| import { DataKPIName } from '../../libmp/data/data.kpi'; | 
| import { ListKPISelectionContextMenuItem } from '../../libmp/forms/form.kpi'; | 
|   | 
| describe('ADSO-9348 - Scenario comparison - Add KPIs to the matrix', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const listScenario = appMP.viewScenario.formScenario.lstScenario; | 
|   const matrixEditorKPI = appMP.viewScenarioComparisonCost.formKPIMatrix.meKPI; | 
|   const listKPISelection = appMP.frmKPI.panelKPISelection.lstKPISelection; | 
|   const scenario1Name = '1'; | 
|   const scenario2Name = '2'; | 
|   | 
|   beforeAll(async () => { | 
|     jasmine.addMatchers(qCustomMatcher); | 
|     await appMP.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     await appMP.viewScenario.reset(); | 
|     await appMP.viewScenarioComparisonCost.reset(); | 
|     await appMP.cleanupAndLogout(); | 
|   }); | 
|   | 
|   afterEach(async () => { | 
|     await appMP.checkToastMessage(); | 
|   }); | 
|   | 
|   it(`Step 1 - Open view ${appMP.viewScenario.viewPath}`, async () => { | 
|     await appMP.viewScenario.switchTo(); | 
|   }); | 
|   | 
|   it(`Step 2 - In Scenario Manager form, right click and select Create scenario menu. | 
|       In dialog, enter Scenario name = ${scenario1Name} and click OK. Verify it is created.`, async () => { | 
|     await listScenario.createEmptyScenario(scenario1Name); | 
|   }); | 
|   | 
|   it(`Step 3 - Repeat previous step to create another scenario with name ${scenario2Name}. Verify it is created.`, async () => { | 
|     await listScenario.createEmptyScenario(scenario2Name); | 
|   }); | 
|   | 
|   it(`Step 4 - Open view ${appMP.viewScenarioComparisonCost.viewPath}. | 
|       Select both scenarios in Scenario Manager list. Verify KPI matrix header show both scenarios with 0 KPI row.`, async () => { | 
|     await appMP.viewScenarioComparisonCost.switchTo(); | 
|     await listScenario.selectListRows([{Name: scenario1Name}, {Name: scenario2Name}]); | 
|     await matrixEditorKPI.verifyColumnExist(scenario1Name); | 
|     await matrixEditorKPI.verifyColumnExist(scenario2Name); | 
|     await matrixEditorKPI.verifyTotalRow(0); | 
|   }); | 
|   | 
|   it(`Step 5 - Expand KPI Dashboard panel. Select KPI Selection tab and check KPI ${DataKPIName.Campaign} checkbox. | 
|       Verify KPI Matrix shows ${DataKPIName.Campaign} row.`, async () => { | 
|     await appMP.frmKPI.restore(); | 
|     await appMP.frmKPI.openKPISelectionPanel(); | 
|     const row = await listKPISelection.getRow({Name: DataKPIName.Campaign}); | 
|     await listKPISelection.toggleRowCheckbox(row, true); | 
|     await matrixEditorKPI.verifyRowExist(DataKPIName.Campaign); | 
|   }); | 
|   | 
|   it(`Step 6 - Uncheck KPI ${DataKPIName.Campaign} checkbox. Verify ${DataKPIName.Campaign} row is removed from KPI Matrix.`, async () => { | 
|     const row = await listKPISelection.getRow({Name: DataKPIName.Campaign}); | 
|     await listKPISelection.toggleRowCheckbox(row, false); | 
|     await matrixEditorKPI.verifyRowNotExist(DataKPIName.Campaign); | 
|   }); | 
|   | 
|   it(`Step 7 - Select 2 KPIs (${DataKPIName.Blending} & ${DataKPIName.Campaign}) then right click > Select menu. | 
|       Verify KPI matrix row shows both KPIs.`, async () => { | 
|     await listKPISelection.selectListRows([{Name: DataKPIName.Campaign}, {Name: DataKPIName.Blending}]); | 
|     await listKPISelection.selectContextMenu(ListKPISelectionContextMenuItem.Select); | 
|     await matrixEditorKPI.verifyRowExist(DataKPIName.Campaign); | 
|     await matrixEditorKPI.verifyRowExist(DataKPIName.Blending); | 
|   }); | 
|   | 
|   it(`Step 8 - Select 2 KPIs (${DataKPIName.Blending} & ${DataKPIName.Campaign}) then right click > Deselect menu. | 
|       Verify KPI matrix row removed both KPIs.`, async () => { | 
|     await listKPISelection.selectListRows([{Name: DataKPIName.Campaign}, {Name: DataKPIName.Blending}]); | 
|     await listKPISelection.selectContextMenu(ListKPISelectionContextMenuItem.Deselect); | 
|     await matrixEditorKPI.verifyRowNotExist(DataKPIName.Campaign); | 
|     await matrixEditorKPI.verifyRowNotExist(DataKPIName.Blending); | 
|   }); | 
|   | 
| }); |