summaryrefslogtreecommitdiff
path: root/tests/end2end
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-03-25 13:13:30 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-03-25 15:41:56 +0100
commit844435f821de4c17e778a9bb9fde7dcd7c8c66ac (patch)
treefb2513d1c2115416700793cd39bbbb4e2e2643c5 /tests/end2end
parent54a0dc1e386e1507bdf9af88beab7fcf033d1f88 (diff)
downloadqutebrowser-844435f821de4c17e778a9bb9fde7dcd7c8c66ac.tar.gz
qutebrowser-844435f821de4c17e778a9bb9fde7dcd7c8c66ac.zip
notifications: Fix and test support for PyQtWebEngine 5.14
Diffstat (limited to 'tests/end2end')
-rw-r--r--tests/end2end/features/notifications.feature54
-rw-r--r--tests/end2end/features/test_notifications_bdd.py5
2 files changed, 48 insertions, 11 deletions
diff --git a/tests/end2end/features/notifications.feature b/tests/end2end/features/notifications.feature
index dd3335350..40e965441 100644
--- a/tests/end2end/features/notifications.feature
+++ b/tests/end2end/features/notifications.feature
@@ -15,15 +15,6 @@ Feature: Notifications
And a notification with id 1 is presented
@qtwebengine_notifications
- Scenario: Replacing existing notifications
- When I run :click-element id show-multiple-button
- Then the javascript message "i=1 notification shown" should be logged
- Then the javascript message "i=2 notification shown" should be logged
- Then the javascript message "i=3 notification shown" should be logged
- And 1 notification is presented
- And notification 1 has title "i=3"
-
- @qtwebengine_notifications
Scenario: Notification containing escaped characters
Given the notification server supports body markup
When I run :click-element id show-symbols-button
@@ -39,12 +30,35 @@ Feature: Notifications
And notification 1 has body "<< && >>"
And notification 1 has title "<< && >>"
+ # As a WORKAROUND for https://www.riverbankcomputing.com/pipermail/pyqt/2020-May/042918.html
+ # and other issues, those can only run with PyQtWebEngine >= 5.15.0
+ #
# For these tests, we need to wait for the notification to be shown before
# we try to close it, otherwise we wind up in race-condition-ish
# situations.
- # As a WORKAROUND for https://www.riverbankcomputing.com/pipermail/pyqt/2020-May/042918.html
- # and other issues, those can only run with PyQtWebEngine >= 5.15.0
+ @qtwebengine_notifications @pyqtwebengine>=5.15.0
+ Scenario: Replacing existing notifications
+ When I run :click-element id show-multiple-button
+ Then the javascript message "i=1 notification shown" should be logged
+ Then the javascript message "i=2 notification shown" should be logged
+ Then the javascript message "i=3 notification shown" should be logged
+ And 1 notification is presented
+ And notification 1 has title "i=3"
+
+ @qtwebengine_notifications @pyqtwebengine<5.15.0
+ Scenario: Replacing existing notifications (old Qt)
+ When I run :click-element id show-multiple-button
+ Then the javascript message "i=1 notification shown" should be logged
+ And "Ignoring notification tag 'counter' due to PyQt bug" should be logged
+ And the javascript message "i=2 notification shown" should be logged
+ And "Ignoring notification tag 'counter' due to PyQt bug" should be logged
+ And the javascript message "i=3 notification shown" should be logged
+ And "Ignoring notification tag 'counter' due to PyQt bug" should be logged
+ And 3 notifications are presented
+ And notification 1 has title "i=1"
+ And notification 2 has title "i=2"
+ And notification 3 has title "i=3"
@qtwebengine_notifications @pyqtwebengine>=5.15.0
Scenario: User closes presented notification
@@ -53,6 +67,15 @@ Feature: Notifications
And I close the notification with id 1
Then the javascript message "notification closed" should be logged
+ @qtwebengine_notifications @pyqtwebengine<5.15.0
+ Scenario: User closes presented notification (old Qt)
+ When I run :click-element id show-button
+ And I wait for the javascript message "notification shown"
+ And I close the notification with id 1
+ Then "Ignoring close request for notification 1 due to PyQt bug" should be logged
+ And the javascript message "notification closed" should not be logged
+ And no crash should happen
+
@qtwebengine_notifications @pyqtwebengine>=5.15.0
Scenario: User closes some other application's notification
When I run :click-element id show-button
@@ -67,6 +90,15 @@ Feature: Notifications
And I click the notification with id 1
Then the javascript message "notification clicked" should be logged
+ @qtwebengine_notifications @pyqtwebengine<5.15.0
+ Scenario: User clicks presented notification (old Qt)
+ When I run :click-element id show-button
+ And I wait for the javascript message "notification shown"
+ And I click the notification with id 1
+ Then "Ignoring click request for notification 1 due to PyQt bug" should be logged
+ Then the javascript message "notification clicked" should not be logged
+ And no crash should happen
+
@qtwebengine_notifications @pyqtwebengine>=5.15.0
Scenario: User clicks some other application's notification
When I run :click-element id show-button
diff --git a/tests/end2end/features/test_notifications_bdd.py b/tests/end2end/features/test_notifications_bdd.py
index 9f7950471..cf08da94b 100644
--- a/tests/end2end/features/test_notifications_bdd.py
+++ b/tests/end2end/features/test_notifications_bdd.py
@@ -54,6 +54,11 @@ def notification_presented_single(notification_server):
assert len(notification_server.messages) == 1
+@bdd.then(bdd.parsers.cfparse('{count:d} notifications are presented'))
+def notification_presented_count(notification_server, count):
+ assert len(notification_server.messages) == count
+
+
@bdd.then(bdd.parsers.cfparse('notification {id_:d} has body "{body}"'))
def notification_body(notification_server, id_, body):
assert notification_server.messages[id_].body == body