mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Added isChecked method to verify the status of checkbox widget (#5173)
* added method to assert on checkbox widget, isChecked * removed unnecessary method * added method in checkboxWidget * moved the method to checkbox widget
This commit is contained in:
committed by
Eugenio Romano
parent
9f69a7d4ee
commit
b7ec525b62
@@ -16,14 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { FormFields } from '../formFields';
|
import { FormFields } from '../formFields';
|
||||||
import { BrowserActions } from '../../../utils/public-api';
|
import { BrowserActions, BrowserVisibility } from '../../../utils/public-api';
|
||||||
import { by, element } from 'protractor';
|
import { by, element, Locator } from 'protractor';
|
||||||
import { ElementFinder } from 'protractor';
|
import { ElementFinder } from 'protractor';
|
||||||
|
|
||||||
export class CheckboxWidget {
|
export class CheckboxWidget {
|
||||||
|
|
||||||
formFields: FormFields = new FormFields();
|
formFields: FormFields = new FormFields();
|
||||||
checkboxLabel: ElementFinder = element(by.css('span[class*="mat-checkbox-label"]'));
|
checkboxLabel: ElementFinder = element(by.css('span[class*="mat-checkbox-label"]'));
|
||||||
|
checkboxLocator: Locator = by.css('mat-checkbox');
|
||||||
|
|
||||||
getCheckboxLabel(): Promise<string> {
|
getCheckboxLabel(): Promise<string> {
|
||||||
return BrowserActions.getText(this.checkboxLabel);
|
return BrowserActions.getText(this.checkboxLabel);
|
||||||
@@ -41,4 +42,14 @@ export class CheckboxWidget {
|
|||||||
async isCheckboxHidden(fieldId): Promise<void> {
|
async isCheckboxHidden(fieldId): Promise<void> {
|
||||||
await this.formFields.checkWidgetIsHidden(fieldId);
|
await this.formFields.checkWidgetIsHidden(fieldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isCheckboxChecked(fieldId): Promise<boolean> {
|
||||||
|
let isChecked: boolean = false;
|
||||||
|
const checkboxWidget: ElementFinder = await (await this.formFields.getWidget(fieldId)).element(this.checkboxLocator);
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(checkboxWidget);
|
||||||
|
await checkboxWidget.getAttribute('class').then((attributeValue) => {
|
||||||
|
isChecked = attributeValue.includes('mat-checkbox-checked');
|
||||||
|
});
|
||||||
|
return isChecked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user