[Pkg-mozext-commits] [requestpolicy] 55/257: [tst][add] Marionette test: open selURL 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 4ee0f0c62910656960d74a78fd60863202e0656d
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Sep 10 12:28:46 2015 +0200

    [tst][add] Marionette test: open selURL in new tab
    
    Convert Mozmill test
    "testLinks/testTextSelection/testOpenInNewTab.js"
    to Marionette.
---
 .../tests/links/text_selection/manifest.ini        |  1 +
 .../links/text_selection/test_open_in_new_tab.py   | 64 ++++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/tests/marionette/tests/links/text_selection/manifest.ini b/tests/marionette/tests/links/text_selection/manifest.ini
index 518987f..63864a4 100644
--- a/tests/marionette/tests/links/text_selection/manifest.ini
+++ b/tests/marionette/tests/links/text_selection/manifest.ini
@@ -1 +1,2 @@
 [test_open_in_current_tab.py]
+[test_open_in_new_tab.py]
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
new file mode 100644
index 0000000..8449b6e
--- /dev/null
+++ b/tests/marionette/tests/links/text_selection/test_open_in_new_tab.py
@@ -0,0 +1,64 @@
+# 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
+from rp_puppeteer.ui.redirect_notification import RedirectNotification
+from rp_puppeteer.ui.context_menu import ContextMenu
+from rp_puppeteer.ui.tabs import Tabs
+from rp_puppeteer.ui.web_utils import WebUtils
+
+
+TEST_URL = "http://www.maindomain.test/link_1.html";
+PREF_DEFAULT_ALLOW = "extensions.requestpolicy.defaultPolicy.allow"
+
+
+class TestOpenInNewTab(RequestPolicyTestCase):
+
+    def setUp(self):
+        RequestPolicyTestCase.setUp(self)
+        self.prefs.set_pref(PREF_DEFAULT_ALLOW, False);
+
+        self.redir = RedirectNotification(lambda: self.marionette)
+        self.web_utils = WebUtils(lambda: self.marionette)
+        self.tabs = Tabs(lambda: self.marionette)
+        self.ctx_menu = ContextMenu(lambda: self.marionette)
+
+
+    def test_open_in_new_tab(self):
+        with self.marionette.using_context("content"):
+            # load the test url
+            self.marionette.navigate(TEST_URL)
+
+            # find the URL string and its wrapping element
+            url_wrapper = self.marionette.find_element("id", "text_url_1")
+            url = url_wrapper.get_attribute("textContent")
+
+            # select the URL
+            self.web_utils.select_element_text(url_wrapper)
+
+        with self.marionette.using_context("chrome"):
+            # perform right-click and entry selection
+            self.ctx_menu.select_entry("context-openlinkintab", url_wrapper)
+
+            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."))
+
+            # checks in the destination's tab
+            dest_tab.switch_to()
+            self.assertEqual(dest_tab.location, 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."))
+
+            dest_tab.close()

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