Skip to content

Commit

Permalink
Merge pull request #6100 from freedomofpress/6090-split-up-page-layou…
Browse files Browse the repository at this point in the history
…t-tests

splits up `app-page-layout-tests` for more-efficient parallelization
  • Loading branch information
conorsch authored Sep 22, 2021
2 parents 9688dbc + 88420ff commit fc963c8
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 278 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
environment:
DOCKER_API_VERSION: 1.23
BASE_OS: focal
parallelism: 2
parallelism: 5
steps:
- checkout
- *rebaseontarget
Expand Down
232 changes: 0 additions & 232 deletions securedrop/tests/pageslayout/test_journalist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time

import pytest

from tests.functional import journalist_navigation_steps
Expand All @@ -30,148 +28,11 @@ class TestJournalistLayout(
source_navigation_steps.SourceNavigationStepsMixin,
journalist_navigation_steps.JournalistNavigationStepsMixin):

def test_account_edit_hotp_secret(self):
self._journalist_logs_in()
self._visit_edit_account()
self._visit_edit_hotp_secret()
self._screenshot('journalist-account_edit_hotp_secret.png')
self._save_html('journalist-account_edit_hotp_secret.html')

def test_account_new_two_factor_hotp(self):
self._journalist_logs_in()
self._visit_edit_account()
self._visit_edit_hotp_secret()
self._set_hotp_secret()
self._screenshot('journalist-account_new_two_factor_hotp.png')
self._save_html('journalist-account_new_two_factor_hotp.html')

def test_account_new_two_factor_totp(self):
self._journalist_logs_in()
self._visit_edit_account()
self._visit_edit_totp_secret()
self._screenshot('journalist-account_new_two_factor_totp.png')
self._save_html('journalist-account_new_two_factor_totp.html')

