Pega-Model
Overviewโ
Pega-Model library is based on our many years of experience of testing Pega applications. We want to make an automated testing simple, stable, fast, reliable, easy to implement and maintain. That`s how the idea of some reusable components came up. For different reasons, it is not so easy to automate Pega testing (repeatable elements, sections, iframes with generic selectors, heavy and complicated DOM structure, etc.). Pega-model library can easily handle many of these edge cases, and as a result, even a citizen developer can implement simple test cases for Pega applications!
Now there is no need to recreate each control from scratch. You can simply reuse an existing one. We've prepared a lot of controls methods (e.g. for text input fields, dropdowns, autocomplete, radio buttons, multiselection fields, and other OOTB Pega controls) and widgets (e.g. login, logoff, create the case, menu, left panel, iframe, action button, etc.).
We are constantly improving this library to make it reliable, and maintainable. A smart operator manager ensures a painless parallel test execution, a state-tracker makes tests very stable without hundreds of implicit waits required. With Pega-Model your tests are flexible, easy to build, adjust, and reuse.
Follow these steps to get up to speed up ๐๐ผโ
-
Install the Pega-model library (you must have Test Maker installed too).
-
Give some meaningful data-test-id to Pega controls and UI elements used in the application (it is recommended, but it's not a must. It is possible to implements tests with any type of selectors: id, xpath, texts, etc.).
-
Implement the test cases in the Data-Driven style by applying Page Objects.
-
Use an Operator Manager to create the user pool to avoid conflicts in Pega, and to be able to run the test cases in parallel.
-
Enable an Is App Busy Evaluator.
-
Run easy to maintain, reliable test cases in different environments using 'extra' configuration settings.
Controls and widgetsโ
The main widgets and controls available in Pega-model are:
Controls:
- any picker
- autoัompletion field
- button
- custom control (element)
- checkbox
- date picker
- date range
- dropdown
- image
- label
- logo
- multiselect
- radiobutton
- readonly text input
- rich text editor
- table
- text area
- text input
Widgets:
- actions button
- alerts
- assignment title
- case
- caseworker menu
- frame
- left panel menu
- login form
- menu
- right panel menu
- status
Talking about controls, don't forget there are different ways of selecting an identifier (a selector) for the element you want to interact with. The most common approach in Pega application is to give some meaningful and readable data-test-ids (at least automatically generated). Apart from that, you can also use ids, and other attributes, for some elements it's also possible to pass xpath or css (not for all of them though). Don't hesitate to add a container option also if needed (if the element is not unique, this approach might help. First of all, you need to find a "container" selector: section, or some UI part that contains only one element with the given selector and specify this container selector as a second parameter of the method. In this case, Pega-model is looking for the element only inside the container and skips other elements with the same selector).
All the methods below are looking for the same element and performing the same action:
await pega.textInput('TestTextInput').shouldBeVisible();
await pega.textInputByDataTestId('TestTextInput').shouldBeVisible();
await pega.textInputByXPath
('//input[@data-test-id="TestTextInput"]').shouldBeVisible();
await pega.textInputByCss('input[data-test-id="TestTextInput"]').shouldBeVisible();
await pega.textInputBy('data-test-id', 'TestTextInput').shouldBeVisible();
await pega.textInputByLabel('Test Text input').shouldBeVisible();
await pega.textInputByXPath
(`//input`, `//*[@node_name="TestScreen"]`).shouldBeVisible(); //xpath + container
In Pega-model it is also possible to set custom timeouts, intervals, retries (in the same way it is done in Test Maker):
await pega.elementByXpath(`//input[@id="New Element"]`, `//*[@node_element="Test Section"]`)
.shouldNotHaveTextByIndex("Expected Text", 1, {timeout: 10000, interval: 500, retries: 20});
If it is not specified in the method, the default one is used (from the current project configuration files or default Test Maker values).
If you are using a PEGA Model Library, it doesn't mean you are limited to this library only. You can combine it with Test Maker functionality, perform required actions in any other third-party applications and go back to Pega. There are no limits for these actions.