Merge branch '780_improved_ui' into 690_language_dropdown

This commit is contained in:
Micah Lee 2018-10-10 18:32:01 -07:00
commit 5db8bd36b9
41 changed files with 1363 additions and 1025 deletions

View file

@ -0,0 +1 @@
from .commontests import CommonTests

View file

@ -73,54 +73,75 @@ class CommonTests(object):
'''Test that the status bar is visible'''
self.assertTrue(self.gui.status_bar.isVisible())
def test_info_widget_is_not_visible(self, mode):
'''Test that the info widget along top of screen is not shown'''
if mode == 'receive':
self.assertFalse(self.gui.receive_mode.info_widget.isVisible())
if mode == 'share':
self.assertFalse(self.gui.share_mode.info_widget.isVisible())
def test_info_widget_is_visible(self, mode):
'''Test that the info widget along top of screen is shown'''
if mode == 'receive':
self.assertTrue(self.gui.receive_mode.info_widget.isVisible())
if mode == 'share':
self.assertTrue(self.gui.share_mode.info_widget.isVisible())
def test_click_mode(self, mode):
'''Test that we can switch Mode by clicking the button'''
if mode == 'receive':
if type(mode) == ReceiveMode:
QtTest.QTest.mouseClick(self.gui.receive_mode_button, QtCore.Qt.LeftButton)
self.assertTrue(self.gui.mode, self.gui.MODE_RECEIVE)
if mode == 'share':
if type(mode) == ShareMode:
QtTest.QTest.mouseClick(self.gui.share_mode_button, QtCore.Qt.LeftButton)
self.assertTrue(self.gui.mode, self.gui.MODE_SHARE)
def test_click_toggle_history(self, mode):
'''Test that we can toggle Download or Upload history by clicking the toggle button'''
currently_visible = mode.history.isVisible()
QtTest.QTest.mouseClick(mode.toggle_history, QtCore.Qt.LeftButton)
self.assertEqual(mode.history.isVisible(), not currently_visible)
def test_history_indicator(self, mode, public_mode):
'''Test that we can make sure the history is toggled off, do an action, and the indiciator works'''
# Make sure history is toggled off
if mode.history.isVisible():
QtTest.QTest.mouseClick(mode.toggle_history, QtCore.Qt.LeftButton)
self.assertFalse(mode.history.isVisible())
# Indicator should not be visible yet
self.assertFalse(mode.toggle_history.indicator_label.isVisible())
if type(mode) == ReceiveMode:
# Upload a file
files = {'file[]': open('/tmp/test.txt', 'rb')}
if not public_mode:
path = 'http://127.0.0.1:{}/{}/upload'.format(self.gui.app.port, mode.web.slug)
else:
path = 'http://127.0.0.1:{}/upload'.format(self.gui.app.port)
response = requests.post(path, files=files)
QtTest.QTest.qWait(2000)
if type(mode) == ShareMode:
# Download files
if public_mode:
url = "http://127.0.0.1:{}/download".format(self.gui.app.port)
else:
url = "http://127.0.0.1:{}/{}/download".format(self.gui.app.port, self.gui.share_mode.web.slug)
r = requests.get(url)
QtTest.QTest.qWait(2000)
# Indicator should be visible, have a value of "1"
self.assertTrue(mode.toggle_history.indicator_label.isVisible())
self.assertEqual(mode.toggle_history.indicator_label.text(), "1")
# Toggle history back on, indicator should be hidden again
QtTest.QTest.mouseClick(mode.toggle_history, QtCore.Qt.LeftButton)
self.assertFalse(mode.toggle_history.indicator_label.isVisible())
def test_history_is_not_visible(self, mode):
'''Test that the History section is not visible'''
self.assertFalse(mode.history.isVisible())
def test_history_is_visible(self, mode):
'''Test that the History section is visible and that the relevant widget is present'''
if mode == 'receive':
self.assertTrue(self.gui.receive_mode.uploads.isVisible())
self.assertTrue(self.gui.receive_mode.uploads.no_uploads_label.isVisible())
if mode == 'share':
self.assertTrue(self.gui.share_mode.downloads.isVisible())
self.assertTrue(self.gui.share_mode.downloads.no_downloads_label.isVisible())
'''Test that the History section is visible'''
self.assertTrue(mode.history.isVisible())
def test_server_working_on_start_button_pressed(self, mode):
'''Test we can start the service'''
# Should be in SERVER_WORKING state
if mode == 'receive':
QtTest.QTest.mouseClick(self.gui.receive_mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEqual(self.gui.receive_mode.server_status.status, 1)
if mode == 'share':
QtTest.QTest.mouseClick(self.gui.share_mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEqual(self.gui.share_mode.server_status.status, 1)
QtTest.QTest.mouseClick(mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEqual(mode.server_status.status, 1)
def test_server_status_indicator_says_starting(self, mode):
'''Test that the Server Status indicator shows we are Starting'''
if mode == 'receive':
self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_share_working'))
if mode == 'share':
self.assertEquals(self.gui.share_mode.server_status_label.text(), strings._('gui_status_indicator_share_working'))
self.assertEquals(mode.server_status_label.text(), strings._('gui_status_indicator_share_working'))
def test_settings_button_is_hidden(self):
'''Test that the settings button is hidden when the server starts'''
@ -130,10 +151,7 @@ class CommonTests(object):
'''Test that the server has started'''
QtTest.QTest.qWait(2000)
# Should now be in SERVER_STARTED state
if mode == 'receive':
self.assertEqual(self.gui.receive_mode.server_status.status, 2)
if mode == 'share':
self.assertEqual(self.gui.share_mode.server_status.status, 2)
self.assertEqual(mode.server_status.status, 2)
def test_a_web_server_is_running(self):
'''Test that the web server has started'''
@ -143,38 +161,26 @@ class CommonTests(object):
def test_have_a_slug(self, mode, public_mode):
'''Test that we have a valid slug'''
if mode == 'receive':
if not public_mode:
self.assertRegex(self.gui.receive_mode.server_status.web.slug, r'(\w+)-(\w+)')
else:
self.assertIsNone(self.gui.receive_mode.server_status.web.slug, r'(\w+)-(\w+)')
if mode == 'share':
if not public_mode:
self.assertRegex(self.gui.share_mode.server_status.web.slug, r'(\w+)-(\w+)')
else:
self.assertIsNone(self.gui.share_mode.server_status.web.slug, r'(\w+)-(\w+)')
if not public_mode:
self.assertRegex(mode.server_status.web.slug, r'(\w+)-(\w+)')
else:
self.assertIsNone(mode.server_status.web.slug, r'(\w+)-(\w+)')
def test_url_description_shown(self, mode):
'''Test that the URL label is showing'''
if mode == 'receive':
self.assertTrue(self.gui.receive_mode.server_status.url_description.isVisible())
if mode == 'share':
self.assertTrue(self.gui.share_mode.server_status.url_description.isVisible())
self.assertTrue(mode.server_status.url_description.isVisible())
def test_have_copy_url_button(self, mode):
'''Test that the Copy URL button is shown'''
if mode == 'receive':
self.assertTrue(self.gui.receive_mode.server_status.copy_url_button.isVisible())
if mode == 'share':
self.assertTrue(self.gui.share_mode.server_status.copy_url_button.isVisible())
self.assertTrue(mode.server_status.copy_url_button.isVisible())
def test_server_status_indicator_says_started(self, mode):
'''Test that the Server Status indicator shows we are started'''
if mode == 'receive':
self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_receive_started'))
if mode == 'share':
self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_share_started'))
if type(mode) == ReceiveMode:
self.assertEquals(mode.server_status_label.text(), strings._('gui_status_indicator_receive_started'))
if type(mode) == ShareMode:
self.assertEquals(mode.server_status_label.text(), strings._('gui_status_indicator_share_started'))
def test_web_page(self, mode, string, public_mode):
'''Test that the web page contains a string'''
@ -183,10 +189,7 @@ class CommonTests(object):
s.connect(('127.0.0.1', self.gui.app.port))
if not public_mode:
if mode == 'receive':
path = '/{}'.format(self.gui.receive_mode.server_status.web.slug)
if mode == 'share':
path = '/{}'.format(self.gui.share_mode.server_status.web.slug)
path = '/{}'.format(mode.server_status.web.slug)
else:
path = '/'
@ -209,29 +212,18 @@ class CommonTests(object):
def test_history_widgets_present(self, mode):
'''Test that the relevant widgets are present in the history view after activity has taken place'''
if mode == 'receive':
self.assertFalse(self.gui.receive_mode.uploads.no_uploads_label.isVisible())
self.assertTrue(self.gui.receive_mode.uploads.clear_history_button.isVisible())
if mode == 'share':
self.assertFalse(self.gui.share_mode.downloads.no_downloads_label.isVisible())
self.assertTrue(self.gui.share_mode.downloads.clear_history_button.isVisible())
self.assertFalse(mode.history.empty.isVisible())
self.assertTrue(mode.history.not_empty.isVisible())
def test_counter_incremented(self, mode, count):
'''Test that the counter has incremented'''
if mode == 'receive':
self.assertEqual(self.gui.receive_mode.uploads_completed, count)
if mode == 'share':
self.assertEqual(self.gui.share_mode.downloads_completed, count)
self.assertEquals(mode.history.completed_count, count)
def test_server_is_stopped(self, mode, stay_open):
'''Test that the server stops when we click Stop'''
if mode == 'receive':
QtTest.QTest.mouseClick(self.gui.receive_mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEqual(self.gui.receive_mode.server_status.status, 0)
if mode == 'share':
if stay_open:
QtTest.QTest.mouseClick(self.gui.share_mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEqual(self.gui.share_mode.server_status.status, 0)
if type(mode) == ReceiveMode or (type(mode) == ShareMode and stay_open):
QtTest.QTest.mouseClick(mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEquals(mode.server_status.status, 0)
def test_web_service_is_stopped(self):
'''Test that the web server also stopped'''
@ -243,9 +235,9 @@ class CommonTests(object):
def test_server_status_indicator_says_closed(self, mode, stay_open):
'''Test that the Server Status indicator shows we closed'''
if mode == 'receive':
self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_receive_stopped'))
if mode == 'share':
if type(mode) == ReceiveMode:
self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_receive_stopped', True))
if type(mode) == ShareMode:
if stay_open:
self.assertEquals(self.gui.share_mode.server_status_label.text(), strings._('gui_status_indicator_share_stopped'))
else:
@ -255,28 +247,18 @@ class CommonTests(object):
def test_set_timeout(self, mode, timeout):
'''Test that the timeout can be set'''
timer = QtCore.QDateTime.currentDateTime().addSecs(timeout)
if mode == 'receive':
self.gui.receive_mode.server_status.shutdown_timeout.setDateTime(timer)
self.assertTrue(self.gui.receive_mode.server_status.shutdown_timeout.dateTime(), timer)
if mode == 'share':
self.gui.share_mode.server_status.shutdown_timeout.setDateTime(timer)
self.assertTrue(self.gui.share_mode.server_status.shutdown_timeout.dateTime(), timer)
mode.server_status.shutdown_timeout.setDateTime(timer)
self.assertTrue(mode.server_status.shutdown_timeout.dateTime(), timer)
def test_timeout_widget_hidden(self, mode):
'''Test that the timeout widget is hidden when share has started'''
if mode == 'receive':
self.assertFalse(self.gui.receive_mode.server_status.shutdown_timeout_container.isVisible())
if mode == 'share':
self.assertFalse(self.gui.share_mode.server_status.shutdown_timeout_container.isVisible())
self.assertFalse(mode.server_status.shutdown_timeout_container.isVisible())
def test_server_timed_out(self, mode, wait):
'''Test that the server has timed out after the timer ran out'''
QtTest.QTest.qWait(wait)
# We should have timed out now
if mode == 'receive':
self.assertEqual(self.gui.receive_mode.server_status.status, 0)
if mode == 'share':
self.assertEqual(self.gui.share_mode.server_status.status, 0)
self.assertEqual(mode.server_status.status, 0)
# Receive-specific tests
def test_upload_file(self, public_mode, expected_file):

View file

@ -43,25 +43,29 @@ class OnionShareGuiTest(unittest.TestCase):
def test_server_status_bar_is_visible(self):
CommonTests.test_server_status_bar_is_visible(self)
@pytest.mark.run(order=5)
def test_info_widget_is_not_visible(self):
CommonTests.test_info_widget_is_not_visible(self, 'receive')
@pytest.mark.run(order=6)
def test_click_mode(self):
CommonTests.test_click_mode(self, 'receive')
CommonTests.test_click_mode(self, self.gui.receive_mode)
@pytest.mark.run(order=6)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.receive_mode)
@pytest.mark.run(order=7)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, self.gui.receive_mode)
@pytest.mark.run(order=8)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'receive')
CommonTests.test_history_is_visible(self, self.gui.receive_mode)
@pytest.mark.run(order=8)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'receive')
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.receive_mode)
@pytest.mark.run(order=9)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'receive')
CommonTests.test_server_status_indicator_says_starting(self, self.gui.receive_mode)
@pytest.mark.run(order=10)
def test_settings_button_is_hidden(self):
@ -69,7 +73,7 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=11)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'receive')
CommonTests.test_a_server_is_started(self, self.gui.receive_mode)
@pytest.mark.run(order=12)
def test_a_web_server_is_running(self):
@ -77,23 +81,23 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=14)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'receive', False)
CommonTests.test_have_a_slug(self, self.gui.receive_mode, False)
@pytest.mark.run(order=15)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'receive')
CommonTests.test_url_description_shown(self, self.gui.receive_mode)
@pytest.mark.run(order=16)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'receive')
CommonTests.test_have_copy_url_button(self, self.gui.receive_mode)
@pytest.mark.run(order=17)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'receive')
CommonTests.test_server_status_indicator_says_started(self, self.gui.receive_mode)
@pytest.mark.run(order=18)
def test_web_page(self):
CommonTests.test_web_page(self, 'receive', 'Select the files you want to send, then click', False)
CommonTests.test_web_page(self, self.gui.receive_mode, 'Select the files you want to send, then click', False)
@pytest.mark.run(order=19)
def test_upload_file(self):
@ -101,11 +105,11 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=20)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'receive')
CommonTests.test_history_widgets_present(self, self.gui.receive_mode)
@pytest.mark.run(order=21)
def test_counter_incremented(self):
CommonTests.test_counter_incremented(self, 'receive', 1)
CommonTests.test_counter_incremented(self, self.gui.receive_mode, 1)
@pytest.mark.run(order=22)
def test_upload_same_file_is_renamed(self):
@ -113,19 +117,23 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=23)
def test_upload_count_incremented_again(self):
CommonTests.test_counter_incremented(self, 'receive', 2)
CommonTests.test_counter_incremented(self, self.gui.receive_mode, 2)
@pytest.mark.run(order=24)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'receive', False)
def test_history_indicator(self):
CommonTests.test_history_indicator(self, self.gui.receive_mode, False)
@pytest.mark.run(order=25)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, self.gui.receive_mode, False)
@pytest.mark.run(order=26)
def test_web_service_is_stopped(self):
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=26)
@pytest.mark.run(order=27)
def test_server_status_indicator_says_closed(self):
CommonTests.test_server_status_indicator_says_closed(self, 'receive', False)
CommonTests.test_server_status_indicator_says_closed(self, self.gui.receive_mode, False)
if __name__ == "__main__":
unittest.main()

