Fix local GUI tests so they pass

This commit is contained in:
Micah Lee 2018-09-29 18:24:11 -07:00
parent 39dd0862d4
commit 4710eaee4c
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
8 changed files with 171 additions and 122 deletions

View file

@ -24,19 +24,13 @@ 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())
def test_info_widget_shows_less(self, mode):
'''Test that minimum information (no label) is displayed in the info bar'''
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'''
self.assertFalse(self.gui.share_mode.info.label.text() == "")
if mode == 'receive':
self.assertTrue(self.gui.receive_mode.info_widget.isVisible())
if mode == 'share':
self.assertTrue(self.gui.share_mode.info_widget.isVisible())
# There's no minimal display in receive mode
self.assertTrue(False)
def test_click_mode(self, mode):
'''Test that we can switch Mode by clicking the button'''
@ -47,14 +41,30 @@ class CommonTests(object):
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'''
if mode == 'receive':
currently_visible = self.gui.receive_mode.uploads.isVisible()
QtTest.QTest.mouseClick(self.gui.receive_mode.info.toggle_button, QtCore.Qt.LeftButton)
self.assertEqual(self.gui.receive_mode.uploads.isVisible(), not currently_visible)
if mode == 'share':
currently_visible = self.gui.receive_mode.uploads.isVisible()
QtTest.QTest.mouseClick(self.gui.share_mode.info.toggle_button, QtCore.Qt.LeftButton)
self.assertEqual(self.gui.share_mode.downloads.isVisible(), not currently_visible)
def test_history_is_not_visible(self, mode):
'''Test that the History section is not visible'''
if mode == 'receive':
self.assertFalse(self.gui.receive_mode.uploads.isVisible())
if mode == 'share':
self.assertFalse(self.gui.share_mode.downloads.isVisible())
def test_history_is_visible(self, mode):
'''Test that the History section is visible and that the relevant widget is present'''
'''Test that the History section is visible'''
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())
def test_server_working_on_start_button_pressed(self, mode):
'''Test we can start the service'''
@ -161,11 +171,11 @@ 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())
self.assertFalse(self.gui.receive_mode.uploads.empty.isVisible())
self.assertTrue(self.gui.receive_mode.uploads.not_empty.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(self.gui.share_mode.downloads.empty.isVisible())
self.assertTrue(self.gui.share_mode.downloads.not_empty.isVisible())
def test_counter_incremented(self, mode, count):
'''Test that the counter has incremented'''
@ -304,4 +314,3 @@ class CommonTests(object):
def test_add_button_visible(self):
'''Test that the add button should be visible'''
self.assertTrue(self.gui.share_mode.server_status.file_selection.add_button.isVisible())

View file

@ -94,15 +94,19 @@ 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')
@pytest.mark.run(order=6)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, 'receive')
@pytest.mark.run(order=7)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, 'receive')
@pytest.mark.run(order=8)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'receive')

View file

@ -95,34 +95,38 @@ 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')
@pytest.mark.run(order=6)
def test_click_mode(self):
CommonTests.test_click_mode(self, 'receive')
@pytest.mark.run(order=6)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, 'receive')
@pytest.mark.run(order=7)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, 'receive')
@pytest.mark.run(order=8)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'receive')
@pytest.mark.run(order=8)
@pytest.mark.run(order=9)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'receive')
@pytest.mark.run(order=9)
@pytest.mark.run(order=10)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'receive')
@pytest.mark.run(order=10)
@pytest.mark.run(order=11)
def test_settings_button_is_hidden(self):
CommonTests.test_settings_button_is_hidden(self)
@pytest.mark.run(order=11)
@pytest.mark.run(order=12)
def test_a_server_is_started(self):
CommonTests.test_a_server_is_started(self, 'receive')
@pytest.mark.run(order=12)
@pytest.mark.run(order=13)
def test_a_web_server_is_running(self):
CommonTests.test_a_web_server_is_running(self)

View file

@ -97,90 +97,98 @@ class OnionShareGuiTest(unittest.TestCase):
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')
def test_info_widget_shows_less(self):
CommonTests.test_info_widget_shows_less(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, 'share')
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, 'share')
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
@pytest.mark.run(order=8)
@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)
@pytest.mark.run(order=13)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=12)
@pytest.mark.run(order=14)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=13)
@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')
@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)
@pytest.mark.run(order=19)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', False)
@pytest.mark.run(order=18)
@pytest.mark.run(order=20)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'share')
@pytest.mark.run(order=19)
@pytest.mark.run(order=21)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'share')
@pytest.mark.run(order=20)
@pytest.mark.run(order=22)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
@pytest.mark.run(order=21)
@pytest.mark.run(order=23)
def test_web_page(self):
CommonTests.test_web_page(self, 'share', 'Total size', False)
@pytest.mark.run(order=22)
@pytest.mark.run(order=24)
def test_download_share(self):
CommonTests.test_download_share(self, False)
@pytest.mark.run(order=23)
@pytest.mark.run(order=25)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'share')
@pytest.mark.run(order=24)
@pytest.mark.run(order=26)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', False)
@pytest.mark.run(order=25)
@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)
@pytest.mark.run(order=27)
@pytest.mark.run(order=29)
def test_add_button_visible(self):
CommonTests.test_add_button_visible(self)

