summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2024-03-27 13:03:39 +0100
committerFlorian Bruhin <me@the-compiler.org>2024-03-27 13:05:28 +0100
commit481542844db79ee58740e8324ecc1090e3738c35 (patch)
tree4fb92ad1d30b9acadb517faf30c90c39a8a7bd30
parent982b8bdcecfba6fc1687a6a4942b9e3ab3221eb7 (diff)
downloadqutebrowser-481542844db79ee58740e8324ecc1090e3738c35.tar.gz
qutebrowser-481542844db79ee58740e8324ecc1090e3738c35.zip
tests: Avoid using autofocus for click_element tests
Similarly to the last commit (982b8bdcecfba6fc1687a6a4942b9e3ab3221eb7), we run into a race between autofocus triggering and the test trying to click the focused element. This also affects the "when there is none" test, which loses the focus before it has been set, thus ending up with a focused element but expecting none. We fix both in one go by manually focusing things with a tab keypress instead of using autofocus. See #8145 and #5390.
-rw-r--r--tests/end2end/data/click_element.html2
-rw-r--r--tests/end2end/features/misc.feature5
2 files changed, 3 insertions, 4 deletions
diff --git a/tests/end2end/data/click_element.html b/tests/end2end/data/click_element.html
index b2a691e08..7fac2a381 100644
--- a/tests/end2end/data/click_element.html
+++ b/tests/end2end/data/click_element.html
@@ -7,7 +7,7 @@
<span onclick='console.log("click_element special chars")'>"Don't", he shouted</span>
<span>Duplicate</span>
<span class='clickable' onclick='console.log("click_element CSS selector")'>Duplicate</span>
- <form><input autofocus id='qute-input'></input></form>
+ <form><input id='qute-input' onfocus='console.log("qute-input focused")'></input></form>
<a href="/data/hello.txt" id='link'>link</a>
<span id='foo.bar' onclick='console.log("id with dot")'>ID with dot</span>
<span style='position: absolute; left: 20px;top: 42px; width:10px; height:10px;'
diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature
index 1872ca5a6..90ce5334a 100644
--- a/tests/end2end/features/misc.feature
+++ b/tests/end2end/features/misc.feature
@@ -502,14 +502,13 @@ Feature: Various utility commands.
Scenario: Clicking on focused element when there is none
When I open data/click_element.html
- # Need to loose focus on input element
- And I run :click-element position 20,42
- And I wait for the javascript message "click_element position"
And I run :click-element focused
Then the error "No element found with focus!" should be shown
Scenario: Clicking on focused element
When I open data/click_element.html
+ And I run :fake-key <Tab>
+ And I wait for the javascript message "qute-input focused"
And I run :click-element focused
Then "Entering mode KeyMode.insert (reason: clicking input)" should be logged