summaryrefslogtreecommitdiffstats
path: root/testing/firefox-ui/tests/functional/private_browsing
diff options
context:
space:
mode:
Diffstat (limited to 'testing/firefox-ui/tests/functional/private_browsing')
-rw-r--r--testing/firefox-ui/tests/functional/private_browsing/manifest.ini4
-rw-r--r--testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py60
2 files changed, 64 insertions, 0 deletions
diff --git a/testing/firefox-ui/tests/functional/private_browsing/manifest.ini b/testing/firefox-ui/tests/functional/private_browsing/manifest.ini
new file mode 100644
index 000000000..405753082
--- /dev/null
+++ b/testing/firefox-ui/tests/functional/private_browsing/manifest.ini
@@ -0,0 +1,4 @@
+[DEFAULT]
+tags = local
+
+[test_about_private_browsing.py] \ No newline at end of file
diff --git a/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py b/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py
new file mode 100644
index 000000000..4b22d03ea
--- /dev/null
+++ b/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py
@@ -0,0 +1,60 @@
+# 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 import PuppeteerMixin
+from firefox_puppeteer.ui.browser.window import BrowserWindow
+from marionette_driver import By, Wait
+from marionette_harness import MarionetteTestCase
+
+
+class TestAboutPrivateBrowsing(PuppeteerMixin, MarionetteTestCase):
+
+ def setUp(self):
+ super(TestAboutPrivateBrowsing, self).setUp()
+
+ # Use a fake local support URL
+ support_url = 'about:blank?'
+ self.marionette.set_pref('app.support.baseURL', support_url)
+
+ self.pb_url = support_url + 'private-browsing'
+
+ def tearDown(self):
+ try:
+ self.marionette.clear_pref('app.support.baseURL')
+ finally:
+ super(TestAboutPrivateBrowsing, self).tearDown()
+
+ def testCheckAboutPrivateBrowsing(self):
+ self.assertFalse(self.browser.is_private)
+
+ with self.marionette.using_context('content'):
+ self.marionette.navigate('about:privatebrowsing')
+
+ status_node = self.marionette.find_element(By.CSS_SELECTOR, 'p.showNormal')
+ self.assertEqual(status_node.text,
+ self.browser.localize_entity('aboutPrivateBrowsing.notPrivate'),
+ 'Status text indicates we are not in private browsing mode')
+
+ def window_opener(win):
+ with win.marionette.using_context('content'):
+ button = self.marionette.find_element(By.ID, 'startPrivateBrowsing')
+ button.click()
+
+ pb_window = self.browser.open_window(callback=window_opener,
+ expected_window_class=BrowserWindow)
+
+ try:
+ self.assertTrue(pb_window.is_private)
+
+ def tab_opener(tab):
+ with tab.marionette.using_context('content'):
+ link = tab.marionette.find_element(By.ID, 'learnMore')
+ link.click()
+
+ tab = pb_window.tabbar.open_tab(trigger=tab_opener)
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
+ lambda _: tab.location == self.pb_url)
+
+ finally:
+ pb_window.close()