| /** | 
|  * @file        S&OP WebMessageBox component to wrap common methods the team encounter during development | 
|  * @description WebMessageBox class extending libappbase's WebMessageBox. | 
|  * All S&OP page objects inherit from our own class (inheriting e2e/libappbase), but we can propose common methods to them. | 
|  * @author      Kong Ching Shien (ckg6@3ds.com) | 
|  * @copyright   Dassault Systèmes | 
|  */ | 
| import { Button } from '../e2elib/lib/src/pageobjects/button/button.component'; | 
| import { WebMessageBox } from '../libappbase/webmessagebox'; | 
|   | 
| export enum WebMessageButton { | 
|   Yes = 'Yes', | 
|   No = 'No', | 
|   OK = 'OK', | 
| } | 
|   | 
| export class WebMessageBoxSOP extends WebMessageBox { | 
|   private readonly _btnOk = new Button('btnAction9'); | 
|   | 
|   /** | 
|    * Click OK button to dismiss message box and wait till hidden. | 
|    */ | 
|   public async selectOk(): Promise<void> { | 
|     await this._btnOk.click(); | 
|     await this.waitUntilHidden(); | 
|   } | 
|   | 
|   /** | 
|    * Verify web message text and click button to dismiss. | 
|    * | 
|    * @param message Text to verify. | 
|    * @param clickButton Button to click to dismiss message box. | 
|    */ | 
|   public async verifyMessageAndDismiss(message: string, clickButton: WebMessageButton): Promise<void> { | 
|     await this.waitUntilPresent(); | 
|     expect(await this.getMessage()).toBe(message, 'Verify web message box text'); | 
|   | 
|     switch (clickButton) { | 
|       case WebMessageButton.Yes: | 
|         await this.selectYes(); | 
|         break; | 
|       case WebMessageButton.No: | 
|         await this.selectNo(); | 
|         break; | 
|       case WebMessageButton.OK: | 
|         await this.selectOk(); | 
|         break; | 
|       default: | 
|           break; | 
|     } | 
|   } | 
| } | 
|   | 
| const stepWebMessageBox = { | 
|   clickButton: (buttonName: string): string => `In message box, click ${buttonName}.`, | 
|   verifyMessageAndDismiss: (message: string, buttonName: string = 'OK'): string => `In message box, verify message "${message}" and click ${buttonName} to dismiss dialog.`, | 
| }; | 
|   | 
| export { stepWebMessageBox as StepWebMessageBox }; |