/** 
 | 
 * @file        ADSO-9321 
 | 
 * @description Scenario analysis (Overview) - KPI matrix filtered by KPI selection 
 | 
 * @author      Clarence (ccn7@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 { StepScenario } from '../../libmp/forms/form.scenario'; 
 | 
  
 | 
describe('ADSO-9321 - Scenario analysis (Overview) - KPI matrix filtered by KPI selection', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  const listScenario = appMP.viewScenario.formScenario.lstScenario; 
 | 
  const matrixEditorKPI = appMP.viewScenarioAnalysisOverview.formKPIMatrix.meKPI; 
 | 
  const listKPISelection = appMP.frmKPI.panelKPISelection.lstKPISelection; 
 | 
  const scenario1Name = '1'; 
 | 
  
 | 
  beforeAll(async () => { 
 | 
    jasmine.addMatchers(qCustomMatcher); 
 | 
    await appMP.login(); 
 | 
  }); 
 | 
  
 | 
  afterAll(async () => { 
 | 
    await appMP.viewScenario.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 - ${StepScenario.createEmptyScenario(scenario1Name)}`, async () => { 
 | 
    await listScenario.createEmptyScenario(scenario1Name); 
 | 
  }); 
 | 
  
 | 
  it(`Step 3 - Open view ${appMP.viewScenarioAnalysisOverview.viewPath}.`, async () => { 
 | 
    await appMP.viewScenarioAnalysisOverview.switchTo(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 4 - Verify KPI matrix header shows '${scenario1Name}' with 0 KPI row.`, async () => { 
 | 
    await matrixEditorKPI.verifyColumnExist(scenario1Name); 
 | 
    await matrixEditorKPI.verifyTotalRow(0); 
 | 
  }); 
 | 
  
 | 
  it(`Step 5 - Select KPI Selection tab and check KPI ${DataKPIName.Campaign} checkbox. Verify KPI Matrix shows ${DataKPIName.Campaign} row.`, async () => { 
 | 
    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); 
 | 
  
 | 
    // Reset active view 
 | 
    await appMP.resetActiveView(appMP.viewScenarioAnalysisOverview); 
 | 
  }); 
 | 
}); 
 |