[Pkg-mozext-commits] [requestpolicy] 75/257: [tst][ref] RedirectNotification.is_shown()
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:19:58 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 599300d474d4fd113edc0acbb902d2d88b15dfe7
Author: Martin Kimmerle <dev at 256k.de>
Date: Wed Oct 14 01:15:01 2015 +0200
[tst][ref] RedirectNotification.is_shown()
* Rename `panel_exists()` to `is_shown()`.
* Make `get_panel()` a private property `_panel`.
---
.../rp_puppeteer/ui/redirect_notification.py | 40 ++++++++++++----------
.../links/html_anchor_element/test_link_click.py | 2 +-
.../html_anchor_element/test_open_in_new_tab.py | 4 +--
.../html_anchor_element/test_open_in_new_window.py | 4 +--
.../text_selection/test_open_in_current_tab.py | 2 +-
.../links/text_selection/test_open_in_new_tab.py | 4 +--
.../text_selection/test_open_in_new_window.py | 4 +--
7 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/tests/marionette/rp_puppeteer/ui/redirect_notification.py b/tests/marionette/rp_puppeteer/ui/redirect_notification.py
index 4759e2d..194a7a4 100644
--- a/tests/marionette/rp_puppeteer/ui/redirect_notification.py
+++ b/tests/marionette/rp_puppeteer/ui/redirect_notification.py
@@ -6,29 +6,33 @@ from firefox_puppeteer.base import BaseLib
from marionette_driver.errors import NoSuchElementException
-REDIRECT_NOTIFICATION_VALUE = "request-policy-meta-redirect"
-
-
class RedirectNotification(BaseLib):
- def get_panel(self):
- """Find the redirection notification bar in the tab currently focused.
-
- Raises:
- NoSuchElementException
- """
+ # TODO: use notification bar class when bug 1139544 lands
- with self.marionette.using_context("chrome"):
- # TODO: use notification bar class when bug 1139544 lands
- return (self.marionette.find_element("id", "content")
- .find_element("anon attribute",
- {"value": REDIRECT_NOTIFICATION_VALUE}))
+ #################################
+ # Public Properties and Methods #
+ #################################
- def panel_exists(self):
- """Check if the redirection notification bar is present.
- """
+ def is_shown(self):
+ """Check if the redirection notification bar is present."""
try:
- self.get_panel()
+ self._panel
return True
except NoSuchElementException:
return False
+
+ ##################################
+ # Private Properties and Methods #
+ ##################################
+
+ @property
+ def _panel(self):
+ """The redirection notification bar in the tab currently focused."""
+
+ return (
+ self.marionette
+ .find_element("id", "content")
+ .find_element("anon attribute",
+ {"value": "request-policy-meta-redirect"})
+ )
diff --git a/tests/marionette/tests/links/html_anchor_element/test_link_click.py b/tests/marionette/tests/links/html_anchor_element/test_link_click.py
index 759a6b3..be3688c 100644
--- a/tests/marionette/tests/links/html_anchor_element/test_link_click.py
+++ b/tests/marionette/tests/links/html_anchor_element/test_link_click.py
@@ -24,7 +24,7 @@ class TestLinkClick(RequestPolicyTestCase):
link_url = link.get_attribute("href")
link.click()
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
"Following the link didn't cause a redirect.")
self.assertEqual(self.browser.tabbar.selected_tab.location,
link_url, "The location is correct.")
diff --git a/tests/marionette/tests/links/html_anchor_element/test_open_in_new_tab.py b/tests/marionette/tests/links/html_anchor_element/test_open_in_new_tab.py
index b34f8c1..8a6ee0e 100644
--- a/tests/marionette/tests/links/html_anchor_element/test_open_in_new_tab.py
+++ b/tests/marionette/tests/links/html_anchor_element/test_open_in_new_tab.py
@@ -36,7 +36,7 @@ class TestOpenInNewTab(RequestPolicyTestCase):
# checks in the origin's tab
origin_tab.switch_to()
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the origin tab."))
@@ -44,7 +44,7 @@ class TestOpenInNewTab(RequestPolicyTestCase):
dest_tab.switch_to()
self.assertEqual(dest_tab.location, link_url,
"The location in the new tab is correct.")
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the destination tab."))
diff --git a/tests/marionette/tests/links/html_anchor_element/test_open_in_new_window.py b/tests/marionette/tests/links/html_anchor_element/test_open_in_new_window.py
index 9f14bbb..82523f0 100644
--- a/tests/marionette/tests/links/html_anchor_element/test_open_in_new_window.py
+++ b/tests/marionette/tests/links/html_anchor_element/test_open_in_new_window.py
@@ -52,7 +52,7 @@ class TestOpenInNewWindow(RequestPolicyTestCase):
self.tabs.wait_until_loaded(tab)
self.assertEqual(tab.location, link_url,
"The location in the new window is correct.")
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the destination window."))
@@ -62,7 +62,7 @@ class TestOpenInNewWindow(RequestPolicyTestCase):
self.main_window.switch_to()
# checks in the origin's window
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the origin tab."))
diff --git a/tests/marionette/tests/links/text_selection/test_open_in_current_tab.py b/tests/marionette/tests/links/text_selection/test_open_in_current_tab.py
index fa57417..29a4802 100644
--- a/tests/marionette/tests/links/text_selection/test_open_in_current_tab.py
+++ b/tests/marionette/tests/links/text_selection/test_open_in_current_tab.py
@@ -35,7 +35,7 @@ class TestOpenInCurrentTab(RequestPolicyTestCase):
tab = self.browser.tabbar.selected_tab
self.tabs.wait_until_loaded(tab)
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
"Following the URL didn't cause a redirect.")
self.assertEqual(tab.location, url,
"The location is correct.")
diff --git a/tests/marionette/tests/links/text_selection/test_open_in_new_tab.py b/tests/marionette/tests/links/text_selection/test_open_in_new_tab.py
index 2bca14b..3fd7b9e 100644
--- a/tests/marionette/tests/links/text_selection/test_open_in_new_tab.py
+++ b/tests/marionette/tests/links/text_selection/test_open_in_new_tab.py
@@ -40,7 +40,7 @@ class TestOpenInNewTab(RequestPolicyTestCase):
# checks in the origin's tab
origin_tab.switch_to()
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the origin tab."))
@@ -48,7 +48,7 @@ class TestOpenInNewTab(RequestPolicyTestCase):
dest_tab.switch_to()
self.assertEqual(dest_tab.location, url,
"The location in the new tab is correct.")
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the destination tab."))
diff --git a/tests/marionette/tests/links/text_selection/test_open_in_new_window.py b/tests/marionette/tests/links/text_selection/test_open_in_new_window.py
index 0abe687..de859aa 100644
--- a/tests/marionette/tests/links/text_selection/test_open_in_new_window.py
+++ b/tests/marionette/tests/links/text_selection/test_open_in_new_window.py
@@ -53,7 +53,7 @@ class TestOpenInNewWindow(RequestPolicyTestCase):
dest_window.switch_to()
self.assertEqual(dest_tab.location, url,
"The location in the new window is correct.")
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the destination window."))
@@ -62,7 +62,7 @@ class TestOpenInNewWindow(RequestPolicyTestCase):
# Do checks in the origin's window.
self.origin_window.switch_to()
- self.assertFalse(self.redir.panel_exists(),
+ self.assertFalse(self.redir.is_shown(),
("Following the link didn't cause a "
"redirect in the origin window."))
--
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