def test_admin_add_user_hotp(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_visits_add_user()
self._admin_enters_journalist_account_details_hotp(
'journalist2',
'c4 26 43 52 69 13 02 49 9f 6a a5 33 96 46 d9 05 42 a3 4f ae'
)
self._screenshot('journalist-admin_add_user_hotp.png')
self._save_html('journalist-admin_add_user_hotp.html')

def test_admin_add_user_totp(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_visits_add_user()
self._screenshot('journalist-admin_add_user_totp.png')
self._save_html('journalist-admin_add_user_totp.html')

def test_admin_edit_hotp_secret(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_adds_a_user()
self._admin_visits_edit_user()
self._admin_visits_reset_2fa_hotp()
self._screenshot('journalist-admin_edit_hotp_secret.png')
self._save_html('journalist-admin_edit_hotp_secret.html')

def test_admin_edit_totp_secret(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_adds_a_user()
self._admin_visits_edit_user()
self._admin_visits_reset_2fa_totp()
self._screenshot('journalist-admin_edit_totp_secret.png')
self._save_html('journalist-admin_edit_totp_secret.html')

def test_login(self):
self.driver.get(self.journalist_location + "/login")
self._screenshot('journalist-login.png')
self._save_html('journalist-login.html')

def test_admin(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_adds_a_user()
self._screenshot('journalist-admin.png')
self._save_html('journalist-admin.html')

def test_admin_new_user_two_factor_hotp(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
valid_hotp = '1234567890123456789012345678901234567890'
self._admin_creates_a_user(hotp=valid_hotp)
self._screenshot('journalist-admin_new_user_two_factor_hotp.png')
self._save_html('journalist-admin_new_user_two_factor_hotp.html')

def test_admin_new_user_two_factor_totp(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_creates_a_user(hotp=None)
self._screenshot('journalist-admin_new_user_two_factor_totp.png')
self._save_html('journalist-admin_new_user_two_factor_totp.html')

def test_admin_changes_logo(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_visits_system_config_page()
self._screenshot('journalist-admin_system_config_page.png')
self._save_html('journalist-admin_system_config_page.html')
self._admin_updates_logo_image()
self._screenshot('journalist-admin_changes_logo_image.png')
self._save_html('journalist-admin_changes_logo_image.html')

def test_col_no_documents(self):
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_visits_col()
self._journalist_delete_all()
self._journalist_confirm_delete_selected()
self._screenshot('journalist-col_no_document.png')
self._save_html('journalist-col_no_document.html')

def test_col_has_no_key(self):
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._source_delete_key()
self._journalist_visits_col()
self._screenshot('journalist-col_has_no_key.png')
self._save_html('journalist-col_has_no_key.html')

def test_col(self):
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_visits_col()
self._screenshot('journalist-col.png')
self._save_html('journalist-col.html')

def test_col_javascript(self):
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_visits_col()
self._screenshot('journalist-col_javascript.png')
self._save_html('journalist-col_javascript.html')

def test_journalist_composes_reply(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
Expand All @@ -185,110 +46,17 @@ def test_journalist_composes_reply(self):
self._screenshot('journalist-composes_reply.png')
self._save_html('journalist-composes_reply.html')

def test_admin_uses_ossec_alert_button(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_visits_system_config_page()
self._admin_can_send_test_alert()
self._screenshot('journalist-admin_ossec_alert_button.png')
self._save_html('journalist-admin_ossec_alert_button.html')

def test_delete_none(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
self._source_submits_a_file()
self._source_submits_a_message()
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_clicks_delete_selected_link()
self._journalist_confirm_delete_selected()
self._screenshot('journalist-delete_none.png')
self._save_html('journalist-delete_none.html')

def test_delete_one_confirmation(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
self._source_submits_a_file()
self._source_submits_a_message()
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_selects_first_doc()
self._journalist_clicks_delete_selected_link()
time.sleep(1)
self._screenshot('journalist-delete_one_confirmation.png')
self._save_html('journalist-delete_one_confirmation.html')

def test_delete_all_confirmation(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
self._source_submits_a_file()
self._source_submits_a_message()
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_delete_all_confirmation()
time.sleep(1)
self._screenshot('journalist-delete_all_confirmation.png')
self._save_html('journalist-delete_all_confirmation.html')

def test_delete_one(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
self._source_submits_a_file()
self._source_submits_a_message()
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_delete_one()
self._journalist_confirm_delete_selected()
self._screenshot('journalist-delete_one.png')
self._save_html('journalist-delete_one.html')

def test_delete_all(self):
self._source_visits_source_homepage()
self._source_chooses_to_submit_documents()
self._source_continues_to_submit_page()
self._source_submits_a_file()
self._source_submits_a_message()
self._source_logs_out()
self._journalist_logs_in()
self._journalist_visits_col()
self._journalist_delete_all()
self._journalist_confirm_delete_selected()
self._screenshot('journalist-delete_all.png')
self._save_html('journalist-delete_all.html')

def test_edit_account_user(self):
self._journalist_logs_in()
self._visit_edit_account()
self._screenshot('journalist-edit_account_user.png')
self._save_html('journalist-edit_account_user.html')

def test_edit_account_admin(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._admin_adds_a_user()
self._admin_visits_edit_user()
self._screenshot('journalist-edit_account_admin.png')
self._save_html('journalist-edit_account_admin.html')

def test_index_no_documents_admin(self):
self._admin_logs_in()
self._screenshot('journalist-admin_index_no_documents.png')
self._save_html('journalist-admin_index_no_documents.html')

def test_admin_interface_index(self):
self._admin_logs_in()
self._admin_visits_admin_interface()
self._screenshot('journalist-admin_interface_index.png')
self._save_html('journalist-admin_interface_index.html')

def test_index_no_documents(self):
self._journalist_logs_in()
self._screenshot('journalist-index_no_documents.png')
Expand Down
51 changes: 51 additions & 0 deletions securedrop/tests/pageslayout/test_journalist_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# SecureDrop whistleblower submission system
# Copyright (C) 2017 Loic Dachary <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import pytest

from tests.functional import journalist_navigation_steps
from tests.functional import source_navigation_steps
import tests.pageslayout.functional_test as pft


@pytest.mark.pagelayout
class TestJournalistLayoutAccount(
pft.FunctionalTest,
source_navigation_steps.SourceNavigationStepsMixin,
journalist_navigation_steps.JournalistNavigationStepsMixin):

def test_account_edit_hotp_secret(self):
self._journalist_logs_in()
self._visit_edit_account()
self._visit_edit_hotp_secret()
self._screenshot('journalist-account_edit_hotp_secret.png')
self._save_html('journalist-account_edit_hotp_secret.html')

def test_account_new_two_factor_hotp(self):
self._journalist_logs_in()
self._visit_edit_account()
self._visit_edit_hotp_secret()
self._set_hotp_secret()
self._screenshot('journalist-account_new_two_factor_hotp.png')
self._save_html('journalist-account_new_two_factor_hotp.html')

def test_account_new_two_factor_totp(self):
self._journalist_logs_in()
self._visit_edit_account()
self._visit_edit_totp_secret()
self._screenshot('journalist-account_new_two_factor_totp.png')
self._save_html('journalist-account_new_two_factor_totp.html')
Loading

0 comments on commit fc963c8

Please sign in to comment.