keyboard¶
Source code: keyboard.py
Tests keyboard functionality.
Description¶
This test check basic keyboard functionality by asking operator to press each keys on keyboard once at a time.
The layout of the keyboard is derived from vpd ‘region’ value, and can be
overwritten by argument layout
.
If allow_multi_keys
is True, the operator can press multiple keys at once
to speed up the testing.
If sequential_press
or strict_sequential_press
is True, the operator
have to press each key in order from top-left to bottom-right. Additionally, if
strict_sequential_press
is True, the test would fail if the operator press
the wrong key.
A dict repeat_times
can be specified to indicate number of times each key
have to be pressed before the key is marked as checked.
The test would fail after timeout_secs
seconds.
Test Procedure¶
The test shows an image of the keyboard, and each key labeled with how many times it need to be pressed.
Operator press each key the number of times needed, and keys on UI would be marked as such.
The test pass when all keys have been pressed for the number of times needed, or fail after
timeout_secs
seconds.
Dependency¶
Depends on ‘evdev’ module to monitor key presses.
Examples¶
To test keyboard functionality, add this into test list:
{
"pytest_name": "keyboard"
}
To test keyboard functionality, allow multiple keys to be pressed at once, and have a timeout of 10 seconds, add this into test list:
{
"pytest_name": "keyboard",
"args": {
"allow_multi_keys": true,
"timeout_secs": 10
}
}
To test keyboard functionality, ask operator to press keys in order, skip keycode [4, 5, 6], have keycode 3 be pressed 5 times, and other keys be pressed 2 times to pass, add this into test list:
{
"pytest_name": "keyboard",
"args": {
"sequential_press": true,
"skip_keycodes": [4, 5, 6],
"repeat_times": {
"3": 5,
"default": 2
}
}
}
To test keyboard functionality, ask operator to press keys in order (and fail the test if wrong key is pressed), and set keyboard layout to ISO, add this into test list:
{
"pytest_name": "keyboard",
"args": {
"strict_sequential_press": true,
"layout": "ISO"
}
}
To test keyboard functionality, ask operator to press [2,3] and [4,5] at the same time, and have a timeout of 300 seconds, add this into test list:
{
"pytest_name": "keyboard",
"args": {
"key_combinations": [[2, 3], [4, 5]],
"timeout_secs": 300
}
}
Test Arguments¶
Name |
Type |
Description |
---|---|---|
allow_multi_keys |
bool |
(optional; default: |
multi_keys_delay |
int, float |
(optional; default: |
layout |
str, None |
(optional; default: |
timeout_secs |
int |
(optional; default: |
sequential_press |
bool |
(optional; default: |
strict_sequential_press |
bool |
(optional; default: |
board |
str |
(optional; default: |
device_filter |
int, str, None |
(optional; default: |
key_order |
list |
(optional; default: |
fn_keycodes |
list, None |
(optional; default: |
last_fn_keycode |
int |
(optional; default: |
replacement_keymap |
dict |
(optional; default: |
has_power_key |
bool |
(optional; default: |
skip_keycodes |
list |
(optional; default: |
skip_power_key |
bool |
(optional; default: |
detect_long_press |
bool |
(optional; default: |
repeat_times |
dict |
(optional; default: |
has_numpad |
bool |
(optional; default: |
vivaldi_keyboard |
bool |
(optional; default: |
key_combinations |
list |
(optional; default: |