-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard: Add Movable interface to be implemented by page objects #695
base: main
Are you sure you want to change the base?
Conversation
By taking a snapshot of the DUT state in the constructor. This is analogous to calling `get_frame()`.
This can be useful for transparent backgrounds, or to implement other means of interaction. I've not made it public for now, so we have more freedom to play, but we can make it more public later if it turns out to be useful, even without a new stb-tester release. I've used a base class here rather than duck typing to make the behaviour more explicitly opt-in.
6f6c7f1
to
d2d8e74
Compare
stbt.press_and_wait("KEY_OK", mask=self.mask, stable_secs=0.5, # pylint:disable=stbt-unused-return-value | ||
timeout_secs=1) | ||
page = page.refresh() | ||
page = self._move_one(page, "KEY_OK") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change in behaviour: We are now asserting the press_and_wait
result, and we increased timeout_secs
to 10.
If you have specified a mask that excludes the text box where the typed-text goes —a common thing to exclude, because it usually has a blinking cursor that breaks press_and_wait
when used for navigation— then this will fail.
It seems that move_one
isn't the right abstraction for this operation, which isn't about moving (maybe it "moves" —i.e. changes to a different key— if you're in shift mode or if you're pressing OK on a mode-change key, but most of the time it doesn't). Because of the short timeout and lack of assert
, this use of press_and_wait
should be OK even for UIs with transparency or some other reason why press_and_wait
won't work for navigation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This used to be a plain stbt.press("KEY_OK")
(sometimes with interpress_delay_secs=1
) before I added support for shift modes (see commit 07555d0). I wonder if it would make sense to check whether the node we're on has an outgoing edge labelled with key="KEY_OK"
and use that information to choose press
vs. press_and_wait
. It would make enter_text
a tiny bit faster, by not having to call page.refresh()
.
So that callers can override it if they need to provide a custom implementation (for example to handle live video behind a translucent background). I won't document this for now, but it gives us some flexibility without having to make a new Stb-tester release. This is an interim measure until we iron out the "Movable" API in <#695>.
So that callers can override it if they need to provide a custom implementation (for example to handle live video behind a translucent background). I won't document this for now, but it gives us some flexibility without having to make a new Stb-tester release. This is an interim measure until we iron out the "Movable" API in <#695>.
This allows page objects to override the mechanism for doing
press
es.Builds on top of #685.