示例#1
0
    def run(self, firefox):
        navigate(LocalWeb.THINKBROADBAND_TEST_SITE)

        # Wait for the page to be loaded.
        try:
            wait(DownloadFiles.VERY_LARGE_FILE_1GB, 10)
            logger.debug('File is present in the page.')
        except FindError:
            raise FindError('File is not present in the page.')

        select_throttling(NetworkOption.GOOD_3G)

        download_file(DownloadFiles.VERY_LARGE_FILE_1GB, DownloadFiles.OK)

        expected = exists(NavBar.DOWNLOADS_BUTTON, 10)
        assert expected is True, '\'Downloads\' button found.'

        # Check download summary.
        expected = exists(DownloadFiles.DOWNLOAD_FILE_NAME_1GB, 10)
        assert expected is True, 'The 1GB download in progress is properly displayed.'

        expected = exists(DownloadManager.DownloadsPanel.TIME_LEFT.similar(0.7), 10)
        assert expected is True, 'Time left information is displayed.'

        expected = exists(DownloadManager.DownloadsPanel.BYTES_SECOND, 10)
        assert expected is True, 'Speed of download is displayed.'

        # Cancel the download.
        expected = exists(DownloadManager.DownloadsPanel.DOWNLOAD_CANCEL, 10)
        assert expected is True, 'The \'X\' button is found in the Downloads panel.'

        click(DownloadManager.DownloadsPanel.DOWNLOAD_CANCEL)
    def run(self, firefox):
        new_private_window()
        expected = exists(PrivateWindow.private_window_pattern, 10)
        assert expected is True, "Private window successfully loaded."
        type(text="o")

        download_files_list = [
            DownloadFiles.VERY_LARGE_FILE_1GB,
            DownloadFiles.EXTRA_LARGE_FILE_512MB,
        ]

        navigate(LocalWeb.DOWNLOAD_TEST_SITE)

        # Wait for the page to be loaded.
        try:
            wait(DownloadFiles.VERY_LARGE_FILE_1GB, 30)
            logger.debug("File is present in the page.")
        except FindError:
            raise FindError("File is not present in the page.")

        select_throttling(NetworkOption.GOOD_3G)

        expected = exists(NavBar.RELOAD_BUTTON, 10)
        assert expected is True, "Reload button found in the page."
        click(NavBar.RELOAD_BUTTON)

        expected = exists(DownloadFiles.STATUS_200, 10)
        assert expected is True, "Page successfully reloaded."

        for pattern in download_files_list:
            download_file(pattern, DownloadFiles.OK)
            file_index = download_files_list.index(pattern)

            if file_index == 0:
                expected = exists(NavBar.DOWNLOADS_BUTTON, 10)
        assert expected is True, "Download button found in the page."

        click(NavBar.DOWNLOADS_BUTTON.target_offset(-50, 0))

        click(NavBar.DOWNLOADS_BUTTON)
        expected = exists(DownloadManager.DownloadState.SPEED_PER_SECOND, 10)
        assert expected is True, "At least one download is in progress."

        click(NavBar.DOWNLOADS_BUTTON.target_offset(-50, 0))

        close_window()

        expected = exists(DownloadFiles.CANCEL_ALL_DOWNLOADS_POP_UP, 10)
        assert expected is True, "'Cancel all downloads?' warning pop-up is displayed."

        # Cancel all downloads.
        type(Key.ENTER)
        time.sleep(Settings.DEFAULT_UI_DELAY_LONG)

        # Refocus the firefox window.
        expected = exists(LocationBar.STAR_BUTTON_UNSTARRED, 10)
        assert expected is True, "'Star button' is displayed."
        exists(LocationBar.STAR_BUTTON_UNSTARRED, 10)
        click(LocationBar.STAR_BUTTON_UNSTARRED.target_offset(+40, 0))
    def run(self, firefox):
        download_files_list = [
            DownloadFiles.VERY_LARGE_FILE_1GB,
            DownloadFiles.EXTRA_LARGE_FILE_512MB,
        ]

        navigate(LocalWeb.DOWNLOAD_TEST_SITE)

        # Wait for the page to be loaded.
        try:
            wait(DownloadFiles.VERY_LARGE_FILE_1GB, 30)
            logger.debug("File is present in the page.")
        except FindError:
            raise FindError("File is not present in the page.")

        select_throttling(NetworkOption.GOOD_3G)

        expected = exists(NavBar.RELOAD_BUTTON, 10)
        assert expected is True, "Reload button found in the page."
        click(NavBar.RELOAD_BUTTON)

        expected = exists(DownloadFiles.STATUS_200, 10)
        assert expected is True, "Page successfully reloaded."

        for pattern in download_files_list:
            download_file(pattern, DownloadFiles.OK)
            file_index = download_files_list.index(pattern)

            if file_index == 0:
                expected = exists(NavBar.DOWNLOADS_BUTTON, 10)
                assert expected is True, "Download button found in the page."

            click(NavBar.DOWNLOADS_BUTTON.target_offset(-50, 0))

        click(NavBar.DOWNLOADS_BUTTON)
        expected = exists(DownloadManager.DownloadState.SPEED_PER_SECOND, 10)
        assert expected is True, "At least one download is in progress."

        click(NavBar.DOWNLOADS_BUTTON.target_offset(-50, 0))

        quit_firefox()

        expected = exists(DownloadFiles.CANCEL_ALL_DOWNLOADS_POP_UP, 10)
        assert expected is True, "'Cancel all downloads?' warming pop-up is displayed."

        # Dismiss warming pop-up.
        type(text=Key.ESC)

        # Cancel all 'in progress' downloads.
        cancel_and_clear_downloads()
        # Refocus the firefox window.
        exists(LocationBar.STAR_BUTTON_UNSTARRED, 10)
        click(LocationBar.STAR_BUTTON_UNSTARRED.target_offset(+30, 0))