View file

@ -45,56 +45,60 @@ class OnionShareGuiTest(unittest.TestCase):
CommonTests.test_server_status_bar_is_visible(self)
@pytest.mark.run(order=5)
def test_info_widget_is_not_visible(self):
CommonTests.test_info_widget_is_not_visible(self, 'receive')
def test_click_mode(self):
CommonTests.test_click_mode(self, self.gui.receive_mode)
@pytest.mark.run(order=6)
def test_click_mode(self):
CommonTests.test_click_mode(self, 'receive')
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.receive_mode)
@pytest.mark.run(order=7)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'receive')
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, self.gui.receive_mode)
@pytest.mark.run(order=8)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'receive')
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, self.gui.receive_mode)
@pytest.mark.run(order=9)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'receive')
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.receive_mode)
@pytest.mark.run(order=10)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, self.gui.receive_mode)
@pytest.mark.run(order=11)
def test_settings_button_is_hidden(self):
CommonTests.test_settings_button_is_hidden(self)
@pytest.mark.run(order=11)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'receive')
@pytest.mark.run(order=12)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, self.gui.receive_mode)
@pytest.mark.run(order=13)
def test_a_web_server_is_running(self):
CommonTests.test_a_web_server_is_running(self)
@pytest.mark.run(order=14)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'receive', True)
CommonTests.test_have_a_slug(self, self.gui.receive_mode, True)
@pytest.mark.run(order=15)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'receive')
CommonTests.test_url_description_shown(self, self.gui.receive_mode)
@pytest.mark.run(order=16)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'receive')
CommonTests.test_have_copy_url_button(self, self.gui.receive_mode)
@pytest.mark.run(order=17)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'receive')
CommonTests.test_server_status_indicator_says_started(self, self.gui.receive_mode)
@pytest.mark.run(order=18)
def test_web_page(self):
CommonTests.test_web_page(self, 'receive', 'Select the files you want to send, then click', True)
CommonTests.test_web_page(self, self.gui.receive_mode, 'Select the files you want to send, then click', True)
@pytest.mark.run(order=19)
def test_upload_file(self):
@ -102,11 +106,11 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=20)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'receive')
CommonTests.test_history_widgets_present(self, self.gui.receive_mode)
@pytest.mark.run(order=21)
def test_counter_incremented(self):
CommonTests.test_counter_incremented(self, 'receive', 1)
CommonTests.test_counter_incremented(self, self.gui.receive_mode, 1)
@pytest.mark.run(order=22)
def test_upload_same_file_is_renamed(self):
@ -114,19 +118,23 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=23)
def test_upload_count_incremented_again(self):
CommonTests.test_counter_incremented(self, 'receive', 2)
CommonTests.test_counter_incremented(self, self.gui.receive_mode, 2)
@pytest.mark.run(order=24)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'receive', False)
def test_history_indicator(self):
CommonTests.test_history_indicator(self, self.gui.receive_mode, True)
@pytest.mark.run(order=25)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, self.gui.receive_mode, False)
@pytest.mark.run(order=26)
def test_web_service_is_stopped(self):
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=26)
@pytest.mark.run(order=27)
def test_server_status_indicator_says_closed(self):
CommonTests.test_server_status_indicator_says_closed(self, 'receive', False)
CommonTests.test_server_status_indicator_says_closed(self, self.gui.receive_mode, False)
if __name__ == "__main__":
unittest.main()

