import { QConsole } from '../e2elib/lib/src/helper/qconsole';
|
import { frmSelectImage } from '../e2elib/lib/src/UI/WebComponentTypeLibrary/frmSelectImage';
|
import { ButtonSOP } from './buttonsop';
|
|
/**
|
* Web built-in select image dialog.
|
*/
|
export class FormSelectImage extends frmSelectImage {
|
|
private readonly btnSelectImage: ButtonSOP;
|
|
public constructor(btnSelectImage: string) {
|
super(frmSelectImage._name);
|
this.btnSelectImage = new ButtonSOP(btnSelectImage);
|
}
|
|
/**
|
* Opens the select image form, finds and select the icon and click ok.
|
* Enters image name using the Search/Filter edit field, then find the image in the lists and selects it.
|
*
|
* @param name Icon name
|
*/
|
public async selectImage(name: string): Promise<void> {
|
// Open select image form by clicking select icon button.
|
await this.btnSelectImage.click();
|
await QConsole.waitForStable();
|
|
// Filter icon list
|
await this.efSearch._ref().sendInput(name);
|
|
// Navigate category one by one to search for the icon (on the filtered list)
|
const rowCount = await this.lstImageCategories._ref().getRowCount();
|
let isFound = false;
|
for (let i = 0; i < rowCount; i++) {
|
await this.lstImageCategories._ref().selectListRowsByIndex([i]);
|
try {
|
await this.lstImages._ref().selectListRowsByValue([[{ columnID: ListImagesColumn.Name, value: name }]]);
|
isFound = true;
|
break;
|
} catch {
|
// do nothing
|
}
|
}
|
expect(isFound).toBe(true, `Unable to find the image name "${name}" in the select image dialog.`);
|
await this.btnOk._ref().click();
|
await this._ref().waitUntilHidden(); // Wait dialog dismiss
|
}
|
}
|
|
export enum ListImagesColumn {
|
Name = 'Name',
|
}
|