New option: autoFocusDocumentBeforeTyping
to reduce real browser testing flakiness
#1092
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.
What:
Adding a new optional option,
autoFocusDocumentBeforeTyping
, to fix tests running against a real browser (e.g: jasmine-browser-runner) that may be interfered with a real user interacting with their system.Why:
My company's front-end integration tests can be run against a headless or a real browser context.
We noticed that during a real browser test, users can interfere negatively with the test result, simply by focusing the Chrome dev tools or on another software while and before the test is running. When the
.keyboard
interaction is being called, the element won't receive the key events.How:
Send an event to refocus the currently active element or
config.document
before sendingkeyboard
events.Checklist:
** Additional comments **
A similar issue was experienced by #553, but I couldn't replicate locally the issue against
.focus()
Example
The test is using
.type
against an input.