Skip to content

Commit

Permalink
Test: Rename javascript tests to modal for deletion confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
SaptakS committed Feb 1, 2018
1 parent 05ad785 commit 51e8472
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions securedrop/journalist_templates/col.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
<div id="delete-selected-confirmation-modal" class="modal-dialog">
<a href="#close" class="external"></a>
<div>
<a href="#close" title="Close" class="close">X</a>
<a href="#close" title="{{ gettext('Close') }}" class="close">X</a>
<h2>{{ gettext('Delete Confirmation') }}</h2>
<p>{{ gettext('Are you sure you want to delete the selected documents?') }}</p>
<a href="#close" id="cancel-selected-deletions" title="Cancel" class="btn sd-button">Cancel</a>
<button type="submit" name="action" value="confirm_delete" id="delete-selected" class="sd-button danger">Delete</button>
<a href="#close" id="cancel-selected-deletions" title="{{ gettext('Cancel') }}" class="btn sd-button">{{ gettext('Cancel') }}</a>
<button type="submit" name="action" value="confirm_delete" id="delete-selected" class="sd-button danger">{{ gettext('Delete') }}</button>
</div>
</div>

Expand Down Expand Up @@ -123,11 +123,11 @@ <h3><i class="fa fa-reply"></i> {{ gettext('Reply') }}</h3>
<div id="delete-collection-confirmation-modal" class="modal-dialog">
<a href="#close" class="external"></a>
<div>
<a href="#close" title="Close" class="close">X</a>
<a href="#close" title="{{ gettext('Close') }}" class="close">X</a>
<h2>{{ gettext('Delete Confirmation') }}</h2>
<p>{{ gettext('Are you sure you want to delete this collection?') }}</p>
<a href="#close" id="cancel-collection-deletions" title="Cancel" class="btn sd-button">Cancel</a>
<button type="submit" id="delete-collection-button" name="action" value="delete" class="sd-button danger">Delete</button>
<a href="#close" id="cancel-collection-deletions" title="{{ gettext('Cancel') }}" class="btn sd-button">{{ gettext('Cancel') }}</a>
<button type="submit" id="delete-collection-button" name="action" value="delete" class="sd-button danger">{{ gettext('Delete') }}</button>
</div>
</div>
</form>
Expand Down
6 changes: 3 additions & 3 deletions securedrop/journalist_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ <h1><span class="headline">{{ gettext('Sources') }}</span></h1>
<div id="delete-confirmation-modal" class="modal-dialog">
<a href="#close" class="external"></a>
<div>
<a href="#close" title="Close" class="close">X</a>
<a href="#close" title="{{ gettext('Close') }}" class="close">X</a>
<h2>{{ gettext('Delete Confirmation') }}</h2>
<p>{{ gettext('Are you sure you want to delete the selected collections?') }}</p>
<a href="#close" id="cancel-collections-deletions" title="Cancel" class="btn sd-button">Cancel</a>
<button type="submit" id="delete-collections" name="action" value="delete" class="sd-button danger">Delete</button>
<a href="#close" id="cancel-collections-deletions" title="{{ gettext('Cancel') }}" class="btn sd-button">{{ gettext('Cancel') }}</a>
<button type="submit" id="delete-collections" name="action" value="delete" class="sd-button danger">{{ gettext('Delete') }}</button>
</div>
</div>

Expand Down
18 changes: 9 additions & 9 deletions securedrop/tests/functional/journalist_navigation_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,31 @@ def _journalist_clicks_delete_selected_on_modal(self):
def _journalist_clicks_delete_collection_on_modal(self):
self.driver.find_element_by_id('delete-collection-button').click()

def _journalist_sees_delete_collections_confirmation_javascript(self):
def _journalist_sees_delete_collections_confirmation(self):
assert self.driver.find_element_by_id(
'delete-confirmation-modal').is_displayed()

