emulate key presses for system tests using NVDA directly#11581
Merged
Conversation
…ork, so that key press strings confirm to NVDA, and we block on key presses until the actual is actually executed.
This comment has been minimized.
This comment has been minimized.
feerrenrut
suggested changes
Sep 9, 2020
Co-authored-by: Reef Turner <feerrenrut@users.noreply.github.com>
feerrenrut
previously approved these changes
Sep 10, 2020
feerrenrut
left a comment
Contributor
There was a problem hiding this comment.
Looks good @michaelDCurran
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
None
Summary of the issue:
Currently, system tests use pyautogui to send key presses to NvDA and the OS. However, a limitation of pyautogui is that it cannot send extended keys. For example, it is impossible to send a downArrow key press for the extended arrows (upside down t). It supports "down" but that is on the numberpad.
Also, the strings it uses for keys vary quite a bit from NvDA's identifiers.
There are system tests that require sending extended keys. The first being in pr #11569
Description of how this pull request fixes the issue:
Rather than sending keys with pyautogui, instead send them via NVDA's own input gesture framework.
Specifically:
Also, this new method by default blocks until the action has definitely been executed. It does this by first inserting a function into NVDA's event queue after emulating the gesture, and then waiting on that function to be executed. Finally, it then waits on NVDA's core to fall asleep (meaning that no more events or speech is being processed). This makes the tests much more robust as in some cases if a key press resulted in two or more speak calls to the synth, only the first would be waited for. Again, this is necessary for pr Announce entering a listItem when moving by character or word in contentEditables and browse mode #11569
Testing performed:
All the system tests pass.
Known issues with pull request:
None.
Change log entry:
Changes for developers:
System tests can send keys using spy.emulateKeyPress, which takes a key identifier that conforms to NvDA's own key names.