diff options
author | Florian Bruhin <me@the-compiler.org> | 2023-03-23 18:06:52 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2023-03-23 18:10:22 +0100 |
commit | fe6687f2ea6504a24be630ba00a765b526f12dbf (patch) | |
tree | 7b737a06fa54753e97b21f84419de2cc3200943f | |
parent | 7c222c5b196e492ca7b30e753d775d6677461d6c (diff) | |
download | qutebrowser-fe6687f2ea6504a24be630ba00a765b526f12dbf.tar.gz qutebrowser-fe6687f2ea6504a24be630ba00a765b526f12dbf.zip |
tests: Stabilize "Hinting an input after undoing a tab close"
Without this wait, the test is flaky, because sometimes the keys are pressed
before qutebrowser has entered insert mode.
When running:
tox -e py311-pyqt64 -- tests/end2end/features/test_hints_bdd.py -k undoing --count 100
around 30% of the runs, we get:
============================== :click-element id qute-input-existing ==============================
[...]
----> Waiting for 'command called: *' in the log
[...]
17:56:54.042 DEBUG commands command:run:549 Calling qutebrowser.components.misccommands.click_element(<qutebrowser.browser.webengine.webenginetab.WebEngineTab tab_id=197 url='http://localhost:50977/data/hints/link_input.html'>, 'id', 'qute-input-existing', target=<ClickTarget.normal: 1>, force_event=False, select_first=False)
17:56:54.043 DEBUG ipc ipc:_get_socket:373 In _get_socket with None socket!
----> found it
============================== :fake-key -g something ==============================
[...]
----> Waiting for '[*] contents: existingsomething' in the log
17:56:54.062 DEBUG modes modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.111 DEBUG modes modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.112 DEBUG modes modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.113 DEBUG commands command:run:535 command called: quickmark-save
[...]
17:56:54.143 DEBUG webview webenginetab:_js_cb_single:766 Got element from JS: {'attributes': {'id': 'qute-input-existing', 'value': 'existing'}, 'caret_position': 0, 'class_name': '', 'id': 0, 'is_content_editable': False, 'outer_xml': '<input id="qute-input-existing" value="existing">', 'rects': [{'bottom': 143, 'height': 21, 'left': 8, 'right': 166, 'top': 122, 'width': 158}], 'tag_name': 'INPUT', 'text': '', 'value': 'existing'}
17:56:54.143 DEBUG webelem webelem:click:422 Clicking <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'> with click_target ClickTarget.normal, force_event False
17:56:54.143 DEBUG webelem webelem:is_editable:257 Checking if element is editable: <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'>
17:56:54.143 DEBUG webelem webelem:click:434 Clicking via JS focus()
17:56:54.144 DEBUG webelem webelem:is_editable:257 Checking if element is editable: <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'>
17:56:54.144 DEBUG modes modeman:enter:366 Entering mode KeyMode.insert (reason: clicking input)
With the change, the test passes 100/100 times.
-rw-r--r-- | tests/end2end/features/hints.feature | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index d6f48a87c..51ffb980a 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -628,5 +628,6 @@ Feature: Using hints And I run :undo And I wait until data/hints/link_input.html is loaded And I run :click-element id qute-input-existing + And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log And I run :fake-key -g something Then the javascript message "contents: existingsomething" should be logged |