/** 
 | 
 * @file        ADSO-9367 
 | 
 * @description Select scenario via Scenario Manager list and verify selected (green tick icon) and selected in action bar fixed (top right). 
 | 
 * @author      Chan Clarence (ccn7@3ds.com) 
 | 
 * @copyright   Dassault Systèmes 
 | 
 */ 
 | 
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; 
 | 
import { AppMP } from '../../libmp/appmp'; 
 | 
import { ListScenarioContextMenuItem, ListScenarioOnDrawImage } from '../../libmp/forms/form.scenario'; 
 | 
  
 | 
describe('ADSO-9367 - Scenario selection via Scenario Manager list and verify selected (green tick icon)', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  const listScenario = appMP.viewScenarioAnalysisOverview.formScenario.lstScenario; 
 | 
  const scenario1Name = '1'; 
 | 
  const scenario2Name = '2'; 
 | 
  
 | 
  beforeAll(async () => { 
 | 
    jasmine.addMatchers(qCustomMatcher); 
 | 
    await appMP.login(); 
 | 
  }); 
 | 
  
 | 
  afterAll(async () => { 
 | 
    await appMP.resetActiveView(appMP.viewScenarioAnalysisOverview); 
 | 
    await appMP.cleanupAndLogout(); 
 | 
  }); 
 | 
  
 | 
  afterEach(async () => { 
 | 
    await appMP.checkToastMessage(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 1 - Open view ${appMP.viewScenarioAnalysisOverview.viewPath}`, async () => { 
 | 
    await appMP.viewScenarioAnalysisOverview.switchTo(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 2 - In Scenario Manager form, right click and select Create scenario menu. In dialog, enter Scenario name = ${scenario1Name} and click OK.<br> 
 | 
      Verify scenario created and have a green tick at the front of the row.<br> 
 | 
      Verify scenario ${scenario1Name} is selected at the top right dropdown (to indicate current active scenario).`, async () => { 
 | 
    await listScenario.createEmptyScenario(scenario1Name); 
 | 
  
 | 
    const row = await listScenario.getRow({Name: scenario1Name}); 
 | 
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario); 
 | 
    await appMP.verifyActiveScenario(scenario1Name); 
 | 
  }); 
 | 
  
 | 
  it(`Step 3 - Repeat previous step to create another scenario with name ${scenario2Name}. Perform same verification.`, async () => { 
 | 
    await listScenario.createEmptyScenario(scenario2Name); 
 | 
  
 | 
    const row = await listScenario.getRow({Name: scenario2Name}); 
 | 
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario); 
 | 
    await appMP.verifyActiveScenario(scenario2Name); 
 | 
  }); 
 | 
  
 | 
  it(`Step 4 - Right click scenario ${scenario1Name} and click Select menu to set as active scenario.<br> 
 | 
      Verify a green tick at the front of the row.<br> 
 | 
      Verify scenario ${scenario1Name} is selected at the top right dropdown (to indicate current active scenario).`, async () => { 
 | 
    await listScenario.expandFolderAndSelectMenu(scenario1Name, ListScenarioContextMenuItem.Select); 
 | 
  
 | 
    const row = await listScenario.getRow({Name: scenario1Name}); 
 | 
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario); 
 | 
    await appMP.verifyActiveScenario(scenario1Name); 
 | 
  }); 
 | 
  
 | 
  it(`Step 5 - Repeat previous step to select scenario ${scenario2Name}. Perform same verification.`, async () => { 
 | 
    await listScenario.expandFolderAndSelectMenu(scenario2Name, ListScenarioContextMenuItem.Select); 
 | 
  
 | 
    const row = await listScenario.getRow({Name: scenario2Name}); 
 | 
    await listScenario.verifyRowHasOnDrawImage(row, ListScenarioOnDrawImage.ActiveScenario); 
 | 
    await appMP.verifyActiveScenario(scenario2Name); 
 | 
  }); 
 | 
}); 
 |