[tbb-commits] [tor-browser-bundle-testsuite/master] Fix download_pdf test

gk at torproject.org gk at torproject.org
Thu Oct 15 18:41:27 UTC 2020


commit b44d95b16beb891ae730cb24fc29b0edb1324701
Author: Alex Catarineu <acat at torproject.org>
Date:   Sun May 17 19:42:48 2020 +0200

    Fix download_pdf test
---
 TBBTestSuite/TestSuite/BrowserBundleTests.pm      |  2 --
 marionette/tor_browser_tests/test_download_pdf.py | 38 +++++------------------
 2 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
index ce5ffeb..a054438 100644
--- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm
+++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
@@ -485,8 +485,6 @@ our @tests = (
         type            => 'marionette',
         descr           => 'Check if download of PDF is working (#19402)',
         use_net         => 1,
-        # Bug 30333: temporarily disable test
-        enable          => sub { undef },
     },
     {
         name            => 'pinning_now',
diff --git a/marionette/tor_browser_tests/test_download_pdf.py b/marionette/tor_browser_tests/test_download_pdf.py
index 737a725..408f63a 100644
--- a/marionette/tor_browser_tests/test_download_pdf.py
+++ b/marionette/tor_browser_tests/test_download_pdf.py
@@ -1,6 +1,3 @@
-from marionette_driver import By, Actions
-from marionette_driver.errors import MarionetteException, JavascriptException
-
 from marionette_harness import MarionetteTestCase
 
 import testsuite
@@ -19,31 +16,10 @@ class Test(MarionetteTestCase):
 
     def test_download_pdf(self):
         m = self.marionette
-
-        m.set_search_timeout(1000)
-        m.set_window_size(1024, 300)
-
-        with m.using_context('content'):
-
-            current_window = m.current_chrome_window_handle
-
-            m.navigate(self.URL)
-            download_button = m.find_element('id', 'download')
-            action = Actions(m)
-            action.click(download_button)
-            action.wait(time=3)
-            action.perform()
-
-            closed_window = 0
-            with m.using_context('chrome'):
-                for window in m.chrome_window_handles:
-                    if window != current_window:
-                        m.switch_to_window(window)
-                        info_msg = m.find_element('id', 'info.body')
-                        self.assertRegexpMatches(info_msg.text, 'Tails',
-                                msg='Pop up window text does not include Tails')
-                        m.close()
-                        closed_window += 1
-                m.switch_to_window(current_window)
-            self.assertEqual(closed_window, 1, msg="no download pop up")
-
+        m.set_window_rect(width=1024, height=300)
+        m.navigate(self.URL)
+        download_button = m.find_element('id', 'download').click()
+        self.assertEqual(len(m.chrome_window_handles), 2, msg="Number of windows not correct")
+        dialog = m.switch_to_alert()
+        self.assertRegexpMatches(dialog.text, 'Tails',
+                            msg='Pop up window text does not include Tails')





More information about the tbb-commits mailing list