Checkboxes
In Pega applications, checkboxes have 2 different types of UI implementation:
- Checkbox as a small box that can either contain a check mark or not.
- Checkbox as a slider that can be switched to the right and left side.
For both of them you can find methods in Pega-Model. For the slider type of checkbox all the functions include a "button" part in the method name: check()
, uncheck(
) vs. checkButton()
, uncheckButton()
.
Possible options to select a checkbox control:
Name | Parameter(s) | Type | Description |
---|---|---|---|
checkbox | dataTestId | string | Searches for a checkbox field by value of a Pega data-test-id attribute, same as checkboxByDataTestId |
checkboxByDataTestId | dataTestId | string | Searches for a checkbox field by value of a Pega data-test-id attribute, same as checkbox |
checkboxById | id | string | Searches for a checkbox field by value of an id attribute |
checkboxBy | attributeName | string | Searches for a checkbox field by an attribute name and value |
attributeValue | string |
We do not provide an option to select a checkbox field by css or xpath because we need to be very precise with the selectors in order to be able to find a given option to check/uncheck. If there is a need to define a checkbox field via xpath or css use a custom element elementByXpath
or elementByCss
.
Main action functions
Each check
/uncheck
method verifies if the field is not already in according status (same checkbox could not be checked/unchecked two times, an error message will be thrown for the second time).
Name | Parameter(s) | Type | Checkbox type | Description |
---|---|---|---|---|
check | options? | { index?: number, timeout?: number, interval?: number, retries?: number } | box type | Checks a checkbox |
checkByIndex | index | number | box type | Checks a checkbox by index |
options? | { index?: number, timeout?: number, interval?: number, retries?: number } | |||
checkButton | options? | { index?: number, timeout?: number, interval?: number, retries?: number } | slider type | Checks a checkbox |
uncheck | options? | { index?: number, timeout?: number, interval?: number, retries?: number } | box type | Unchecks a checkbox |
uncheckByIndex | index | number | box type | Unchecks a checkbox by index |
options? | { index?: number, timeout?: number, interval?: number, retries?: number } | |||
uncheckButton | options? | { index?: number, timeout?: number, interval?: number, retries?: number } | slider type | Unchecks a checkbox |
checkIf | toClick | boolean | box type | Checks a checkbox if passed value === true |
options? | { index?: number, timeout?: number, interval?: number, retries?: number } |
IsChecked function
Name | Parameter(s) | Type | Description |
---|---|---|---|
isChecked | options? | { index?: number, timeout?: number, interval?: number, retries?: number } | Returns true if the checkbox element has a checked attribute |
Assertions
Specific assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeChecked | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Verifies if the checkbox element has a checked attribute |
shouldBeUnChecked | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Verifies if the checkbox element does not have a checked attribute |
Common assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeVisible | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists and is visible |
shouldExist | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists |
shouldNotBeVisible | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists but is not visible |
shouldNotExist | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element does not exist |
shouldHaveText | value | string | Checks if the element's inner text contains a given string |
options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveText | value | string | Checks if the element's inner text does not contain a given string |
options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldHaveExactText | value | string | Checks if the element's inner text is equal to a given string |
options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveExactText | value | string | Checks if the element's inner text is not equal to a given string |
options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldHaveValue | value | string | Checks if the element's value contains a given string |
options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveValue | value | string | Checks if the element's value does not contain a given string |
options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldBeEnabled | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element doesn't have a disabled attribute |
shouldBeDisabled | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element has a disabled attribute |
shouldBeRequired | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the field is mandatory |
shouldNotBeRequired | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the field is not mandatory |
shouldHaveValidationType | validationType | string | Checks if the element's validation type is equal to a given one |
options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveValidationType | validationType | string | Checks if the element's validation type is not equal to a given one |
options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } |
Wait for
functions
Simple wait for visibility functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
waitUntilVisibility | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element to be visible |
waitUntilInvisibility | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element to be invisible |
waitUntilElementExists | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element to exist |
waitUntilElementNotExist | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element not to exist |
Complex wait for visibility functions
Allow filtering of available elements by index, text, attribute:
Name | Parameter(s) | Type | Description |
---|---|---|---|
waitUntilVisibilityByText | text | string | Filters collection of elements by text and waits for the element to be visible |
options? | { timeout?: number, interval?: number, retries?: number } | ||
waitUntilVisibilityByAttribute | attributeName | string | Filters collection of elements by attribute and waits for the element to be visible |
attributeValue | string | ||
options? | { timeout?: number, interval?: number, retries?: number } | ||
waitUntilVisibilityByIndex | index | number | Filters collection of elements by index and waits for the element to be visible |
options? | { timeout?: number, interval?: number, retries?: number } | ||
waitUntilInvisibilityByIndex | index | number | Filters collection of elements by index and waits for the element not to be visible |
options? | { timeout?: number, interval?: number, retries?: number } |
Wait for a collection size functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
waitUntilCollectionOfElementsSizeIsGreaterOrEqual | expectedSize | number | Waits until collection of elements have specific size (or there are more) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
waitUntilCollectionOfElementsSizeIsLessThan | expectedSize | number | Waits until collection of elements have fewer elements than specified |
options? | { timeout?: number, interval?: number, retries?: number } |
Actionability check
ActionabilityCheckTypes == attached
| stable
| visible
| enabled
| editable
Name | Parameter(s) | Type | Description |
---|---|---|---|
waitForSelectActionabilityCheck | check types | [] | Waits for the element to pass all the selected actionability check types |
isFilterByVisibility | boolean (true by default) |
e.g.
await pega.checkbox('24972094628502592').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);
Other helpers
Name | Parameter(s) | Type | Description |
---|---|---|---|
focus | options? | { timeout?: number, interval?: number, retries?: number } | Focuses the element. A focused element is ready to be activated with a keyboard or any keyboard-emulating technology |
IsVisible and IsExists functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
isVisible | options? | { timeout?: number, interval?: number, retries?: number } | Returns true if the element exists and is visible |
isExists | options? | { timeout?: number, interval?: number, retries?: number } | Returns true if the element exists |