View file

@ -97,90 +97,98 @@ class OnionShareGuiTest(unittest.TestCase):
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')
def test_info_widget_shows_less(self):
CommonTests.test_info_widget_shows_less(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, 'share')
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, 'share')
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
@pytest.mark.run(order=8)
@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)
@pytest.mark.run(order=13)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=12)
@pytest.mark.run(order=14)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=13)
@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')
@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)
@pytest.mark.run(order=19)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', True)
@pytest.mark.run(order=18)
@pytest.mark.run(order=20)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'share')
@pytest.mark.run(order=19)
@pytest.mark.run(order=21)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'share')
@pytest.mark.run(order=20)
@pytest.mark.run(order=22)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
@pytest.mark.run(order=21)
@pytest.mark.run(order=23)
def test_web_page(self):
CommonTests.test_web_page(self, 'share', 'Total size', True)
@pytest.mark.run(order=22)
@pytest.mark.run(order=24)
def test_download_share(self):
CommonTests.test_download_share(self, True)
@pytest.mark.run(order=23)
@pytest.mark.run(order=25)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'share')
@pytest.mark.run(order=24)
@pytest.mark.run(order=26)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', False)
@pytest.mark.run(order=25)
@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)
@pytest.mark.run(order=27)
@pytest.mark.run(order=29)
def test_add_button_visible(self):
CommonTests.test_add_button_visible(self)

View file

@ -97,102 +97,110 @@ class OnionShareGuiTest(unittest.TestCase):
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')
def test_info_widget_shows_less(self):
CommonTests.test_info_widget_shows_less(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, 'share')
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, 'share')
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
@pytest.mark.run(order=8)
@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)
@pytest.mark.run(order=13)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=12)
@pytest.mark.run(order=14)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=13)
@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')
@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)
@pytest.mark.run(order=19)
def test_have_a_slug(self):
CommonTests.test_have_a_slug(self, 'share', True)
@pytest.mark.run(order=18)
@pytest.mark.run(order=20)
def test_url_description_shown(self):
CommonTests.test_url_description_shown(self, 'share')
@pytest.mark.run(order=19)
@pytest.mark.run(order=21)
def test_have_copy_url_button(self):
CommonTests.test_have_copy_url_button(self, 'share')
@pytest.mark.run(order=20)
@pytest.mark.run(order=22)
def test_server_status_indicator_says_started(self):
CommonTests.test_server_status_indicator_says_started(self, 'share')
@pytest.mark.run(order=21)
@pytest.mark.run(order=23)
def test_web_page(self):
CommonTests.test_web_page(self, 'share', 'Total size', True)
@pytest.mark.run(order=22)
@pytest.mark.run(order=24)
def test_download_share(self):
CommonTests.test_download_share(self, True)
@pytest.mark.run(order=23)
@pytest.mark.run(order=25)
def test_history_widgets_present(self):
CommonTests.test_history_widgets_present(self, 'share')
@pytest.mark.run(order=24)
@pytest.mark.run(order=26)
def test_counter_incremented(self):
CommonTests.test_counter_incremented(self, 'share', 1)
@pytest.mark.run(order=25)
@pytest.mark.run(order=27)
def test_download_share_again(self):
CommonTests.test_download_share(self, True)
@pytest.mark.run(order=26)
@pytest.mark.run(order=28)
def test_counter_incremented_again(self):
CommonTests.test_counter_incremented(self, 'share', 2)
@pytest.mark.run(order=27)
@pytest.mark.run(order=29)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', True)
@pytest.mark.run(order=28)
@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)
@pytest.mark.run(order=30)
@pytest.mark.run(order=32)
def test_add_button_visible(self):
CommonTests.test_add_button_visible(self)

View file

@ -94,68 +94,76 @@ 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_info_widget_shows_less(self):
CommonTests.test_info_widget_shows_less(self, 'share')
@pytest.mark.run(order=7)
def test_history_is_not_visible(self):
CommonTests.test_history_is_not_visible(self, 'share')
@pytest.mark.run(order=8)
def test_click_toggle_history(self):
CommonTests.test_click_toggle_history(self, 'share')
@pytest.mark.run(order=9)
def test_history_is_visible(self):
CommonTests.test_history_is_visible(self, 'share')
@pytest.mark.run(order=7)
@pytest.mark.run(order=10)
def test_server_working_on_start_button_pressed(self):
CommonTests.test_server_working_on_start_button_pressed(self, 'share')
@pytest.mark.run(order=8)
@pytest.mark.run(order=11)
def test_server_status_indicator_says_starting(self):
CommonTests.test_server_status_indicator_says_starting(self, 'share')
@pytest.mark.run(order=9)
@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')
@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)
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')
@pytest.mark.run(order=14)
@pytest.mark.run(order=17)
def test_server_is_stopped(self):
CommonTests.test_server_is_stopped(self, 'share', 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)
@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')
@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_web_service_is_stopped(self)

View file

@ -97,12 +97,12 @@ class OnionShareGuiTest(unittest.TestCase):
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')
def test_info_widget_shows_less(self):
CommonTests.test_info_widget_shows_less(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, 'share')
@pytest.mark.run(order=8)
def test_set_timeout(self):