diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-06-19 16:21:03 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-06-19 16:21:03 +0200 |
commit | a6817bd0865719bc1dc3a272fd8ab85c0d139937 (patch) | |
tree | 0f16e8526401b03ed29a818f43cda81354c763f8 | |
parent | 5929bf81ce3c4d963e13aa55b595315b2bb13812 (diff) | |
download | qutebrowser-a6817bd0865719bc1dc3a272fd8ab85c0d139937.tar.gz qutebrowser-a6817bd0865719bc1dc3a272fd8ab85c0d139937.zip |
tests: Fix JS header tests
This is a follow-up to f0eed465ab608061212366c6ebc26a0c47803060
See #4657
-rw-r--r-- | pytest.ini | 1 | ||||
-rw-r--r-- | tests/end2end/conftest.py | 8 | ||||
-rw-r--r-- | tests/end2end/features/misc.feature | 12 |
3 files changed, 18 insertions, 3 deletions
diff --git a/pytest.ini b/pytest.ini index e85f2b298..8c6b7853b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -30,6 +30,7 @@ markers = fake_os: Fake utils.is_* to a fake operating system unicode_locale: Tests which need an unicode locale to work qtwebkit6021_xfail: Tests which would fail on WebKit version 602.1 + js_headers: Sets JS headers dynamically on QtWebEngine (unsupported on some versions) qt_log_level_fail = WARNING qt_log_ignore = ^SpellCheck: .* diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index 273d8170c..f87b84a56 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -137,6 +137,11 @@ if not getattr(sys, 'frozen', False): def pytest_collection_modifyitems(config, items): """Apply @qtwebengine_* markers; skip unittests with QUTE_BDD_WEBENGINE.""" + # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-75884 + # (note this isn't actually fixed properly before Qt 5.15) + header_bug_fixed = (not qtutils.version_check('5.12', compiled=False) or + qtutils.version_check('5.15', compiled=False)) + markers = [ ('qtwebengine_todo', 'QtWebEngine TODO', pytest.mark.xfail, config.webengine), @@ -152,6 +157,9 @@ def pytest_collection_modifyitems(config, items): config.webengine), ('qtwebengine_mac_xfail', 'Fails on macOS with QtWebEngine', pytest.mark.xfail, config.webengine and utils.is_mac), + ('js_headers', 'Sets headers dynamically via JS', + pytest.mark.skipif, + config.webengine and not header_bug_fixed), ] for item in items: diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 7a26c9dda..cba16bb38 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -349,18 +349,24 @@ Feature: Various utility commands. # This still doesn't set window.navigator.language # See https://bugreports.qt.io/browse/QTBUG-61949 - @qtwebkit_skip + @qtwebkit_skip @js_headers Scenario: Accept-Language header (JS) When I set content.headers.accept_language to it,fr And I run :jseval console.log(window.navigator.languages) Then the javascript message "it,fr" should be logged - Scenario: Setting a custom user-agent header + Scenario: User-agent header When I set content.headers.user_agent to toaster And I open headers And I run :jseval console.log(window.navigator.userAgent) Then the header User-Agent should be set to toaster - And the javascript message "toaster" should be logged + + @js_headers + Scenario: User-agent header (JS) + When I set content.headers.user_agent to toaster + And I open about:blank + And I run :jseval console.log(window.navigator.userAgent) + Then the javascript message "toaster" should be logged ## https://github.com/qutebrowser/qutebrowser/issues/1523 |