From 91bdc00410ae91e0d7e5dc395dd3c72ed5bdb9e1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 5 Feb 2017 20:32:29 +0100 Subject: [PATCH] Make tests work with QtWebKit-NG Fixes #1571 --- pytest.ini | 2 ++ tests/end2end/conftest.py | 18 +++++++++++++++++- tests/end2end/features/downloads.feature | 2 +- tests/end2end/features/history.feature | 2 +- tests/end2end/features/javascript.feature | 1 + tests/end2end/features/misc.feature | 4 ++-- 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pytest.ini b/pytest.ini index 2285053a9..8975d6b84 100644 --- a/pytest.ini +++ b/pytest.ini @@ -17,6 +17,8 @@ markers = qtwebengine_todo: Features still missing with QtWebEngine qtwebengine_skip: Tests not applicable with QtWebEngine qtwebkit_skip: Tests not applicable with QtWebKit + qtwebkit_ng_xfail: Tests failing with QtWebKit-NG + qtwebkit_ng_skip: Tests skipped with QtWebKit-NG qtwebengine_flaky: Tests which are flaky (and currently skipped) with QtWebEngine qtwebengine_osx_xfail: Tests which fail on OS X with QtWebEngine js_prompt: Tests needing to display a javascript prompt diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index d2512457e..2219f2720 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -106,7 +106,9 @@ def _get_backend_tag(tag): pytest_marks = { 'qtwebengine_todo': pytest.mark.qtwebengine_todo, 'qtwebengine_skip': pytest.mark.qtwebengine_skip, - 'qtwebkit_skip': pytest.mark.qtwebkit_skip + 'qtwebkit_skip': pytest.mark.qtwebkit_skip, + 'qtwebkit_ng_xfail': pytest.mark.qtwebkit_ng_xfail, + 'qtwebkit_ng_skip': pytest.mark.qtwebkit_ng_skip, } if not any(tag.startswith(t + ':') for t in pytest_marks): return None @@ -132,6 +134,16 @@ if not getattr(sys, 'frozen', False): def pytest_collection_modifyitems(config, items): """Apply @qtwebengine_* markers; skip unittests with QUTE_BDD_WEBENGINE.""" + if config.webengine: + qtwebkit_ng_used = False + else: + try: + from PyQt5.QtWebKit import qWebKitVersion + except ImportError: + qtwebkit_ng_used = False + else: + qtwebkit_ng_used = qtutils.is_qtwebkit_ng(qWebKitVersion()) + markers = [ ('qtwebengine_todo', 'QtWebEngine TODO', pytest.mark.xfail, config.webengine), @@ -139,6 +151,10 @@ def pytest_collection_modifyitems(config, items): config.webengine), ('qtwebkit_skip', 'Skipped with QtWebKit', pytest.mark.skipif, not config.webengine), + ('qtwebkit_ng_xfail', 'Failing with QtWebKit-NG', pytest.mark.xfail, + qtwebkit_ng_used), + ('qtwebkit_ng_skip', 'Skipped with QtWebKit-NG', pytest.mark.skipif, + qtwebkit_ng_used), ('qtwebengine_flaky', 'Flaky with QtWebEngine', pytest.mark.skipif, config.webengine), ('qtwebengine_osx_xfail', 'Fails on OS X with QtWebEngine', diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index 3ee531f42..7bfb66921 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -560,7 +560,7 @@ Feature: Downloading things from a website. And I run :download foo! Then the error "Invalid URL" should be shown - @qtwebengine_todo: pdfjs is not implemented yet + @qtwebengine_todo: pdfjs is not implemented yet @qtwebkit_ng_xfail: https://github.com/annulen/webkit/issues/428 Scenario: Downloading via pdfjs Given pdfjs is available When I set storage -> prompt-download-directory to false diff --git a/tests/end2end/features/history.feature b/tests/end2end/features/history.feature index 7e9c55c99..3c35ad03f 100644 --- a/tests/end2end/features/history.feature +++ b/tests/end2end/features/history.feature @@ -69,7 +69,7 @@ Feature: Page history ## Bugs - @qtwebengine_skip + @qtwebengine_skip @qtwebkit_ng_skip Scenario: Opening a valid URL which turns out invalid When I set general -> auto-search to true And I run :open http://foo%40bar@baz diff --git a/tests/end2end/features/javascript.feature b/tests/end2end/features/javascript.feature index 19e103476..13ab0d96a 100644 --- a/tests/end2end/features/javascript.feature +++ b/tests/end2end/features/javascript.feature @@ -16,6 +16,7 @@ Feature: Javascript stuff And I run :click-element id close-normal Then "Focus object changed: *" should be logged + @qtwebkit_ng_skip Scenario: Opening/closing a modal window via JS When I open data/javascript/window_open.html And I run :tab-only diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 168ea98ca..7fbc77c89 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -318,7 +318,7 @@ Feature: Various utility commands. And I open data/misc/test.pdf Then "Download test.pdf finished" should be logged - @qtwebengine_skip: pdfjs is not implemented yet + @qtwebengine_skip: pdfjs is not implemented yet @qtwebkit_ng_xfail: https://github.com/annulen/webkit/issues/428 Scenario: Downloading a pdf via pdf.js button (issue 1214) Given pdfjs is available # WORKAROUND to prevent the "Painter ended with 2 saved states" warning @@ -523,7 +523,7 @@ Feature: Various utility commands. ## https://github.com/qutebrowser/qutebrowser/issues/1742 - @qtwebengine_todo: private browsing is not implemented yet + @qtwebengine_todo: private browsing is not implemented yet @qtwebkit_ng_xfail: private browsing is not implemented yet Scenario: Private browsing is activated in QtWebKit without restart When I set general -> private-browsing to true And I open data/javascript/localstorage.html