diff options
author | Miguel Jacq <mig@mig5.net> | 2021-08-31 14:17:23 +1000 |
---|---|---|
committer | Miguel Jacq <mig@mig5.net> | 2021-08-31 14:17:23 +1000 |
commit | cb144e218aa60fcd05435a37df88934ea36a0268 (patch) | |
tree | 3fab7353a63216673ee32213af70a4e93e4f77e5 /desktop/tests | |
parent | 3a07bbe16126c6b14fc7ff553d2ef441e959a333 (diff) | |
download | onionshare-cb144e218aa60fcd05435a37df88934ea36a0268.tar.gz onionshare-cb144e218aa60fcd05435a37df88934ea36a0268.zip |
Client Auth UX improvements
Diffstat (limited to 'desktop/tests')
-rw-r--r-- | desktop/tests/gui_base_test.py | 59 | ||||
-rw-r--r-- | desktop/tests/test_gui_chat.py | 7 | ||||
-rw-r--r-- | desktop/tests/test_gui_receive.py | 7 | ||||
-rw-r--r-- | desktop/tests/test_gui_share.py | 7 | ||||
-rw-r--r-- | desktop/tests/test_gui_website.py | 7 |
5 files changed, 82 insertions, 5 deletions
diff --git a/desktop/tests/gui_base_test.py b/desktop/tests/gui_base_test.py index ac2dfc54..83ad5fa3 100644 --- a/desktop/tests/gui_base_test.py +++ b/desktop/tests/gui_base_test.py @@ -270,10 +270,39 @@ class GuiBaseTest(unittest.TestCase): tab.get_mode().server_status.file_selection.add_button.isVisible() ) + def url_shown(self, tab): + """Test that the URL is showing""" + self.assertTrue(tab.get_mode().server_status.url.isVisible()) + def url_description_shown(self, tab): """Test that the URL label is showing""" self.assertTrue(tab.get_mode().server_status.url_description.isVisible()) + def url_instructions_shown(self, tab): + """Test that the URL instructions for sharing are showing""" + self.assertTrue(tab.get_mode().server_status.url_instructions.isVisible()) + + def private_key_shown(self, tab): + """Test that the Private Key is showing when not in public mode""" + if not tab.settings.get("general", "public"): + self.assertTrue(tab.get_mode().server_status.private_key.isVisible()) + else: + self.assertFalse(tab.get_mode().server_status.private_key.isVisible()) + + def client_auth_instructions_shown(self, tab): + """ + Test that the Private Key instructions for sharing + are showing when not in public mode + """ + if not tab.settings.get("general", "public"): + self.assertTrue( + tab.get_mode().server_status.client_auth_instructions.isVisible() + ) + else: + self.assertFalse( + tab.get_mode().server_status.client_auth_instructions.isVisible() + ) + def have_copy_url_button(self, tab): """Test that the Copy URL button is shown and that the clipboard is correct""" self.assertTrue(tab.get_mode().server_status.copy_url_button.isVisible()) @@ -282,7 +311,7 @@ class GuiBaseTest(unittest.TestCase): clipboard = tab.common.gui.qtapp.clipboard() self.assertEqual(clipboard.text(), f"http://127.0.0.1:{tab.app.port}") - def have_show_qr_code_button(self, tab): + def have_show_url_qr_code_button(self, tab): """Test that the Show QR Code URL button is shown and that it loads a QR Code Dialog""" self.assertTrue( tab.get_mode().server_status.show_url_qr_code_button.isVisible() @@ -296,6 +325,28 @@ class GuiBaseTest(unittest.TestCase): QtCore.QTimer.singleShot(500, accept_dialog) tab.get_mode().server_status.show_url_qr_code_button.click() + def have_show_client_auth_qr_code_button(self, tab): + """ + Test that the Show QR Code Client Auth button is shown when + not in public mode and that it loads a QR Code Dialog. + """ + if not tab.settings.get("general", "public"): + self.assertTrue( + tab.get_mode().server_status.show_client_auth_qr_code_button.isVisible() + ) + + def accept_dialog(): + window = tab.common.gui.qtapp.activeWindow() + if window: + window.close() + + QtCore.QTimer.singleShot(500, accept_dialog) + tab.get_mode().server_status.show_client_auth_qr_code_button.click() + else: + self.assertFalse( + tab.get_mode().server_status.show_client_auth_qr_code_button.isVisible() + ) + def server_status_indicator_says_started(self, tab): """Test that the Server Status indicator shows we are started""" if type(tab.get_mode()) == ReceiveMode: @@ -344,10 +395,16 @@ class GuiBaseTest(unittest.TestCase): self.assertFalse(tab.get_mode().server_status.copy_url_button.isVisible()) self.assertFalse(tab.get_mode().server_status.url.isVisible()) self.assertFalse(tab.get_mode().server_status.url_description.isVisible()) + self.assertFalse(tab.get_mode().server_status.url_instructions.isVisible()) + self.assertFalse(tab.get_mode().server_status.private_key.isVisible()) + self.assertFalse( + tab.get_mode().server_status.client_auth_instructions.isVisible() + ) self.assertFalse( tab.get_mode().server_status.copy_client_auth_button.isVisible() ) + def web_server_is_stopped(self, tab): """Test that the web server also stopped""" QtTest.QTest.qWait(800, self.gui.qtapp) diff --git a/desktop/tests/test_gui_chat.py b/desktop/tests/test_gui_chat.py index 246a4494..786782f7 100644 --- a/desktop/tests/test_gui_chat.py +++ b/desktop/tests/test_gui_chat.py @@ -37,8 +37,13 @@ class TestChat(GuiBaseTest): self.server_is_started(tab, startup_time=500) self.web_server_is_running(tab) self.url_description_shown(tab) + self.url_instructions_shown(tab) + self.url_shown(tab) self.have_copy_url_button(tab) - self.have_show_qr_code_button(tab) + self.have_show_url_qr_code_button(tab) + self.private_key_shown(tab) + self.client_auth_instructions_shown(tab) + self.have_show_client_auth_qr_code_button(tab) self.server_status_indicator_says_started(tab) def run_all_chat_mode_stopping_tests(self, tab): diff --git a/desktop/tests/test_gui_receive.py b/desktop/tests/test_gui_receive.py index af04a914..ca69c957 100644 --- a/desktop/tests/test_gui_receive.py +++ b/desktop/tests/test_gui_receive.py @@ -110,8 +110,13 @@ class TestReceive(GuiBaseTest): self.server_is_started(tab) self.web_server_is_running(tab) self.url_description_shown(tab) + self.url_instructions_shown(tab) + self.url_shown(tab) self.have_copy_url_button(tab) - self.have_show_qr_code_button(tab) + self.have_show_url_qr_code_button(tab) + self.client_auth_instructions_shown(tab) + self.private_key_shown(tab) + self.have_show_client_auth_qr_code_button(tab) self.server_status_indicator_says_started(tab) def run_all_receive_mode_tests(self, tab): diff --git a/desktop/tests/test_gui_share.py b/desktop/tests/test_gui_share.py index b7a66a81..d3536569 100644 --- a/desktop/tests/test_gui_share.py +++ b/desktop/tests/test_gui_share.py @@ -182,8 +182,13 @@ class TestShare(GuiBaseTest): self.server_is_started(tab, startup_time) self.web_server_is_running(tab) self.url_description_shown(tab) + self.url_instructions_shown(tab) + self.url_shown(tab) self.have_copy_url_button(tab) - self.have_show_qr_code_button(tab) + self.have_show_url_qr_code_button(tab) + self.private_key_shown(tab) + self.client_auth_instructions_shown(tab) + self.have_show_client_auth_qr_code_button(tab) self.server_status_indicator_says_started(tab) def run_all_share_mode_download_tests(self, tab): diff --git a/desktop/tests/test_gui_website.py b/desktop/tests/test_gui_website.py index d7a75ed6..e736874a 100644 --- a/desktop/tests/test_gui_website.py +++ b/desktop/tests/test_gui_website.py @@ -46,8 +46,13 @@ class TestWebsite(GuiBaseTest): self.server_is_started(tab, startup_time) self.web_server_is_running(tab) self.url_description_shown(tab) + self.url_instructions_shown(tab) + self.url_shown(tab) self.have_copy_url_button(tab) - self.have_show_qr_code_button(tab) + self.have_show_url_qr_code_button(tab) + self.client_auth_instructions_shown(tab) + self.private_key_shown(tab) + self.have_show_client_auth_qr_code_button(tab) self.server_status_indicator_says_started(tab) def run_all_website_mode_download_tests(self, tab): |