View file

@ -47,94 +47,104 @@ class OnionShareGuiTest(unittest.TestCase):
def test_file_selection_widget_has_a_file(self):
CommonTests.test_file_selection_widget_has_a_file(self)
@pytest.mark.run(order=6)
def test_info_widget_is_visible(self):
CommonTests.test_info_widget_is_visible(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.share_mode)
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, self.gui.share_mode)
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, self.gui.share_mode)
@pytest.mark.run(order=10)
def test_deleting_only_file_hides_delete_button(self):
CommonTests.test_deleting_only_file_hides_delete_button(self)
@pytest.mark.run(order=9)
@pytest.mark.run(order=11)
def test_add_a_file_and_delete_using_its_delete_widget(self):
CommonTests.test_add_a_file_and_delete_using_its_delete_widget(self)
@pytest.mark.run(order=10)
@pytest.mark.run(order=12)
def test_file_selection_widget_readd_files(self):
CommonTests.test_file_selection_widget_readd_files(self)
@pytest.mark.run(order=11)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=12)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=13)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
@pytest.mark.run(order=14)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, self.gui.share_mode)
@pytest.mark.run(order=15)
def test_add_delete_buttons_hidden(self):
CommonTests.test_add_delete_buttons_hidden(self)
@pytest.mark.run(order=14)
@pytest.mark.run(order=16)
def test_settings_button_is_hidden(self):
CommonTests.test_settings_button_is_hidden(self)
@pytest.mark.run(order=15)
@pytest.mark.run(order=17)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'share')
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
@pytest.mark.run(order=16)
@pytest.mark.run(order=18)
def test_a_web_server_is_running(self):
CommonTests.test_a_web_server_is_running(self)
@pytest.mark.run(order=17)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', False)
@pytest.mark.run(order=18)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'share')
@pytest.mark.run(order=19)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'share')
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, self.gui.share_mode, False)
@pytest.mark.run(order=20)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, self.gui.share_mode)
@pytest.mark.run(order=21)
def test_web_page(self):
CommonTests.test_web_page(self, 'share', 'Total size', False)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, self.gui.share_mode)
@pytest.mark.run(order=22)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, self.gui.share_mode)
@pytest.mark.run(order=23)
def test_web_page(self):
CommonTests.test_web_page(self, self.gui.share_mode, 'Total size', False)
@pytest.mark.run(order=24)
def test_download_share(self):
CommonTests.test_download_share(self, False)
@pytest.mark.run(order=23)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'share')
@pytest.mark.run(order=24)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', False)
@pytest.mark.run(order=25)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, self.gui.share_mode)
@pytest.mark.run(order=26)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, self.gui.share_mode, False)
@pytest.mark.run(order=27)
def test_web_service_is_stopped(self):
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=26)
@pytest.mark.run(order=28)
def test_server_status_indicator_says_closed(self):
CommonTests.test_server_status_indicator_says_closed(self, 'share', False)
CommonTests.test_server_status_indicator_says_closed(self, self.gui.share_mode, False)
@pytest.mark.run(order=27)
@pytest.mark.run(order=29)
def test_add_button_visible(self):
CommonTests.test_add_button_visible(self)
@pytest.mark.run(order=30)
def test_history_indicator(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
CommonTests.test_history_indicator(self, self.gui.share_mode, False)
if __name__ == "__main__":
unittest.main()

View file

@ -46,94 +46,104 @@ class OnionShareGuiTest(unittest.TestCase):
def test_file_selection_widget_has_a_file(self):
CommonTests.test_file_selection_widget_has_a_file(self)
@pytest.mark.run(order=6)
def test_info_widget_is_visible(self):
CommonTests.test_info_widget_is_visible(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.share_mode)
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, self.gui.share_mode)
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, self.gui.share_mode)
@pytest.mark.run(order=10)
def test_deleting_only_file_hides_delete_button(self):
CommonTests.test_deleting_only_file_hides_delete_button(self)
@pytest.mark.run(order=9)
@pytest.mark.run(order=11)
def test_add_a_file_and_delete_using_its_delete_widget(self):
CommonTests.test_add_a_file_and_delete_using_its_delete_widget(self)
@pytest.mark.run(order=10)
@pytest.mark.run(order=12)
def test_file_selection_widget_readd_files(self):
CommonTests.test_file_selection_widget_readd_files(self)
@pytest.mark.run(order=11)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=12)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=13)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
@pytest.mark.run(order=14)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, self.gui.share_mode)
@pytest.mark.run(order=15)
def test_add_delete_buttons_hidden(self):
CommonTests.test_add_delete_buttons_hidden(self)
@pytest.mark.run(order=14)
@pytest.mark.run(order=16)
def test_settings_button_is_hidden(self):
CommonTests.test_settings_button_is_hidden(self)
@pytest.mark.run(order=15)
@pytest.mark.run(order=17)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'share')
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
@pytest.mark.run(order=16)
@pytest.mark.run(order=18)
def test_a_web_server_is_running(self):
CommonTests.test_a_web_server_is_running(self)
@pytest.mark.run(order=17)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', True)
@pytest.mark.run(order=18)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'share')
@pytest.mark.run(order=19)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'share')
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, self.gui.share_mode, True)
@pytest.mark.run(order=20)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, self.gui.share_mode)
@pytest.mark.run(order=21)
def test_web_page(self):
CommonTests.test_web_page(self, 'share', 'Total size', True)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, self.gui.share_mode)
@pytest.mark.run(order=22)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, self.gui.share_mode)
@pytest.mark.run(order=23)
def test_web_page(self):
CommonTests.test_web_page(self, self.gui.share_mode, 'Total size', True)
@pytest.mark.run(order=24)
def test_download_share(self):
CommonTests.test_download_share(self, True)
@pytest.mark.run(order=23)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'share')
@pytest.mark.run(order=24)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', False)
@pytest.mark.run(order=25)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, self.gui.share_mode)
@pytest.mark.run(order=26)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, self.gui.share_mode, False)
@pytest.mark.run(order=27)
def test_web_service_is_stopped(self):
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=26)
@pytest.mark.run(order=28)
def test_server_status_indicator_says_closed(self):
CommonTests.test_server_status_indicator_says_closed(self, 'share', False)
CommonTests.test_server_status_indicator_says_closed(self, self.gui.share_mode, False)
@pytest.mark.run(order=27)
@pytest.mark.run(order=29)
def test_add_button_visible(self):
CommonTests.test_add_button_visible(self)
@pytest.mark.run(order=30)
def test_history_indicator(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
CommonTests.test_history_indicator(self, self.gui.share_mode, True)
if __name__ == "__main__":
unittest.main()

View file

@ -47,106 +47,116 @@ class OnionShareGuiTest(unittest.TestCase):
def test_file_selection_widget_has_a_file(self):
CommonTests.test_file_selection_widget_has_a_file(self)
@pytest.mark.run(order=6)
def test_info_widget_is_visible(self):
CommonTests.test_info_widget_is_visible(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.share_mode)
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, self.gui.share_mode)
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, self.gui.share_mode)
@pytest.mark.run(order=10)
def test_deleting_only_file_hides_delete_button(self):
CommonTests.test_deleting_only_file_hides_delete_button(self)
@pytest.mark.run(order=9)
@pytest.mark.run(order=11)
def test_add_a_file_and_delete_using_its_delete_widget(self):
CommonTests.test_add_a_file_and_delete_using_its_delete_widget(self)
@pytest.mark.run(order=10)
@pytest.mark.run(order=12)
def test_file_selection_widget_readd_files(self):
CommonTests.test_file_selection_widget_readd_files(self)
@pytest.mark.run(order=11)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=12)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=13)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
@pytest.mark.run(order=14)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, self.gui.share_mode)
@pytest.mark.run(order=15)
def test_add_delete_buttons_hidden(self):
CommonTests.test_add_delete_buttons_hidden(self)
@pytest.mark.run(order=14)
@pytest.mark.run(order=16)
def test_settings_button_is_hidden(self):
CommonTests.test_settings_button_is_hidden(self)
@pytest.mark.run(order=15)
@pytest.mark.run(order=17)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'share')
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
@pytest.mark.run(order=16)
@pytest.mark.run(order=18)
def test_a_web_server_is_running(self):
CommonTests.test_a_web_server_is_running(self)
@pytest.mark.run(order=17)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', True)
@pytest.mark.run(order=18)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'share')
@pytest.mark.run(order=19)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'share')
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, self.gui.share_mode, True)
@pytest.mark.run(order=20)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, self.gui.share_mode)
@pytest.mark.run(order=21)
def test_web_page(self):
CommonTests.test_web_page(self, 'share', 'Total size', True)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, self.gui.share_mode)
@pytest.mark.run(order=22)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, self.gui.share_mode)
@pytest.mark.run(order=23)
def test_web_page(self):
CommonTests.test_web_page(self, self.gui.share_mode, 'Total size', True)
@pytest.mark.run(order=24)
def test_download_share(self):
CommonTests.test_download_share(self, True)
@pytest.mark.run(order=23)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'share')
@pytest.mark.run(order=24)
def test_counter_incremented(self):
CommonTests.test_counter_incremented(self, 'share', 1)
@pytest.mark.run(order=25)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, self.gui.share_mode)
@pytest.mark.run(order=26)
def test_counter_incremented(self):
CommonTests.test_counter_incremented(self, self.gui.share_mode, 1)
@pytest.mark.run(order=27)
def test_download_share_again(self):
CommonTests.test_download_share(self, True)
@pytest.mark.run(order=26)
def test_counter_incremented_again(self):
CommonTests.test_counter_incremented(self, 'share', 2)
@pytest.mark.run(order=27)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', True)
@pytest.mark.run(order=28)
def test_counter_incremented_again(self):
CommonTests.test_counter_incremented(self, self.gui.share_mode, 2)
@pytest.mark.run(order=29)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, self.gui.share_mode, True)
@pytest.mark.run(order=30)
def test_web_service_is_stopped(self):
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=29)
@pytest.mark.run(order=31)
def test_server_status_indicator_says_closed(self):
CommonTests.test_server_status_indicator_says_closed(self, 'share', True)
CommonTests.test_server_status_indicator_says_closed(self, self.gui.share_mode, True)
@pytest.mark.run(order=30)
@pytest.mark.run(order=32)
def test_add_button_visible(self):
CommonTests.test_add_button_visible(self)
@pytest.mark.run(order=33)
def test_history_indicator(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
CommonTests.test_history_indicator(self, self.gui.share_mode, True)
if __name__ == "__main__":
unittest.main()

View file

@ -44,72 +44,82 @@ class OnionShareGuiTest(unittest.TestCase):
def test_server_status_bar_is_visible(self):
CommonTests.test_server_status_bar_is_visible(self)
@pytest.mark.run(order=5)
def test_info_widget_is_visible(self):
CommonTests.test_info_widget_is_visible(self, 'share')
@pytest.mark.run(order=6)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
@pytest.mark.run(order=7)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.share_mode)
@pytest.mark.run(order=8)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, self.gui.share_mode)
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, self.gui.share_mode)
@pytest.mark.run(order=10)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
@pytest.mark.run(order=11)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, self.gui.share_mode)
@pytest.mark.run(order=12)
def test_settings_button_is_hidden(self):
CommonTests.test_settings_button_is_hidden(self)
@pytest.mark.run(order=10)
@pytest.mark.run(order=13)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'share')
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
@pytest.mark.run(order=11)
@pytest.mark.run(order=14)
def test_a_web_server_is_running(self):
CommonTests.test_a_web_server_is_running(self)
@pytest.mark.run(order=12)
@pytest.mark.run(order=15)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', False)
CommonTests.test_have_a_slug(self, self.gui.share_mode, False)
global slug
slug = self.gui.share_mode.server_status.web.slug
@pytest.mark.run(order=13)
@pytest.mark.run(order=16)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
CommonTests.test_server_status_indicator_says_started(self, self.gui.share_mode)
@pytest.mark.run(order=14)
@pytest.mark.run(order=17)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', True)
CommonTests.test_server_is_stopped(self, self.gui.share_mode, True)
@pytest.mark.run(order=15)
@pytest.mark.run(order=18)
def test_web_service_is_stopped(self):
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=16)
@pytest.mark.run(order=19)
def test_server_status_indicator_says_closed(self):
CommonTests.test_server_status_indicator_says_closed(self, 'share', True)
CommonTests.test_server_status_indicator_says_closed(self, self.gui.share_mode, True)
@pytest.mark.run(order=17)
@pytest.mark.run(order=20)
def test_server_started_again(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
CommonTests.test_server_status_indicator_says_starting(self, 'share')
CommonTests.test_a_server_is_started(self, 'share')
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
CommonTests.test_server_status_indicator_says_starting(self, self.gui.share_mode)
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
@pytest.mark.run(order=18)
@pytest.mark.run(order=21)
def test_have_same_slug(self):
'''Test that we have the same slug'''
self.assertEqual(self.gui.share_mode.server_status.web.slug, slug)
@pytest.mark.run(order=19)
@pytest.mark.run(order=22)
def test_server_is_stopped_again(self):
CommonTests.test_server_is_stopped(self, 'share', True)
CommonTests.test_server_is_stopped(self, self.gui.share_mode, True)
CommonTests.test_web_service_is_stopped(self)
@pytest.mark.run(order=23)
def test_history_indicator(self):
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
CommonTests.test_history_indicator(self, self.gui.share_mode, False)
if __name__ == "__main__":
unittest.main()

View file

@ -47,29 +47,25 @@ class OnionShareGuiTest(unittest.TestCase):
def test_file_selection_widget_has_a_file(self):
CommonTests.test_file_selection_widget_has_a_file(self)
@pytest.mark.run(order=6)
def test_info_widget_is_visible(self):
CommonTests.test_info_widget_is_visible(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, self.gui.share_mode)
@pytest.mark.run(order=8)
def test_set_timeout(self):
CommonTests.test_set_timeout(self, 'share', 5)
CommonTests.test_set_timeout(self, self.gui.share_mode, 5)
@pytest.mark.run(order=9)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
CommonTests.test_server_working_on_start_button_pressed(self, self.gui.share_mode)
@pytest.mark.run(order=10)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
CommonTests.test_server_status_indicator_says_starting(self, self.gui.share_mode)
@pytest.mark.run(order=11)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'share')
CommonTests.test_a_server_is_started(self, self.gui.share_mode)
@pytest.mark.run(order=12)
def test_a_web_server_is_running(self):
@ -77,11 +73,11 @@ class OnionShareGuiTest(unittest.TestCase):
@pytest.mark.run(order=13)
def test_timeout_widget_hidden(self):
CommonTests.test_timeout_widget_hidden(self, 'share')
CommonTests.test_timeout_widget_hidden(self, self.gui.share_mode)
@pytest.mark.run(order=14)
def test_timeout(self):
CommonTests.test_server_timed_out(self, 'share', 10000)
CommonTests.test_server_timed_out(self, self.gui.share_mode, 10000)
@pytest.mark.run(order=15)
def test_web_service_is_stopped(self):