[Pkg-mozext-commits] [requestpolicy] 56/257: [tst][ref] Marionette "open <a> in new tab":

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:19:56 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 5eeb9ac63d7144c0db73afc9430f545f63c5ca2b
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Sep 10 12:40:08 2015 +0200

    [tst][ref] Marionette "open <a> in new tab":
    
    * Wait for the destination tab to be loaded.
    * Use `self.tabs` and `self.ctx_menu`.
---
 .../html_anchor_element/test_open_in_new_tab.py    | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

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 f51f09d..46d2134 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
@@ -6,6 +6,7 @@ from rp_ui_harness import RequestPolicyTestCase
 from marionette_driver.marionette import Actions
 from rp_puppeteer.ui.redirect_notification import RedirectNotification
 from rp_puppeteer.ui.context_menu import ContextMenu
+from rp_puppeteer.ui.tabs import Tabs
 
 
 TEST_URL = "http://www.maindomain.test/link_1.html";
@@ -16,7 +17,10 @@ class TestOpenInNewTab(RequestPolicyTestCase):
     def setUp(self):
         RequestPolicyTestCase.setUp(self)
         self.prefs.set_pref(PREF_DEFAULT_ALLOW, False);
+
         self.redir = RedirectNotification(lambda: self.marionette)
+        self.tabs = Tabs(lambda: self.marionette)
+        self.ctx_menu = ContextMenu(lambda: self.marionette)
 
 
     def test_open_in_new_tab(self):
@@ -34,21 +38,24 @@ class TestOpenInNewTab(RequestPolicyTestCase):
                 self.assertEqual(len(self.browser.tabbar.tabs), 2,
                                  "A new tab has been opened.")
 
+                [origin_tab, dest_tab] = self.browser.tabbar.tabs
+                self.tabs.wait_until_loaded(dest_tab)
+
                 # checks in the origin's tab
+                origin_tab.switch_to()
                 self.assertFalse(self.redir.panel_exists(),
                                  ("Following the link didn't cause a "
                                   "redirect in the origin tab."))
 
-                # the destination's tab
-                tab = self.browser.tabbar.tabs[-1]
-                tab.switch_to()
                 # checks in the destination's tab
-                self.assertEqual(tab.location, link_url,
+                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(),
                                  ("Following the link didn't cause a "
                                   "redirect in the destination tab."))
-                tab.close()
+
+                dest_tab.close()
 
 
     def open_link_multi(self, link):
@@ -60,10 +67,7 @@ class TestOpenInNewTab(RequestPolicyTestCase):
         yield
 
         # METHOD #2: context menu
-        (
-            ContextMenu(lambda: self.marionette)
-            .select_entry("context-openlinkintab", link)
-        )
+        self.ctx_menu.select_entry("context-openlinkintab", link)
         # TODO: Use the "tabs" library as soon as it has been ported
         #       to Marionette, see Mozilla Bug 1121725.
         #       The mozmill code to open the link in a new tab was:

-- 
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