YaST UI rest api framework for integration testing. Project started by @lslezak, with support of @cwh42 and @OleksandrOrlov.
The solution allows to query the UI properties over HTTP using a REST API. This allows to automate UI interaction steps and avoid screen-based tools. API allows reading properties of the UI, so entered text can be validated.
To start application with rest API enabled, use following commands:
xdg-su -c 'Y2TEST=1 YUI_HTTP_PORT=9999 yast2 host'
for QTsudo Y2TEST=1 YUI_HTTP_PORT=9999 yast2 host
for ncurses.
After that, you can get documentation how to interact with UI by accessing
http://localhost:9999
.
By setting YUI_HTTP_REMOTE=1
environmental variable, one can allow connections
from remote hosts.
This webserver provides a REST API for the LibYUI application.
It can be used for testing and controlling the application in automated tests.
Request:
GET /application
Get the application and UI generic properties like text or graphical mode, dialog size, screen size and supported UI featues.
JSON format
curl http://localhost:9999/application
Request:
GET /dialog
Get the complete dialog structure in the JSON format. The result contains a nested structure exactly following the structure of the current dialog.
JSON format
curl http://localhost:9999/dialog
Request:
GET /widgets
Return only the selected widgets (in JSON format). The result is a flat list (no nested structures).
Filter widgets:
- id - widget ID serialized as string, might include special characters like backtick (\`)
- label - widget label as currently displayed (i.e. translated!)
- type - widget type
JSON format
curl 'http://localhost:9999/widgets?id=next'
curl 'http://localhost:9999/widgets?label=Next'
curl 'http://localhost:9999/widgets?type=YCheckBox'
Request: POST /widgets
Do an action with specified widgets.
Filter the widgets, one of:
- id - widget ID serialized as string, might include special characters like backtick (\`)
- label - widget label as currently displayed (i.e. translated!)
- type - widget type
- action - action to do
- value (optional) - new value or a parameter of the action
JSON format
Press the "next" button:
curl -X POST 'http://localhost:9999/widgets?id=next&action=press'Set value "test" for the InputField with label "Description":
curl -X POST 'http://localhost:9999/widgets?label=Description&action=enter&value=test'