Skip to main content
Version: 9.0.0

Checkboxes

In Pega applications, checkboxes have 2 different types of UI implementation:

  1. Checkbox as a small box that can either contain a check mark or not.
  2. 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:

NameParameter(s)TypeDescription
checkboxdataTestIdstringSearches for a checkbox field by value of a Pega data-test-id attribute, same as checkboxByDataTestId
checkboxByDataTestIddataTestIdstringSearches for a checkbox field by value of a Pega data-test-id attribute, same as checkbox
container?string
checkboxByIdidstringSearches for a checkbox field by value of an id attribute
container?string
checkboxByattributeNamestringSearches for a checkbox field by an attribute name and value
attributeValuestring
container?string
checkboxByXPathxpathstringSearches for an element by a custom css selector
container?string
checkboxByCsscssstringSearches for an element by a custom xpath selector

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).

NameParameter(s)TypeCheckbox typeDescription
checkoptions?{ index?: number, timeout?: number, interval?: number, retries?: number }box typeChecks a checkbox
checkByIndexindexnumberbox typeChecks a checkbox by index
options?{ index?: number, timeout?: number, interval?: number, retries?: number }
checkButtonoptions?{ index?: number, timeout?: number, interval?: number, retries?: number }slider typeChecks a checkbox
uncheckoptions?{ index?: number, timeout?: number, interval?: number, retries?: number }box typeUnchecks a checkbox
uncheckByIndexindexnumberbox typeUnchecks a checkbox by index
options?{ index?: number, timeout?: number, interval?: number, retries?: number }
uncheckButtonoptions?{ index?: number, timeout?: number, interval?: number, retries?: number }slider typeUnchecks a checkbox
checkIftoClickbooleanbox typeChecks a checkbox if passed value === true
options?{ index?: number, timeout?: number, interval?: number, retries?: number }

IsChecked function

NameParameter(s)TypeDescription
isCheckedoptions?{ index?: number, timeout?: number, interval?: number, retries?: number }Returns true if the checkbox element has a checked attribute

Assertions

Specific assertions

NameParameter(s)TypeDescription
shouldBeCheckedoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Verifies if the checkbox element has a checked attribute
shouldBeUnCheckedoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Verifies if the checkbox element does not have a checked attribute

Common assertions

NameParameter(s)TypeDescription
shouldBeVisibleoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element exists and is visible
shouldExistoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element exists
shouldNotBeVisibleoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element exists but is not visible
shouldNotExistoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element does not exist
shouldHaveTextvaluestringChecks if the element's inner text contains a given string
options?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveTextvaluestringChecks if the element's inner text does not contain a given string
options?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldHaveExactTextvaluestringChecks if the element's inner text is equal to a given string
options?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveExactTextvaluestringChecks if the element's inner text is not equal to a given string
options?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldHaveValuevaluestringChecks if the element's value contains a given string
options?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveValuevaluestringChecks if the element's value does not contain a given string
options?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldBeEnabledoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element doesn't have a disabled attribute
shouldBeDisabledoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element has a disabled attribute
shouldBeRequiredoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the field is mandatory
shouldNotBeRequiredoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the field is not mandatory
shouldHaveValidationTypevalidationTypestringChecks if the element's validation type is equal to a given one
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveValidationTypevalidationTypestringChecks if the element's validation type is not equal to a given one
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }

Wait for functions

Simple wait for visibility functions

NameParameter(s)TypeDescription
waitUntilVisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be visible
waitUntilInvisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be invisible
waitUntilElementExistsoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to exist
waitUntilElementNotExistoptions?{ 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:

NameParameter(s)TypeDescription
waitUntilVisibilityByTexttextstringFilters collection of elements by text and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByAttributeattributeNamestringFilters collection of elements by attribute and waits for the element to be visible
attributeValuestring
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByIndexindexnumberFilters collection of elements by index and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilInvisibilityByIndexindexnumberFilters 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

NameParameter(s)TypeDescription
waitUntilCollectionOfElementsSizeIsGreaterOrEqualexpectedSizenumberWaits until collection of elements have specific size (or there are more)
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilCollectionOfElementsSizeIsLessThanexpectedSizenumberWaits until collection of elements have fewer elements than specified
options?{ timeout?: number, interval?: number, retries?: number }

Actionability check

ActionabilityCheckTypes == attached | stable | visible | enabled | editable

NameParameter(s)TypeDescription
waitForSelectActionabilityCheckcheck types[]Waits for the element to pass all the selected actionability check types
isFilterByVisibilityboolean (true by default)

e.g.

await pega.checkbox('24972094628502592').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);

Other helpers

NameParameter(s)TypeDescription
focusoptions?{ 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

NameParameter(s)TypeDescription
isVisibleoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists and is visible
isExistsoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists