mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-24 21:46:43 -05:00
Fix base GUI test to take account that the macOS version has separate Add Files and Add Folder
This commit is contained in:
parent
9e9dfb86e3
commit
1a6c2f3d63
@ -8,6 +8,7 @@ import shutil
|
||||
import base64
|
||||
import tempfile
|
||||
import secrets
|
||||
import platform
|
||||
|
||||
from PyQt5 import QtCore, QtTest, QtWidgets
|
||||
|
||||
@ -275,9 +276,17 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def add_button_visible(self, tab):
|
||||
"""Test that the add button should be visible"""
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
if platform.system() == "Darwin":
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_files_button.isVisible()
|
||||
)
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_folder_button.isVisible()
|
||||
)
|
||||
else:
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
|
||||
def url_description_shown(self, tab):
|
||||
"""Test that the URL label is showing"""
|
||||
@ -299,7 +308,10 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def have_show_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())
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.show_url_qr_code_button.isVisible()
|
||||
)
|
||||
|
||||
def accept_dialog():
|
||||
window = tab.common.gui.qtapp.activeWindow()
|
||||
if window:
|
||||
@ -358,11 +370,15 @@ class GuiBaseTest(unittest.TestCase):
|
||||
):
|
||||
tab.get_mode().server_status.server_button.click()
|
||||
self.assertEqual(tab.get_mode().server_status.status, 0)
|
||||
self.assertFalse(tab.get_mode().server_status.show_url_qr_code_button.isVisible())
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.show_url_qr_code_button.isVisible()
|
||||
)
|
||||
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.copy_hidservauth_button.isVisible())
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.copy_hidservauth_button.isVisible()
|
||||
)
|
||||
|
||||
def web_server_is_stopped(self, tab):
|
||||
"""Test that the web server also stopped"""
|
||||
@ -406,9 +422,17 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def add_remove_buttons_hidden(self, tab):
|
||||
"""Test that the add and remove buttons are hidden when the server starts"""
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
if platform.system() == "Darwin":
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_files_button.isVisible()
|
||||
)
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_folder_button.isVisible()
|
||||
)
|
||||
else:
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.remove_button.isVisible()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user