class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "105MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") self.download_manager.verify_download_graphical_status( self.data_url, "downloading") self.download_manager.stop_download(self.data_url, True) is_there = self.UTILS.statusbar.isIconInStatusBar( DOM.Statusbar.downloads) self.UTILS.test.test( not is_there, "Verify that the download icon in status bar is dismissed")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "1GB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") download_info = self.download_manager.get_download_info(self.data_url) match = re.search( r"(\d)+(.(\d)+)*\s(GB|MB|KB)\sof\s(\d)+(.(\d)+)*\sGB$", download_info.text) self.UTILS.test.test(match is not None, "Verify the the text is: 'X' GB of 'Y' GB") time.sleep(3) self.download_manager.stop_download(self.data_url, True)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "1GB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") download_info = self.download_manager.get_download_info(self.data_url) match = re.search(r"(\d)+(.(\d)+)*\s(GB|MB|KB)\sof\s(\d)+(.(\d)+)*\sGB$", download_info.text) self.UTILS.test.test(match is not None, "Verify the the text is: 'X' GB of 'Y' GB") time.sleep(3) self.download_manager.stop_download(self.data_url, True)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "41MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading", timeout=15) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") self.download_manager.verify_download_graphical_status(self.data_url, "downloading") self.UTILS.home.touchHomeButton() self.UTILS.statusbar.displayStatusBar() self.UTILS.statusbar.wait_for_notification_statusbar_title("Downloading") self.UTILS.statusbar.hideStatusBar() self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=240)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "105MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") self.download_manager.verify_download_graphical_status(self.data_url, "downloading") self.download_manager.stop_download(self.data_url, True) is_there = self.UTILS.statusbar.isIconInStatusBar(DOM.Statusbar.downloads) self.UTILS.test.test(not is_there, "Verify that the download icon in status bar is dismissed")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) # Specific for this test. self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "Crazy_Horse.jpg" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( "Download complete", timeout=60) time.sleep(5) self.settings.launch() self.settings.downloads() self.download_manager.verify_download_status(self.data_url, "succeeded") self.download_manager.delete_download(self.data_url)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) # Specific for this test. self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "Crazy_Horse.jpg" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60) time.sleep(5) self.settings.launch() self.settings.downloads() self.download_manager.verify_download_status(self.data_url, "succeeded") self.download_manager.delete_download(self.data_url)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_names = [ "105MB.rar", "41MB.rar", "30MB.rar" ] self.data_urls = ["{}/{}".format(self.test_url, file_name) for file_name in self.file_names] # Progress trackers self.pre_progresses = [] self.post_progresses = [] self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def _download_multiple_files(self, file): self.download_manager.download_file(file) self.marionette.switch_to_frame() self.UTILS.statusbar.wait_for_notification_toaster_title( text="Download started", frame_to_change=DOM.Browser.frame_locator, timeout=15, notif_text="Downloading") self.UTILS.reporting.logResult('info', 'Looking for next link!!!!') self.browser.switch_to_content() time.sleep(5) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) map(self._download_multiple_files, self.file_names) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() for data_url in self.data_urls: # Check the download is there self.download_manager.get_download_entry(data_url) # Check it is downloading self.download_manager.verify_download_status(data_url, "downloading") self.download_manager.verify_download_graphical_status(data_url, "downloading") # Append the progress self.pre_progresses.append(self.download_manager.get_download_progress(data_url)) time.sleep(10) for data_url in self.data_urls: self.post_progresses.append(self.download_manager.get_download_progress(data_url)) self.UTILS.reporting.logResult('info', "Initial progress array: {}".format(self.pre_progresses)) self.UTILS.reporting.logResult('info', "Final progress array: {}".format(self.post_progresses)) result = all([self.pre_progresses[i] < self.post_progresses[i] for i in range(len(self.file_names))]) self.UTILS.test.test(result, "The progress bar grows during the download.")