From 40c5c75a6c4665c07f49e5f556e0c8d33c3e45dd Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 10 Nov 2016 22:37:53 +0100 Subject: [PATCH] tests: Add a js_prompt marker --- pytest.ini | 1 + tests/conftest.py | 9 +++++++++ tests/end2end/features/misc.feature | 2 +- tests/end2end/features/prompts.feature | 14 +++++++------- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pytest.ini b/pytest.ini index 0c2d00f21..3ab397c10 100644 --- a/pytest.ini +++ b/pytest.ini @@ -21,6 +21,7 @@ markers = qtwebengine_createWindow: Tests using createWindow with QtWebEngine (QTBUG-54419) 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 this: Used to mark tests during development qt_log_level_fail = WARNING qt_log_ignore = diff --git a/tests/conftest.py b/tests/conftest.py index 907656b80..3b3fc3248 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,6 +27,7 @@ import warnings import pytest import hypothesis +from PyQt5.QtCore import PYQT_VERSION pytest.register_assert_rewrite('helpers') @@ -122,6 +123,14 @@ def pytest_collection_modifyitems(config, items): item.add_marker(pytest.mark.xfail(run=False)) if item.get_marker('flaky_once'): item.add_marker(pytest.mark.flaky()) + if item.get_marker('js_prompt'): + if config.webengine: + js_prompt_pyqt_version = 0x050700 + else: + js_prompt_pyqt_version = 0x050300 + item.add_marker(pytest.mark.skipif( + PYQT_VERSION <= js_prompt_pyqt_version, + reason='JS prompts are not supported with this PyQt version')) if deselected: deselected_items.append(item) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 46e4dc287..40f17d1a0 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -382,7 +382,7 @@ Feature: Various utility commands. And I press the key "" Then no crash should happen - @pyqt>=5.3.1 @qtwebengine_skip: JS prompt is not implemented yet + @js_prompt Scenario: Focusing download widget via Tab (original issue) When I open data/prompt/jsprompt.html And I run :click-element id button diff --git a/tests/end2end/features/prompts.feature b/tests/end2end/features/prompts.feature index 3146c2d5b..978e79406 100644 --- a/tests/end2end/features/prompts.feature +++ b/tests/end2end/features/prompts.feature @@ -40,7 +40,7 @@ Feature: Prompts And I run :leave-mode Then the javascript message "confirm reply: false" should be logged - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Javascript prompt When I open data/prompt/jsprompt.html And I run :click-element id button @@ -49,7 +49,7 @@ Feature: Prompts And I run :prompt-accept Then the javascript message "Prompt reply: prompt test" should be logged - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Javascript prompt with default When I open data/prompt/jsprompt.html And I run :click-element id button-default @@ -57,7 +57,7 @@ Feature: Prompts And I run :prompt-accept Then the javascript message "Prompt reply: default" should be logged - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Rejected javascript prompt When I open data/prompt/jsprompt.html And I run :click-element id button @@ -135,7 +135,7 @@ Feature: Prompts # Shift-Insert with prompt (issue 1299) - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Pasting via shift-insert in prompt mode When selection is supported And I put "insert test" into the primary selection @@ -146,7 +146,7 @@ Feature: Prompts And I run :prompt-accept Then the javascript message "Prompt reply: insert test" should be logged - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Pasting via shift-insert without it being supported When selection is not supported And I put "insert test" into the primary selection @@ -157,7 +157,7 @@ Feature: Prompts And I run :prompt-accept Then the javascript message "Prompt reply: " should be logged - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Using content -> ignore-javascript-prompt When I set content -> ignore-javascript-prompt to true And I open data/prompt/jsprompt.html @@ -357,7 +357,7 @@ Feature: Prompts Then the javascript message "Alert done" should be logged And the error "No value is permitted with alert prompts!" should be shown - @pyqt>=5.3.1 @qtwebengine_skip + @js_prompt Scenario: Javascript prompt with value When I set content -> ignore-javascript-prompt to false And I open data/prompt/jsprompt.html