Motivation / Problem
Right now, our QA team tests YaST with OpenQA very much based on keyboard shortcuts: Set the keyboard focus to the "User Name" input field with Alt-U, enter a user name, [Tab] to get to the next field, enter more text, finally Alt-N to activate the "Next" button.
This works quite well in general, but it happens that those keyboard shortcuts change when some other widget is added to the dialog that might compete with one of those keyboard shortcuts that is already taken: An input field "Name" might request the same Alt-N keyboard shortcut as the "Next" button. This might also happen only under certain circumstances, for example on a per-product basis where some product needs more user input and thus more widgets.
The YaST UI always had an automated keyboard shortcut conflict resolver to sort this out so within the same dialog, those shortcuts are always unique. But that might mean that the keyboard shortcut that an OpenQA test case relies on now does something different, thus making the test fail (sometimes even in very subtle ways that are hard to debug).
For one thing, that keyboard shortcut conflict resolver is a very useful thing to have for the user, so we wouldn't like to give it up for the sake of easier testing; for another, the behaviour would still change (albeit in slightly different ways) when we would deactivate that conflict resolver.
Approach for a Solution
So here is another approach: Use the widget IDs that YaST already uses internally and set the keyboard focus to a widget with that ID or activate a button with that ID: For example, the "Next" button internally uses an ID "next", "Name" typically uses "name" etc., independent of the target language the user chose for the user interface (in German, it would be a "Weiter" button, but it still uses "next" as its ID).
Basically, it would work like this:
- Press a special key combination to prepare for sending a widget ID; say, Ctrl-Alt-Shift-I
- Send the widget ID: "next", then [Return]
- YaST activates a widget if it's a button or a similar widget, or just sets the keyboard focus to it otherwise
- YaST2 Documentation - The Definitive Guide
- YaST UI Reference Documentation
- YaST UI Events
(Ruby examples despite the misleading package name)
Check out that repo, go to the examples/ subdirectory and start an example like this:
/usr/lib/YaST2/bin/y2base ./HelloWorld.rb qt
(for the Qt (graphical) UI)
/usr/lib/YaST2/bin/y2base ./HelloWorld.rb ncurses
(for the NCurses (text based) UI)
Most comprehensive example: Events.rb
/usr/lib/YaST2/bin/y2base ./Events.rb qt
Watch the YaST log in another shell window with
tail -F ~/.y2log
C++ UI Examples
Looking for mad skills in:
yastui openqa libyui-ncurses libyui-qt
This project is part of:
Hack Week 16