diff options
Diffstat (limited to 'desktop/tests/gui_base_test.py')
-rw-r--r-- | desktop/tests/gui_base_test.py | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/desktop/tests/gui_base_test.py b/desktop/tests/gui_base_test.py index ac2dfc54..6fb4fc32 100644 --- a/desktop/tests/gui_base_test.py +++ b/desktop/tests/gui_base_test.py @@ -270,10 +270,32 @@ 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 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 +304,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 +318,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,9 +388,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.client_auth_instructions.isVisible() + ) self.assertFalse( tab.get_mode().server_status.copy_client_auth_button.isVisible() ) + self.assertFalse( + tab.get_mode().server_status.show_client_auth_qr_code_button.isVisible() + ) def web_server_is_stopped(self, tab): """Test that the web server also stopped""" |