Skip to content
Libyui REST API plugin
Branch: master
Clone or download
Latest commit 301fb9d Apr 23, 2019

README.md

libyui-rest-api

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 QT
  • sudo 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.

Remote Access

By setting YUI_HTTP_REMOTE=1 environmental variable, one can allow connections from remote hosts.

⚠️ Security warning: Enable the remote access only in trusted environment, do not use it for production systems!


LibYUI Embedded Webserver

This webserver provides a REST API for the LibYUI application.

It can be used for testing and controlling the application in automated tests.


Short Documentation

Application

Request:

GET /application

Description

Get the application and UI generic properties like text or graphical mode, dialog size, screen size and supported UI featues.

Response

JSON format

Examples

curl http://localhost:9999/application


Dump Whole Dialog

Request:

GET /dialog

Description

Get the complete dialog structure in the JSON format. The result contains a nested structure exactly following the structure of the current dialog.

Response

JSON format

Examples

curl http://localhost:9999/dialog


Read Specific Widgets

Request:

GET /widgets

Description

Return only the selected widgets (in JSON format). The result is a flat list (no nested structures).

Parameters

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

Response

JSON format

Examples

curl 'http://localhost:9999/widgets?id=next'
curl 'http://localhost:9999/widgets?label=Next'
curl 'http://localhost:9999/widgets?type=YCheckBox'


Change Widgets, Do an Action

Request: POST /widgets

Description

Do an action with specified widgets.

Parameters

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
Then specify the action:
  • action - action to do
  • value (optional) - new value or a parameter of the action

Response

JSON format

Examples

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'

You can’t perform that action at this time.