[Pkg-mozext-commits] [requestpolicy] 56/80: Marionette: test the setup page opens on install

David Prévot taffit at moszumanska.debian.org
Sun Jul 5 15:02:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit d05f15d846cbfd6397841cd3fe18204679ebfc0c
Author: Martin Kimmerle <dev at 256k.de>
Date:   Fri Jun 19 20:05:29 2015 +0200

    Marionette: test the setup page opens on install
---
 tests/marionette/tests/manifest.ini       |  1 +
 tests/marionette/tests/test_setup_page.py | 40 +++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/tests/marionette/tests/manifest.ini b/tests/marionette/tests/manifest.ini
index b55174d..042c15e 100644
--- a/tests/marionette/tests/manifest.ini
+++ b/tests/marionette/tests/manifest.ini
@@ -1 +1,2 @@
 [test_restartlessness.py]
+[test_setup_page.py]
diff --git a/tests/marionette/tests/test_setup_page.py b/tests/marionette/tests/test_setup_page.py
new file mode 100644
index 0000000..80292fa
--- /dev/null
+++ b/tests/marionette/tests/test_setup_page.py
@@ -0,0 +1,40 @@
+# 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 firefox_ui_harness import FirefoxTestCase
+from marionette_driver.wait import Wait
+from rp_puppeteer.ui.addons import RequestPolicy
+
+
+PREF_WELCOME_WIN_SHOWN = "extensions.requestpolicy.welcomeWindowShown"
+
+
+class TestSetupPageShowingUp(FirefoxTestCase):
+    def _get_setup_tab(self):
+        # TODO: Search in all windows for setup tabs.
+        #       Assert there isn't more than one setup tab.
+
+        tab = self.browser.tabbar.selected_tab
+        if tab.location == "about:requestpolicy?setup":
+            return tab
+        else:
+            return None
+
+
+    def test_on_install(self):
+        rp = RequestPolicy(lambda: self.marionette)
+        rp.remove()
+
+        self.prefs.set_pref(PREF_WELCOME_WIN_SHOWN, False)
+
+        with rp.install_in_two_steps():
+            setup_tab = Wait(self.marionette).until(
+                lambda m: self._get_setup_tab(),
+                message="RequestPolicy has opened its Setup page.")
+            self.assertTrue(self.prefs.get_pref(PREF_WELCOME_WIN_SHOWN),
+                            msg=("The 'welcome window shown' pref has "
+                                 "been set to `true`."))
+            self.assertTrue(setup_tab.selected,
+                            msg="The setup tab is selected.")
+            setup_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