def test_journalist_verifies_deletion_of_one_submission_modal(
            self, sd_servers_v2_with_submitted_file, firefox_web_driver):
        # Given an SD server with a file submitted by a source
        # And a journalist logged into the journalist interface
        journ_app_nav = JournalistAppNavigator(
            journalist_app_base_url=sd_servers_v2_with_submitted_file.
            journalist_app_base_url,
            web_driver=firefox_web_driver,
        )
        journ_app_nav.journalist_logs_in(
            username=sd_servers_v2_with_submitted_file.journalist_username,
            password=sd_servers_v2_with_submitted_file.journalist_password,
            otp_secret=sd_servers_v2_with_submitted_file.journalist_otp_secret,
        )

        # And the journalist went to the individual source's page
        journ_app_nav.journalist_visits_col()

        # And the source has at least one submission
        initial_submissions_count = journ_app_nav.count_submissions_on_current_page(
        )
        assert initial_submissions_count > 0

        # And the journalist selected the first submission
        journ_app_nav.journalist_selects_first_doc()

        # When the journalist clicks the delete button...
        journ_app_nav.journalist_clicks_delete_selected_link()
        # ...but then cancels the deletion
        journ_app_nav.nav_helper.safe_click_by_id("cancel-selected-deletions")

        # Then they see the same number of submissions as before
        submissions_after_canceling_count = journ_app_nav.count_submissions_on_current_page(
        )
        assert submissions_after_canceling_count == initial_submissions_count

        # And when the journalist clicks the delete button...
        journ_app_nav.journalist_clicks_delete_selected_link()
        # ... and then confirms the deletion
        journ_app_nav.nav_helper.safe_click_by_id("delete-selected")

        # Then they see less submissions than before because one was deleted
        def submission_deleted():
            submissions_after_confirming_count = journ_app_nav.count_submissions_on_current_page(
            )
            assert submissions_after_confirming_count < initial_submissions_count

        journ_app_nav.nav_helper.wait_for(submission_deleted)
    def test_journalist_uses_col_delete_collection_button_modal(
            self, sd_servers_v2_with_submitted_file, firefox_web_driver):
        # Given an SD server with a file submitted by a source
        # And a journalist logged into the journalist interface
        journ_app_nav = JournalistAppNavigator(
            journalist_app_base_url=sd_servers_v2_with_submitted_file.
            journalist_app_base_url,
            web_driver=firefox_web_driver,
        )
        journ_app_nav.journalist_logs_in(
            username=sd_servers_v2_with_submitted_file.journalist_username,
            password=sd_servers_v2_with_submitted_file.journalist_password,
            otp_secret=sd_servers_v2_with_submitted_file.journalist_otp_secret,
        )

        # And the journalist went to the individual source's page
        journ_app_nav.journalist_visits_col()

        # And the source has at least one submission
        initial_submissions_count = journ_app_nav.count_submissions_on_current_page(
        )
        assert initial_submissions_count > 0

        # When the journalist clicks the delete collection button...
        self._journalist_clicks_delete_collection_link(journ_app_nav)
        # ...but then cancels the deletion
        journ_app_nav.nav_helper.safe_click_by_id(
            "cancel-collection-deletions")

        # Then they see the same number of submissions as before
        submissions_after_canceling_count = journ_app_nav.count_submissions_on_current_page(
        )
        assert submissions_after_canceling_count == initial_submissions_count

        # When the journalist clicks the delete collection button...
        self._journalist_clicks_delete_collection_link(journ_app_nav)
        # ... and then confirms the deletion
        journ_app_nav.nav_helper.safe_click_by_id("delete-collection-button")

        # Then the journalist was redirected to the home page
        assert journ_app_nav.is_on_journalist_homepage()