Make tests work with QtWebKit-NG

Fixes #1571
This commit is contained in:
Florian Bruhin 2017-02-05 20:32:29 +01:00
parent f0f97a5213
commit 91bdc00410
6 changed files with 24 additions and 5 deletions

View File

@ -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

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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