diff --git a/pytest.ini b/pytest.ini index 0b85cc499..d8ad70b53 100644 --- a/pytest.ini +++ b/pytest.ini @@ -12,6 +12,7 @@ markers = frozen: Tests which can only be run if sys.frozen is True. integration: Tests which test a bigger portion of code, run without coverage. skip: Always skipped test. + pyqt531_or_newer: Needs PyQt 5.3.1 or newer. flakes-ignore = UnusedImport UnusedVariable diff --git a/tests/conftest.py b/tests/conftest.py index 1311e3d01..c5e5ff2e1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,7 +39,7 @@ from helpers.messagemock import message_mock from qutebrowser.config import config from qutebrowser.utils import objreg -from PyQt5.QtCore import QEvent, QSize, Qt +from PyQt5.QtCore import QEvent, QSize, Qt, PYQT_VERSION from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout from PyQt5.QtNetwork import QNetworkCookieJar import xvfbwrapper @@ -66,6 +66,8 @@ def _apply_platform_markers(item): ('not_xvfb', item.config.xvfb_display is not None, "Can't be run with Xvfb."), ('skip', True, "Always skipped."), + ('pyqt531_or_newer', PYQT_VERSION < 0x050301, + "Needs PyQt 5.3.1 or newer"), ] for searched_marker, condition, default_reason in markers: diff --git a/tests/integration/features/prompts.feature b/tests/integration/features/prompts.feature index e946f0b4a..5b103667a 100644 --- a/tests/integration/features/prompts.feature +++ b/tests/integration/features/prompts.feature @@ -6,28 +6,6 @@ Feature: Prompts # Javascript - Scenario: Javascript prompt - When I open data/prompt/jsprompt.html - And I click the button - And I press the keys "prompt test" - And I run :prompt-accept - Then the javascript message "Prompt reply: prompt test" should be logged - - Scenario: Rejected javascript prompt - When I open data/prompt/jsprompt.html - And I click the button - And I press the keys "prompt test" - And I run :leave-mode - Then the javascript message "Prompt reply: null" should be logged - - Scenario: Using content -> ignore-javascript-prompt - When I set content -> ignore-javascript-prompt to true - And I open data/prompt/jsprompt.html - # Can't use "I click the button" as it waits for a key mode change - And I run :hint - And I run :follow-hint a - Then the javascript message "Prompt reply: null" should be logged - Scenario: Javascript alert When I open data/prompt/jsalert.html And I click the button @@ -59,3 +37,28 @@ Feature: Prompts And I click the button And I run :leave-mode Then the javascript message "confirm reply: false" should be logged + + @pyqt531_or_newer + Scenario: Javascript prompt + When I open data/prompt/jsprompt.html + And I click the button + And I press the keys "prompt test" + And I run :prompt-accept + Then the javascript message "Prompt reply: prompt test" should be logged + + @pyqt531_or_newer + Scenario: Rejected javascript prompt + When I open data/prompt/jsprompt.html + And I click the button + And I press the keys "prompt test" + And I run :leave-mode + Then the javascript message "Prompt reply: null" should be logged + + @pyqt531_or_newer + Scenario: Using content -> ignore-javascript-prompt + When I set content -> ignore-javascript-prompt to true + And I open data/prompt/jsprompt.html + # Can't use "I click the button" as it waits for a key mode change + And I run :hint + And I run :follow-hint a + Then the javascript message "Prompt reply: null" should be logged