[tor-commits] [tor-browser-bundle-testsuite/master] Bug 40011: Update tests when switching to Fenix 84
gk at torproject.org
gk at torproject.org
Fri Dec 11 21:30:52 UTC 2020
commit b1d93a3c91c8e29ee3bca37f9c11d55e63a5c2b5
Author: Alex Catarineu <acat at torproject.org>
Date: Wed Nov 25 18:17:27 2020 +0100
Bug 40011: Update tests when switching to Fenix 84
---
marionette/tor_browser_tests/test_dom-objects-enumeration.py | 2 ++
marionette/tor_browser_tests/test_onion_alias.py | 9 +++++----
marionette/tor_browser_tests/test_onion_location.py | 3 ++-
marionette/tor_browser_tests/test_onion_security_expectations.py | 4 ++--
marionette/tor_browser_tests/test_searchengines.py | 3 +++
marionette/tor_browser_tests/test_security_level_ui.py | 5 +++--
test-data/dom-objects-enumeration.js | 6 ++++--
7 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/marionette/tor_browser_tests/test_dom-objects-enumeration.py b/marionette/tor_browser_tests/test_dom-objects-enumeration.py
index 90458a6..c020fc0 100644
--- a/marionette/tor_browser_tests/test_dom-objects-enumeration.py
+++ b/marionette/tor_browser_tests/test_dom-objects-enumeration.py
@@ -760,6 +760,8 @@ class Test(testsuite.TorBrowserTest):
expectedObjects = expectedObjects.union({"MediaMetadata","MediaSession","Sanitizer"})
if self.get_version() >= 83 and self.is_early_beta_or_earlier():
expectedObjects = expectedObjects.union({"onbeforeinput"})
+ if self.get_version() >= 84:
+ expectedObjects = expectedObjects.union({"PerformancePaintTiming"}).difference({"Sanitizer"})
with self.marionette.using_context('content'):
self.marionette.navigate(self.test_page_file_url)
diff --git a/marionette/tor_browser_tests/test_onion_alias.py b/marionette/tor_browser_tests/test_onion_alias.py
index 8f1dc67..9480020 100644
--- a/marionette/tor_browser_tests/test_onion_alias.py
+++ b/marionette/tor_browser_tests/test_onion_alias.py
@@ -1,5 +1,4 @@
from marionette_driver import Wait
-from marionette_driver.legacy_actions import Actions
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class Test(WindowManagerMixin, MarionetteTestCase):
@@ -39,9 +38,11 @@ class Test(WindowManagerMixin, MarionetteTestCase):
# Opening a same-origin link should keep the onion alias in the urlbar
el = m.find_element('id', 'submit-documents-button')
- action = Actions(m)
- action.middle_click(el)
- action.perform()
+ mouse_chain = self.marionette.actions.sequence(
+ "pointer", "pointer_id", {"pointerType": "mouse"}
+ )
+ mouse_chain.click(element=el, button=1).perform()
+
Wait(m, timeout=m.timeout.page_load).until(
lambda _: len(m.window_handles) > 1)
m.switch_to_window(m.window_handles[1])
diff --git a/marionette/tor_browser_tests/test_onion_location.py b/marionette/tor_browser_tests/test_onion_location.py
index 37acb2d..daa0b27 100644
--- a/marionette/tor_browser_tests/test_onion_location.py
+++ b/marionette/tor_browser_tests/test_onion_location.py
@@ -81,8 +81,9 @@ class Test(WindowManagerMixin, MarionetteTestCase):
with m.using_context('content'):
m.switch_to_window(m.window_handles[1])
+ spotlight = m.find_element('class name', 'spotlight')
self.assertEqual(
- self.get_url(), 'about:preferences#privacy-onionservices')
+ spotlight.get_attribute("data-subcategory"), "onionservices")
m.close()
m.switch_to_window(self.start_tab)
diff --git a/marionette/tor_browser_tests/test_onion_security_expectations.py b/marionette/tor_browser_tests/test_onion_security_expectations.py
index 7a0fd27..e95b29b 100644
--- a/marionette/tor_browser_tests/test_onion_security_expectations.py
+++ b/marionette/tor_browser_tests/test_onion_security_expectations.py
@@ -51,8 +51,8 @@ class Test(OnionFixturesMixin, WindowManagerMixin, MarionetteTestCase):
'document.getElementById("identity-popup-more-info").click()')
m.switch_to_window(m.chrome_window_handles[1])
Wait(m, timeout=m.timeout.page_load).until(
- lambda _: m.find_element('id', 'security-technical-shortform').text != '')
- text = m.find_element('id', 'security-technical-shortform').text
+ lambda _: m.find_element('id', 'security-technical-shortform').get_attribute('value') != '')
+ text = m.find_element('id', 'security-technical-shortform').get_attribute('value')
m.close_chrome_window()
m.switch_to_window(self.start_window)
return text
diff --git a/marionette/tor_browser_tests/test_searchengines.py b/marionette/tor_browser_tests/test_searchengines.py
index 9f394f7..4fb264f 100644
--- a/marionette/tor_browser_tests/test_searchengines.py
+++ b/marionette/tor_browser_tests/test_searchengines.py
@@ -7,6 +7,7 @@
# check the entries in the search box directly.
from marionette_harness import MarionetteTestCase
+from marionette_driver import Wait
import testsuite
class Test(MarionetteTestCase):
@@ -16,6 +17,7 @@ class Test(MarionetteTestCase):
ts = testsuite.TestSuite()
def test_searchengines(self):
+ m = self.marionette
with self.marionette.using_context('content'):
self.marionette.navigate('about:robots')
@@ -26,6 +28,7 @@ class Test(MarionetteTestCase):
searchbar.send_keys("test")
urlbarresults = self.marionette.find_element('id', 'urlbar-results')
result = urlbarresults.find_element("css selector", "div:first-child .urlbarView-action")
+ Wait(m, timeout=m.timeout.page_load).until(lambda _: result.text != '')
self.assertRegexpMatches(result.text, 'DuckDuckGo', 'DuckDuckGo is not the default search engine!')
#XXX: Test whether the second and third engine are the ones we want as well.
diff --git a/marionette/tor_browser_tests/test_security_level_ui.py b/marionette/tor_browser_tests/test_security_level_ui.py
index 740934f..d856c21 100644
--- a/marionette/tor_browser_tests/test_security_level_ui.py
+++ b/marionette/tor_browser_tests/test_security_level_ui.py
@@ -1,4 +1,4 @@
-from marionette_driver import Wait
+from marionette_driver import Wait, expected
from marionette_harness import MarionetteTestCase
class Test(MarionetteTestCase):
@@ -12,8 +12,9 @@ class Test(MarionetteTestCase):
'id', 'securityLevel-advancedSecuritySettings').click()
with m.using_context('content'):
# Test whether changing the security level value works
+ spotlight = m.find_element('class name', 'spotlight')
self.assertEqual(
- m.get_url(), "about:preferences#privacy-securitylevel")
+ spotlight.get_attribute("data-subcategory"), "securitylevel")
self.assertEqual(4, m.get_pref(
'extensions.torbutton.security_slider'))
m.find_element(
diff --git a/test-data/dom-objects-enumeration.js b/test-data/dom-objects-enumeration.js
index b3e60c5..9247e71 100644
--- a/test-data/dom-objects-enumeration.js
+++ b/test-data/dom-objects-enumeration.js
@@ -1,4 +1,6 @@
-(() => {
+// The setTimeout is a workaround for some objects not being immediately available in some cases,
+// such as NotifyPaintEvent.
+setTimeout(() => {
// getAllPropertyNames function taken from:
// https://stackoverflow.com/questions/8024149/is-it-possible-to-get-the-non-enumerable-inherited-property-names-of-an-object
function getAllPropertyNames(obj) {
@@ -41,4 +43,4 @@
onmessage(getGlobalNames());
}
}
-})();
\ No newline at end of file
+}, 2000);
\ No newline at end of file
More information about the tor-commits
mailing list