Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { WebMessageBox } from '../../libappbase/webmessagebox';
import { Timeout } from '../appmp';
import { DialogBase } from '../../libappbase/dialogbase';
import { DropDownStringListSOP } from '../../libappsop/dropdownstringlistsop';
 
export class DialogSelectDemoDataset extends DialogBase {
  private readonly _ddStringListSelectDemo = new DropDownStringListSOP('DropDownStringListCategory');
  private readonly _ddStringListSelectScenario = new DropDownStringListSOP('DropDownStringListScenario');
  private readonly _webMessageBox = new WebMessageBox();
 
  public constructor() {
    super('DialogSelectDemoDataset', 'btnOk', 'btnCancel');
  }
 
  public async selectDemoDataset(demo: string, scenario: string): Promise<void> {
    // select demo and scenario
    await this.waitUntilPresent();
    await this._ddStringListSelectDemo.selectItem(demo);
    await this._ddStringListSelectScenario.selectItem(scenario);
    // Do not use DialogBase.clickOK.
    // In this case, there will be a confirmation message box to check before closing the demo data dialog.
    // Hence, check waitUntilHidden after closing confirmation message box.
    await this.btnOk.click();
 
    // select yes for the confirmation
    await this._webMessageBox.waitUntilPresent(false);
    await this._webMessageBox.selectYes();
    await this._webMessageBox.waitUntilHidden(Timeout.Short);
    await this.waitUntilHidden(Timeout.Medium);
  }
}