def _journalist_sees_delete_selected_confirmation_javascript(self):
def _journalist_sees_delete_selected_confirmation(self):
assert self.driver.find_element_by_id(
'delete-selected-confirmation-modal').is_displayed()

def _journalist_sees_delete_collection_confirmation_javascript(self):
def _journalist_sees_delete_collection_confirmation(self):
assert self.driver.find_element_by_id(
'delete-collection-confirmation-modal').is_displayed()

def _journalist_clicks_delete_selected_link(self):
self.driver.find_element_by_id('delete-selected-link').click()
self._journalist_sees_delete_selected_confirmation_javascript()
self._journalist_sees_delete_selected_confirmation()

def _journalist_clicks_delete_collections_link(self):
self.driver.find_element_by_id('delete-collections-link').click()
self._journalist_sees_delete_collections_confirmation_javascript()
self._journalist_sees_delete_collections_confirmation()

def _journalist_clicks_delete_collection_link(self):
self.driver.find_element_by_id('delete-collection-link').click()
self._journalist_sees_delete_collection_confirmation_javascript()
self._journalist_sees_delete_collection_confirmation()

def _journalist_uses_delete_selected_button_javascript(self):
def _journalist_uses_delete_selected_button_confirmation(self):
self._journalist_selects_first_doc()
self._journalist_clicks_delete_selected_link()
self._journalist_clicks_delete_selected_cancel_on_modal()
Expand All @@ -131,7 +131,7 @@ def _journalist_uses_delete_selected_button_javascript(self):
assert selected_count > len(self.driver.find_elements_by_name(
'doc_names_selected'))

def _journalist_uses_delete_collection_button_javascript(self):
def _journalist_uses_delete_collection_button_confirmation(self):
self._journalist_clicks_delete_collection_link()
self._journalist_clicks_delete_collection_cancel_on_modal()

Expand All @@ -147,7 +147,7 @@ def _journalist_uses_delete_collection_button_javascript(self):
if not hasattr(self, 'accept-languages'):
assert "Sources" in self.driver.find_element_by_tag_name('h1').text

def _journalist_uses_delete_collections_button_javascript(self):
def _journalist_uses_delete_collections_button_confirmation(self):
self.driver.find_element_by_id('select_all').click()

self._journalist_clicks_delete_collections_link()
Expand Down
14 changes: 7 additions & 7 deletions securedrop/tests/functional/test_journalist.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestJournalist(
source_navigation_steps.SourceNavigationStepsMixin,
journalist_navigation_steps.JournalistNavigationStepsMixin):

def test_journalist_verifies_deletion_of_one_submission_javascript(self):
def test_journalist_verifies_deletion_of_one_submission_modal(self):
# This deletion button is displayed on the individual source page
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
Expand All @@ -34,9 +34,9 @@ def test_journalist_verifies_deletion_of_one_submission_javascript(self):
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_uses_delete_selected_button_javascript()
self._journalist_uses_delete_selected_button_confirmation()

def test_journalist_uses_col_delete_collection_button_javascript(self):
def test_journalist_uses_col_delete_collection_button_modal(self):
# This delete button is displayed on the individual source page
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
Expand All @@ -45,19 +45,19 @@ def test_journalist_uses_col_delete_collection_button_javascript(self):
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_uses_delete_collection_button_javascript()
self._journalist_uses_delete_collection_button_confirmation()

def test_journalist_uses_index_delete_collections_button_javascript(self):
def test_journalist_uses_index_delete_collections_button_modal(self):
# This deletion button is displayed on the index page
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
self._source_submits_a_file()
self._source_logs_out()
self._journalist_logs_in()
self._journalist_uses_delete_collections_button_javascript()
self._journalist_uses_delete_collections_button_confirmation()

def test_journalist_interface_ui_with_javascript(self):
def test_journalist_interface_ui_with_modal(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
Expand Down

0 comments on commit 51e8472

Please sign in to comment.