[tbb-commits] [tor-browser-bundle-testsuite/master] Fix failing security level UI test

gk at torproject.org gk at torproject.org
Fri Dec 11 21:30:52 UTC 2020


commit 97c7e5d01bd608c9b9dec8eb4b26b53e829e3631
Author: Alex Catarineu <acat at torproject.org>
Date:   Fri Dec 11 10:15:58 2020 +0100

    Fix failing security level UI test
---
 marionette/tor_browser_tests/test_security_level_ui.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/marionette/tor_browser_tests/test_security_level_ui.py b/marionette/tor_browser_tests/test_security_level_ui.py
index d856c21..eab4a8a 100644
--- a/marionette/tor_browser_tests/test_security_level_ui.py
+++ b/marionette/tor_browser_tests/test_security_level_ui.py
@@ -2,12 +2,21 @@ from marionette_driver import Wait, expected
 from marionette_harness import MarionetteTestCase
 
 class Test(MarionetteTestCase):
+    # Starting 84, opening the security level panel by clicking the button
+    # started to fail (the panel was not visible). Opening via JavaScript
+    # seems to still work for 84 and 78.
+    def open_security_level_panel(self):
+        m = self.marionette
+        with m.using_context('chrome'):
+            self.marionette.execute_script(
+                'document.getElementById("security-level-button").click();')
+
     def test_security_level_ui(self):
         custom_pref = 'javascript.options.wasm'
         m = self.marionette
         m.timeout.implicit = 5
         with m.using_context('chrome'):
-            m.find_element('id', 'security-level-button').click()
+            self.open_security_level_panel()
             m.find_element(
                 'id', 'securityLevel-advancedSecuritySettings').click()
             with m.using_context('content'):
@@ -49,7 +58,7 @@ class Test(MarionetteTestCase):
                     m.get_url() in ["https://tb-manual.torproject.org/en-US/security-settings/", "https://tb-manual.torproject.org/security-settings/"])
 
             # Test Learn More link from panel
-            m.find_element('id', 'security-level-button').click()
+            self.open_security_level_panel()
             m.find_element('id', 'securityLevel-learnMore').click()
             Wait(m, timeout=m.timeout.page_load).until(
                 lambda _: len(m.window_handles) > 2)
@@ -64,7 +73,7 @@ class Test(MarionetteTestCase):
             m.set_pref(custom_pref, False)
             elem = m.find_element('id', 'securityLevel-restoreDefaults')
             self.assertEqual(elem.is_displayed(), False)
-            m.find_element('id', 'security-level-button').click()
+            self.open_security_level_panel()
             self.assertEqual(elem.is_displayed(), True)
             elem.click()
             self.assertEqual(True, m.get_pref(custom_pref))



More information about the tbb-commits mailing list