Skip to content

jknphy/libyui-rest-api

 
 

Repository files navigation

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'

About

Libyui REST API plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.3%
  • CMake 3.0%
  • Other 0.7%