From b9f8fdb759fd63855b2c4c8e92f808f4424174fc Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 15 Aug 2023 14:28:36 +0200 Subject: Add a test for keyboard focus after cross-origin navigation Fails without the fix on main on QtWebEngine 6.4 (works on 6.2). Works fine after the fix. See #7820 --- tests/end2end/data/insert_mode_settings/html/autofocus.html | 3 +++ tests/end2end/features/misc.feature | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/tests/end2end/data/insert_mode_settings/html/autofocus.html b/tests/end2end/data/insert_mode_settings/html/autofocus.html index 366f436f6..6ce8c6e6f 100644 --- a/tests/end2end/data/insert_mode_settings/html/autofocus.html +++ b/tests/end2end/data/insert_mode_settings/html/autofocus.html @@ -7,6 +7,9 @@ function setup_event_listener() { var elem = document.getElementById('qute-input-autofocus'); console.log(elem); + elem.addEventListener('focus', function() { + console.log("focused"); + }); elem.addEventListener('input', function() { console.log("contents: " + elem.value); }); diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 3940d0243..60ff3748c 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -622,3 +622,11 @@ Feature: Various utility commands. When I open data/invalid_resource.html in a new tab Then "Ignoring invalid * URL: Invalid hostname (contains invalid characters); *" should be logged And no crash should happen + + Scenario: Keyboard focus after cross-origin navigation + When I open qute://gpl + And I open data/insert_mode_settings/html/autofocus.html + And I run :mode-enter insert + And I wait for the javascript message "focused" + And I run :fake-key -g "testing" + Then the javascript message "contents: testing" should be logged -- cgit v1.2.3-54-g00ecf