示例#4
0
    def run(self, firefox):
        download_files_list = [
            DownloadFiles.EXTRA_SMALL_FILE_5MB,
            DownloadFiles.VERY_LARGE_FILE_1GB,
        ]

        navigate(LocalWeb.THINKBROADBAND_TEST_SITE)

        # Wait for the page to be loaded.
        try:
            wait(DownloadFiles.VERY_LARGE_FILE_1GB, 10)
            logger.debug("File is present in the page.")
        except FindError:
            raise FindError("File is not present in the page.")

        select_throttling(NetworkOption.GOOD_3G)

        for pattern in download_files_list:
            download_file(pattern, DownloadFiles.OK)
            file_index = download_files_list.index(pattern)

            if file_index == 0:
                expected = exists(NavBar.DOWNLOADS_BUTTON, 10)
                assert expected is True, "Download button found in the page."

            click(
                DownloadManager.DownloadsPanel.DOWNLOADS_BUTTON.target_offset(
                    -50, 0))

        # Open the Downloads Panel.
        click(NavBar.DOWNLOADS_BUTTON)

        # Check that the 5MB download is complete.
        expected = exists(DownloadFiles.DOWNLOADS_PANEL_5MB_COMPLETED, 90)
        assert expected is True, "The 5MB download is complete."

        # Open the context menu and select 'Clear Preview Panel'.
        right_click(DownloadFiles.DOWNLOADS_PANEL_5MB_COMPLETED)
        type(text="a")

        # Check that the 1GB download in progress is still displayed.
        expected = exists(DownloadFiles.DOWNLOAD_FILE_NAME_1GB, 10)
        assert expected is True, "The 1GB download in progress is properly displayed."

        # Stop the active download.
        expected = exists(DownloadManager.DownloadsPanel.DOWNLOAD_CANCEL, 10)
        assert expected is True, "The 'X' button is properly displayed."
        click(DownloadManager.DownloadsPanel.DOWNLOAD_CANCEL)