Skip to content

How to setup models for UI and Service test

David_Chau edited this page Jan 31, 2019 · 12 revisions

Defining UI test model

This section shows examples of how to specify page element and a location value. Web driver interacts with the page based on how we define our model objects. The codeless framework creates page object model for each ui model files under test. This model files need to have a correct yaml structure as shown below.

Example yaml file : "page.yaml"

button:
    by: "id"
    locator: "searchbutton"
username:
    by: "name"
    locator: "username"
login:
    by: "xpath"
    locator: "/html/body/app-root/app-login/div/div/div[1]/form/div[11]/div/button"
blank:
    by: "css"
    locator: "input[value='TEST']"
browse:
    by: "classname"
    locator: "btn-primary"
slack:
    by: "name"
    locator: "slackNotification"
register:
    by: "linktext"
    locator: "registerButton"
createAccount:
    by: "partiallinktext"
    locator: "create"

save your model files as yaml files in the models folder of skeleton project with above format.

In the example above, if there is a web element on a page with: id = searchbutton, you can declare that element as a button, by specifying that the locator is of type id. The example above also demonstrates other ways of declaring web elements, such as by name, xpath, etc...

Refer to the element you want to interact within your test case steps, in the Target column. For example, when attempting to refer to the browse element defined above, and assuming this file had the directory of models/example/examplepage.yml, the Target column in the test sheet would contain: example.examplepage.browse

Using the UI test model

Example UI test sheet name : "t-test1".

Step Action Target Input Overrides
config setup config
Navigate to UI page goto https://example.com
click button click example.page.button
close browser close