[Pkg-mozext-commits] [requestpolicy] 68/257: [tst][add] extend Puppeteer "L10n" API

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:19:57 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 1af0c33d0e38e43a31a7ce286e3bb8ad3153b771
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Oct 6 12:12:06 2015 +0200

    [tst][add] extend Puppeteer "L10n" API
---
 tests/marionette/rp_puppeteer/__init__.py        |  4 ++++
 tests/marionette/rp_puppeteer/api/l10n.py        | 19 +++++++++++++++++++
 tests/marionette/rp_puppeteer/tests/manifest.ini |  1 +
 tests/marionette/rp_puppeteer/tests/test_l10n.py | 23 +++++++++++++++++++++++
 4 files changed, 47 insertions(+)

diff --git a/tests/marionette/rp_puppeteer/__init__.py b/tests/marionette/rp_puppeteer/__init__.py
index 4fb0dc0..43eed5c 100644
--- a/tests/marionette/rp_puppeteer/__init__.py
+++ b/tests/marionette/rp_puppeteer/__init__.py
@@ -12,6 +12,10 @@ class RequestPolicyPuppeteer(object):
     RequestPolicyTestCase instance.
     """
 
+    @use_class_as_property('api.l10n.L10n')
+    def l10n(self):
+        pass
+
     @use_class_as_property('api.prefs.Preferences')
     def prefs(self):
         pass
diff --git a/tests/marionette/rp_puppeteer/api/l10n.py b/tests/marionette/rp_puppeteer/api/l10n.py
new file mode 100644
index 0000000..a509501
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/api/l10n.py
@@ -0,0 +1,19 @@
+# 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_puppeteer.api.l10n import L10n as FxL10n
+
+
+class L10n(FxL10n):
+    """Subclass of Firefox Puppeteer's L10n class to provide methods without
+    specifying the l10n file.
+    """
+
+    def get_rp_property(self, property_id):
+        property_urls = ["chrome://rpcontinued/locale/requestpolicy.properties"]
+        return FxL10n.get_property(self, property_urls, property_id)
+
+    def get_rp_entity(self, dtd_id):
+        dtd_urls = ["chrome://rpcontinued/locale/requestpolicy.dtd"]
+        return FxL10n.get_entity(self, dtd_urls, dtd_id)
diff --git a/tests/marionette/rp_puppeteer/tests/manifest.ini b/tests/marionette/rp_puppeteer/tests/manifest.ini
index 8bdd95b..ed8ad25 100644
--- a/tests/marionette/rp_puppeteer/tests/manifest.ini
+++ b/tests/marionette/rp_puppeteer/tests/manifest.ini
@@ -1,5 +1,6 @@
 [test_addons.py]
 [test_error_detection.py]
+[test_l10n.py]
 [test_prefs.py]
 [test_requests.py]
 [test_rules.py]
diff --git a/tests/marionette/rp_puppeteer/tests/test_l10n.py b/tests/marionette/rp_puppeteer/tests/test_l10n.py
new file mode 100644
index 0000000..81f8072
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/tests/test_l10n.py
@@ -0,0 +1,23 @@
+# 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 marionette import SkipTest
+
+
+class TestL10n(RequestPolicyTestCase):
+
+    def test_get_rp_entity(self):
+        # Since the *.dtd files only contain strings for the Request Log,
+        # this test requires a Request-Log-API.
+        raise SkipTest("ToDo")
+
+    def test_get_rp_property(self):
+        prop_id = "preferences"
+
+        with self.marionette.using_context("content"):
+            self.marionette.navigate("about:requestpolicy?basicprefs")
+            el = self.marionette.find_element(
+                "css selector", "[data-string='{}']".format(prop_id))
+            self.assertEqual(el.text, self.l10n.get_rp_property(prop_id))

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