How to Customise and Edit Page Objects that exist within Test Modeller (generated using the UI Scanner).
Use cases: to embed Custom Code to a previous scanned UI or maybe (1a) to add Custom Code to an Auto-generated Object (2b) to edit Auto-generated code.https://www.youtube.com/watch?v=D0r6iYPv1oc
Part 1a: Add a Custom Function
Dependency: First Add some Auto-gnerated Code. In the sidebar menu click Models (new UI it’s called: Explorer) > Select and open the required Module Object > click New Function button > in the New Function pane name the function (Object) > in Function Type choose Custom Code.
Tab options: Add Parameters | Select a Return (empty = Void) | Give the function type (Custom Code) > In the example the function added is AssertPDF
Function Types: Embedded Code - embeds inside a Test Script
Custom Code - a function inside a Page Object
Next: Hit Save > (see that AssertPDF has been added). Hit Regenerate > Open the Java download file (see that the AssertPDF function is present in the code.)
At any time Parameters | Return | Code | Tracability can be edited. To do so, click the pencil (edit icon on the correspinding asset row).
Part 1b: Edit Auto-generated Code
In the example Click_Create_an_Account is edited with Custom lines.
Hit the pencil (edit icon on the corresponding asset row) > In the Edit Function pane switch the Function Type from Page Object to Custom Code. Click the Code tab > modify code and Save. Hit Regenerate again > Open the Java download file (see that the AssertPDF function is present in the code.)
TEST MODELLER FEATURE OVERVIEW