Tables, Rows, Columns and Cells
Tables
Tables are widely used in Pega as a separate type of elements or as a component of other controls (autocompletion fields, multiselects, etc.). It is possible to find table elements by following attributes:
Name | Parameter(s) | Type | Description |
---|---|---|---|
table | dataTestId | string | Searches for a div element that contains a table by value of a Pega data-test-id attribute, same as tableByDataTestId |
tableByTestId | dataTestId | string | Searches for a div element that contains a table by value of a Pega data-test-id attribute, same as table |
tableByTitle | plProp | string | Searches for a table element by value of a Pega pl_prop attribute (usually equal to a table title) |
tableBy | attributeName | string | Searches for a table (or any other specified)* element by an attribute name and value |
attributeValue | string | ||
elementType | string * |
- It is possible to pass ab elementType parameter per each table function. For 3 of them there is a default value (
div
fortable
andtableByDataTestId
;table
fortableByTitle
), for 1 element type is not specified and is a mandatory parameter (tableBy
);
Tables methods are rarely used as a separate step. More often table()
is a starting point in a chain that includes a particular type of Pega element inside a particular table cell, e.g.:
await pega.tableByTitle(`.Books`)
.row(1)
.cell(`Author`)
.shouldHaveReadonlyText(`William Shakespeare`);
However, the table
control still includes some specific actions and assertions. Information about rows, columns, cells, headers and possible actions you will find just after main table section.
Main action functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
addRow | Adds a row to the given table (default selector is //a[contains(normalize-space(.), 'Add Item')] ) | ||
deleteRow | Deletes a row from the given table (default selector is //a[contains(normalize-space(.), 'Delete')] ) | ||
rowElements | Returns selector for all row elements on the given table |
Assertions
Specific assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldContainNumberOfRows | rowsNumber | number | Checks if number of rows in the given table is equal to the expected one (same as assertNumberOfRows ) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldContainAtLeast | rowsNumber | number | Checks if number of rows in the given table is equal or larger than the expected one (same as assertNumberOfRowsIsAtLeast ) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldContainAtMost | rowsNumber | number | Checks if number of rows in the given table is equal or lower than the one (same as shouldContainAtMost ) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
assertNumberOfRows | rowsNumber | number | Checks if number of rows in the given table is equal to the expected one (same as shouldContainNumberOfRows ) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
assertNumberOfRowsIsAtLeast | rowsNumber | number | Checks if number of rows in the given table is equal or larger than the expected one (same as shouldContainAtLeast ) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
assertNumberOfRowsIsAtMost | rowsNumber | number | Checks if number of rows in the given table is equal or lower than the one (same as shouldContainAtMost ) |
options? | { timeout?: number, interval?: number, retries?: number } |
Common assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeVisible | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists and is visible |
shouldExist | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists |
shouldNotBeVisible | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists but is not visible |
shouldNotExist | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element does not exist |
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 } |
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.tableByTitle(`.Books`)
.waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);
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 |
Rows
It is possible to navigate in the table via rows => cells or columns => cells. You can`t combine rows and columns in one chain.
Row elements in Pega-Model library can be found by row index.
For the custom row selector info check the corresponding section of this page.
A few specific actions and assertions are available for row elements, but mostly they are used to navigate to the cell element as a next step:
Main action functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
hover | options? | { timeout?: number, interval?: number, retries?: number } | Hovers over the element. A hovered element is ready to be activated with a mouse or any mouse-emulating technology |
click | options? | { timeout?: number, interval?: number, retries?: number } | Clicks in the field |
hoverAndClick | Hovers over the element then clicks |
Assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeVisible | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists and is visible |
shouldNotBeVisible | options? | { timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists but is not visible |
Column
Columns can be found by index (number) or title (string). Depending on the passed parameter type (string or number), filters will be applied accordingly.
For the custom column selector info check the corresponding section of this page.
A few assertions are available for columns elements, but mostly they are used to navigate to the cell element as a next step:
Assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldHaveSize | count | number | Checks if the number of columns is equal to the expected one |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldHaveTexts | texts | string[] | Checks if titles of columns contain all the elements from the values list (elements order is considered too) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldHaveExactTexts | texts | string[] | Checks if titles of columns are equal to the elements from the values list (elements order is considered too) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldHaveExactTextsInAnyOrder | texts | string[] | Checks if titles of columns are equal to the elements from the values list (elements order is not considered) |
options? | { timeout?: number, interval?: number, retries?: number } |
Cell
The very first cell in a row in Pega tables is not visible often, that`s why cell index should start from '1', not '0') or columns title. Depending on the passed parameter type (string or number), filters will be applied accordingly.
Usually, cell elements could be found by chaining table/row(or column)/cell, e.g.:
await pega.tableByTitle(`.Books`)
.row(1)
.cell(`selected`)
.checkbox().shouldBeChecked();
or
await pega.tableByTitle(`.Books`)
.column(`Author`)
.cell(1)
.shouldHaveReadonlyTextByDataTestId(`William Shakespeare`,`2016072109335505834280`,`span` );
In addition to that, it is also possible to navigate directly from a table
element to a cell
element (by passing coordinates
object):
await pega.tableByTitle(`.Books`).cell({rowIndex: 1, columnIndex: 2})
.dropdownMenuShouldHaveValue('Available');
A cell
element is usually not the final goal of the element search, the user is mostly interested in the element inside it. It might be text input, readonly text, checkbox, etc.
Main action functions
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 |
hover | options? | options? { timeout?: number, interval?: number, retries?: number } | Hovers over the element. A hovered element is ready to be activated with a mouse or any mouse-emulating technology |
pressTab | Simulates "press Tab key" action | ||
click | options? | { timeout?: number, interval?: number, retries?: number } | Clicks in the field |
clickTheLink | options? | { timeout?: number, interval?: number, retries?: number } | Clicks an a element inside the cell element |
set | value | string / number | Sets the value to an input element inside the cell element |
options? | { timeout?: number, interval?: number, retries?: number } | ||
paste | value | string / number | Pastes the value to an input element inside the cell element |
options? | { timeout?: number, interval?: number, retries?: number } | ||
selectValueFromDropdownMenu | value | string / number | Selects a value of a dropdown inside the cell element |
options? | { timeout?: number, interval?: number, retries?: number } |
Assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldHaveText | text | string / number | Checks if the input element inside the cell has inner text that contains a given string |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveText | text | string / number | Checks if the input element inside the cell has inner text that does not contain a given string |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldHaveReadonlyText | text | string / number | Checks if the span element inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type) |
innerType | string (span by default) | ||
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldHaveReadonlyTextByDataTestId | text | string / number | Checks if the span element with a given data-test-id inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type) |
data-test-id | string | ||
innerType | string (span by default) | ||
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveReadonlyText | text | string / number | Checks if the span element inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type) |
innerType | string (span by default) | ||
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveReadonlyTextByDataTestId | text | string / number , | Checks if the span element with a given data-test-id inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type) |
data-test-id | string | ||
innerType | string (span by default) | ||
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldHaveValue | value | string / number | Checks if the input element inside the cell has a value that contains a given string |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldNotHaveValue | value | string / number | Checks if the input element inside the cell has a value that doe not contain a given string |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldNotBeBlank | innerType | string (span by default) | Checks if the span element inside the cell has inner text that is not equal to an empty string "" (a span element type can be replaced by any other element type) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldBeBlank | innerType | string (span by default) | Checks if the span element inside the cell has inner text that is equal to an empty string "" (a span element type can be replaced by any other element type) |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldContainElementWithAttributes | attributes | {} | Checks if the cell element contains an element with given attributes |
options? | { timeout?: number, interval?: number, retries?: number } | ||
shouldNotContainElementWithAttributes | attributes | {} | Checks if the cell element does not contain an element with given attributes |
options? | { timeout?: number, interval?: number, retries?: number } | ||
dropdownMenuShouldHaveValue | value | string / number | Checks if the option element inside the cell element has an attribute selected |
options? | { timeout?: number, interval?: number, retries?: number } |
Functions that return selectors or new controls instances
This group of functions return selectors of some specific elements inside the cell or a new instance of the Pega Model controls. Selectors can be reused as xpathes in specific or custom controls, controls might be used like usual ones with all the methods available for simple controls.
Name | Parameter(s) | Type | Description |
---|---|---|---|
icon | Returns an i element inside the cell element | ||
button | Returns a new ButtonsActions instance | ||
label | Returns a label element inside the cell element | ||
switcher | Returns a for element inside the cell element | ||
checkbox | Returns a new Checkbox (Table Checkbox) instance | ||
link | Returns an a element inside the cell element |
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.table('Gadgets').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);
Header
A header
element can be defined by index (number) or title (string). Depending on the passed parameter type (string or number), filters will be applied accordingly. e.g.:
await pega.tableByTitle(`.Books`).header(`Author`).shouldBeVisible();
or
await pega.tableByTitle(`.Books`).header(2).shouldHaveText(`Year`);
For the custom header selector info check the corresponding section of this page.
Main action functions
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 |
hover | options? | { timeout?: number, interval?: number, retries?: number } | Hovers over the element. A hovered element is ready to be activated with a mouse or any mouse-emulating technology |
click | options? | { timeout?: number, interval?: number, retries?: number } | Clicks in the field |
clickTheLink | options? | { timeout?: number, interval?: number, retries?: number } | Clicks the //ancestor::th//a element inside the cell element |
filter | options? | { timeout?: number, interval?: number, retries?: number } | Opens a filter menu of the header (if any) |
sort | options? | { timeout?: number, interval?: number, retries?: number } | Sorts the value of the column |
Assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeVisible | options? | { timeout?: number, interval?: number, retries?: number } | Checks if the element exists and visible |
shouldNotBeVisible | options? | { timeout?: number, interval?: number, retries?: number } | Checks if the element exists but is not visible |
shouldHaveText | value | string | Checks if the element's inner text contains a given string |
options? | { 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? | { 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? | { 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? | { 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.table('Gadgets').header(1).waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);
Custom row, column and header selectors
Pega custom tables might require non-standard selectors to find a row, header or column element. Then a user needs to find an xpath selector of a corresponding element and to use it in the function (index is an optional parameter):
await pega.tableByTitle(`.Books`).customHeaderByIndex(`//th[@role="columnheader"]//div[@class="cellIn " and text()="Text"]`, 0).shouldHaveExactText(`Year`);
await pega.table(``).customRowByIndex(`//tr[contains(@class, "cellCont") and @data-test-id="2022072109335505834280"]`).cell(4).dropdownMenuShouldHaveValue('Optional');