/**
|
* @file S&OP RadioButton component to wrap common methods the team encounter during development
|
* @description RadioButton class extending e2elib's RadioButton.
|
* All S&OP page objects inherit from our own class (inheriting e2e/libappbase), but we can propose common methods to them.
|
* @author Clarence (clarence.chan@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { QUtils } from '../e2elib/lib/src/main/qutils.class';
|
import { RadioButton } from '../e2elib/lib/src/pageobjects/radiobutton.component';
|
import { ElementFinder } from '../e2elib/node_modules/protractor/built';
|
import { UIActionSOP } from './objectsop';
|
|
export class RadioButtonSOP extends RadioButton implements UIActionSOP {
|
public constructor(componentPath: string, isCustomPath?: boolean, elementObj?: ElementFinder) {
|
super(componentPath, isCustomPath, elementObj);
|
}
|
|
public async setValue(value: string): Promise<void> {
|
await this.checkOnRadioButton(value);
|
}
|
|
public async clickActionLinkText(_expectedActionLinkText: string): Promise<void> {
|
// Implements UIActionSOP. Not implementing
|
}
|
|
public async getValueString(): Promise<string> {
|
return this.getCheckedRadioButtonValue();
|
}
|
|
public async verifyBatchEditEnabled(_expectedEnable: boolean, _expectedActionLinkText: string): Promise<void> {
|
// Implements UIActionSOP. Not implementing
|
}
|
|
public async verifyHasMaskError(_expectedValue: boolean): Promise<void> {
|
// Implements UIActionSOP, do nothing as has no mask error
|
}
|
|
public async verifyTooltip(expectedValue: string): Promise<void> {
|
const tooltip = await QUtils.getTooltip(this.tooltipLabelElement, true, true, true);
|
expect(tooltip).toBe(expectedValue, `Hover ${await this.getComponentLabel()} to verify tooltip.`);
|
}
|
|
public async verifyEnabled(expectedEnable: boolean): Promise<void> {
|
expect(!await this.isDisabled()).toBe(expectedEnable, `Verify enable state for radiobutton ${await this.getComponentLabel()}.`);
|
}
|
|
public async verifyValue(expectedValue: string): Promise<void> {
|
expect(await this.getCheckedRadioButtonValue()).toBe(expectedValue, `Verify value for radiobutton ${await this.getComponentLabel()}.`);
|
}
|
|
public async verifyVisible(expectedValue: string): Promise<void> {
|
expect(await this.isVisible()).toBe(expectedValue.toLowerCase() === 'true', `Verify visible state for radiobutton ${await this.getComponentLabel()}.`);
|
}
|
}
|