| import { ActionBarPage } from '../../e2elib/lib/src/pageobjects/actionbarpage.component'; | 
| import { ButtonSOP } from '../../libappsop/buttonsop'; | 
| import { DialogOptimizer } from '../dialogs/dialog.optimizer'; | 
| import { FormOptimizerPuzzles } from '../forms/form.optimizerpuzzles'; | 
|   | 
| export class ActionBarPageScenarioSelection extends ActionBarPage { | 
|   // Buttons | 
|   public btnRunOptimizer = new ButtonSOP('ButtonOptimizer', 'ContextMenuOptimizerFunctions'); | 
|   | 
|   // Right docked forms | 
|   public formOptimizerPuzzles = new FormOptimizerPuzzles(); | 
|   | 
|   // Dialog for optimizer | 
|   public dlgOptimizer = new DialogOptimizer(); | 
|   | 
|   public constructor() { | 
|     super('ActionBarPageScenarioSelection'); | 
|   } | 
|   | 
|   /** | 
|    * Clicks on Optimizer button to display run dialog. | 
|    * | 
|    * @returns Dialog for optimizer. | 
|    */ | 
|   public async clickOptimizerButton(): Promise<DialogOptimizer> { | 
|     await this.btnRunOptimizer.click(); | 
|     await this.dlgOptimizer.waitUntilPresent(); | 
|   | 
|     return this.dlgOptimizer; | 
|   } | 
|   | 
|   /** | 
|    * To verify is optimizer completed after pass-in wait time | 
|    * | 
|    * @param optimizerWaitTime miliseconds of how long it should wait for optimizer to be complete | 
|    */ | 
|   public async verifyIsOptimizerCompleted(optimizerWaitTime: number): Promise<boolean> { | 
|     // first to check whether btnRunOptimizer icon is change to GEAR_STOP | 
|     await this.btnRunOptimizer.waitForScreenUpdate(); | 
|     let btnIcon = await this.btnRunOptimizer.getButtonIcon(); | 
|     let result = btnIcon === ButtonRunOptimizerIcon.Stop; | 
|     // If btnRunOptimizer icon is changed, then wait for sometimes and check again whether btnRunOptimizer icon is change to GEAR_PLAY | 
|     if (result) { | 
|       await this.btnRunOptimizer.waitForScreenUpdate(optimizerWaitTime); | 
|       btnIcon = await this.btnRunOptimizer.getButtonIcon(); | 
|       result = btnIcon === ButtonRunOptimizerIcon.Play; | 
|     } | 
|     return result; | 
|   } | 
|   | 
|   /** | 
|    * Toggle show right docked Optimizer Puzzles form by clicking sub-menu of Optimizer button. | 
|    * | 
|    * @param show True to show, False to hide. | 
|    */ | 
|   public async toggleOptimizerPuzzles(show: boolean): Promise<void> { | 
|     if (show !== (await this.formOptimizerPuzzles.isOpen())) { | 
|       await this.btnRunOptimizer.clickDropdownAndSelectMenu(optimizerButtonContextMenuItem.OptimizerPuzzles.Name); | 
|     } | 
|   } | 
| } | 
|   | 
| export enum ButtonRunOptimizerIcon { | 
|   Stop = 'GEAR_STOP', | 
|   Play = 'GEAR_RUN', | 
| } | 
|   | 
| const optimizerButtonContextMenuItem = { | 
|   OptimizerStrategies: { ContextMenu: 'ContextMenuOptimizerFunctions', Name: 'MenuOptimizerStrategies', Label: 'Optimizer Strategies' }, | 
|   OptimizerPuzzles: { ContextMenu: 'ContextMenuOptimizerFunctions', Name: 'MenuOptimizerPuzzles', Label: 'Optimizer Puzzles' }, | 
| }; | 
|   | 
| export { optimizerButtonContextMenuItem as OptimizerButtonContextMenuItem }; | 
|   | 
| const stepActionBarScenarioSelection = { | 
|   clickOptimizerButton: (): string => 'In the action bar page, click on the Optimizer button to bring up optimizer run dialog.', | 
|   toggleOptimizerPuzzles: (show: boolean): string => `${show ? 'Show' : 'Hide'} right docked Optimizer Puzzles by clicking Top right > Optimizer > Optimizer Puzzles.`, | 
|   verifyIsOptimizerCompleted: (): string => 'Wait for the optimizer to complete (optimizer button icon should not have the red stop sign).', | 
| }; | 
|   | 
| export { stepActionBarScenarioSelection as StepActionBarScenarioSelection }; |