[Pkg-mozext-commits] [requestpolicy] 76/257: [tst][imp] RedirectNotification: add `close()`
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:19:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit ce759a7e08dc2fdf4469f0763004cc1d5d911231
Author: Martin Kimmerle <dev at 256k.de>
Date: Wed Oct 14 01:19:48 2015 +0200
[tst][imp] RedirectNotification: add `close()`
---
.../tests/test_redirect_notification.py | 35 ++++++++++++++++++++++
.../rp_puppeteer/ui/redirect_notification.py | 15 ++++++++++
2 files changed, 50 insertions(+)
diff --git a/tests/marionette/rp_puppeteer/tests/test_redirect_notification.py b/tests/marionette/rp_puppeteer/tests/test_redirect_notification.py
new file mode 100644
index 0000000..7bd056c
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/tests/test_redirect_notification.py
@@ -0,0 +1,35 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from rp_ui_harness import RequestPolicyTestCase
+
+
+PRE_PATH = "http://www.maindomain.test/"
+PAGE_WITH_REDIRECT = PRE_PATH + "redirect-meta-tag-01-immediate.html"
+PREF_DEFAULT_ALLOW = "extensions.requestpolicy.defaultPolicy.allow"
+
+
+class TestRedirectNotification(RequestPolicyTestCase):
+
+ def setUp(self):
+ super(TestRedirectNotification, self).setUp()
+
+ self.marionette.set_pref(PREF_DEFAULT_ALLOW, False)
+
+ def tearDown(self):
+ try:
+ if self.redir.is_shown():
+ self.redir.close()
+ finally:
+ super(TestRedirectNotification, self).tearDown()
+
+ def test_close(self):
+ with self.marionette.using_context("content"):
+ self.marionette.navigate(PAGE_WITH_REDIRECT)
+
+ self.assertTrue(self.redir.panel_exists())
+ self.redir.close()
+ # The panel should be closed when `close()` has been called,
+ # that is, the close action should be synchronized.
+ self.assertFalse(self.redir.panel_exists())
diff --git a/tests/marionette/rp_puppeteer/ui/redirect_notification.py b/tests/marionette/rp_puppeteer/ui/redirect_notification.py
index 194a7a4..7110e8b 100644
--- a/tests/marionette/rp_puppeteer/ui/redirect_notification.py
+++ b/tests/marionette/rp_puppeteer/ui/redirect_notification.py
@@ -4,6 +4,7 @@
from firefox_puppeteer.base import BaseLib
from marionette_driver.errors import NoSuchElementException
+from marionette_driver.wait import Wait
class RedirectNotification(BaseLib):
@@ -22,6 +23,12 @@ class RedirectNotification(BaseLib):
except NoSuchElementException:
return False
+ def close(self):
+ """Close the notification bar."""
+
+ self._close_button.click()
+ Wait(self.marionette).until(lambda _: not self.is_shown())
+
##################################
# Private Properties and Methods #
##################################
@@ -36,3 +43,11 @@ class RedirectNotification(BaseLib):
.find_element("anon attribute",
{"value": "request-policy-meta-redirect"})
)
+
+ @property
+ def _close_button(self):
+ return (
+ self._panel
+ .find_element("anon attribute",
+ {"class": "messageCloseButton close-icon tabbable"})
+ )
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list