summaryrefslogtreecommitdiff
path: root/tests/end2end
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-03-25 15:20:40 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-03-25 15:41:56 +0100
commit384928c378cdec025ea5cf137363945b52c7064a (patch)
treef03b16c8565f26f31c24d80a71a5f990fd4c6c94 /tests/end2end
parenta21adf8bd35fb84fbcb6cd04fef7edf0cc0da93b (diff)
downloadqutebrowser-384928c378cdec025ea5cf137363945b52c7064a.tar.gz
qutebrowser-384928c378cdec025ea5cf137363945b52c7064a.zip
notifications: Fix handling of custom actions on foreign notifications
Diffstat (limited to 'tests/end2end')
-rw-r--r--tests/end2end/features/notifications.feature7
-rw-r--r--tests/end2end/features/test_notifications_bdd.py6
-rw-r--r--tests/end2end/fixtures/notificationserver.py8
3 files changed, 19 insertions, 2 deletions
diff --git a/tests/end2end/features/notifications.feature b/tests/end2end/features/notifications.feature
index 8afdd1d0a..e84bb00be 100644
--- a/tests/end2end/features/notifications.feature
+++ b/tests/end2end/features/notifications.feature
@@ -105,3 +105,10 @@ Feature: Notifications
And I wait for the javascript message "notification shown"
And I click the notification with id 1234
Then the javascript message "notification clicked" should not be logged
+
+ @qtwebengine_notifications @pyqtwebengine>=5.15.0
+ Scenario: Unknown action with some other application's notification
+ When I run :click-element id show-button
+ And I wait for the javascript message "notification shown"
+ And I trigger a custom action on the notification with id 1234
+ Then no crash should happen
diff --git a/tests/end2end/features/test_notifications_bdd.py b/tests/end2end/features/test_notifications_bdd.py
index cd5ba8cc9..5c846b08d 100644
--- a/tests/end2end/features/test_notifications_bdd.py
+++ b/tests/end2end/features/test_notifications_bdd.py
@@ -77,3 +77,9 @@ def close_notification(notification_server, id_):
@bdd.when(bdd.parsers.cfparse('I click the notification with id {id_:d}'))
def click_notification(notification_server, id_):
notification_server.click(id_)
+
+
+@bdd.when(bdd.parsers.cfparse(
+ 'I trigger a {name} action on the notification with id {id_:d}'))
+def custom_notification_action(notification_server, id_, name):
+ notification_server.action(id_, name)
diff --git a/tests/end2end/fixtures/notificationserver.py b/tests/end2end/fixtures/notificationserver.py
index b078093b5..fc67f3e9a 100644
--- a/tests/end2end/fixtures/notificationserver.py
+++ b/tests/end2end/fixtures/notificationserver.py
@@ -121,14 +121,18 @@ class TestNotificationServer(QObject):
def click(self, notification_id: int) -> None:
"""Sends a click (default action) notification for the given ID."""
+ self.action(notification_id, "default")
+
+ def action(self, notification_id: int, name: str) -> None:
+ """Sends an action notification for the given ID."""
message = QDBusMessage.createSignal(
notification.DBusNotificationPresenter.PATH,
notification.DBusNotificationPresenter.INTERFACE,
"ActionInvoked")
- message.setArguments([_as_uint32(notification_id), "default"])
+ message.setArguments([_as_uint32(notification_id), name])
if not self._bus.send(message):
- raise OSError("Could not send click notification")
+ raise OSError("Could not send action notification")
# Everything below is exposed via DBus
# pylint: disable=invalid-name