Extend coverage of website mode tests

This commit is contained in:
Miguel Jacq 2019-09-03 12:23:27 +10:00
parent 458a0fb1d0
commit 9ae98eb7cb
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
5 changed files with 13 additions and 12 deletions

View File

@ -202,6 +202,9 @@ class GuiBaseTest(object):
else:
self.assertIsNone(mode.server_status.web.password, r'(\w+)-(\w+)')
def add_button_visible(self, mode):
'''Test that the add button should be visible'''
self.assertTrue(mode.server_status.file_selection.add_button.isVisible())
def url_description_shown(self, mode):
'''Test that the URL label is showing'''
@ -253,7 +256,7 @@ class GuiBaseTest(object):
def server_is_stopped(self, mode, stay_open):
'''Test that the server stops when we click Stop'''
if type(mode) == ReceiveMode or (type(mode) == ShareMode and stay_open):
if type(mode) == ReceiveMode or (type(mode) == ShareMode and stay_open) or (type(mode) == WebsiteMode):
QtTest.QTest.mouseClick(mode.server_status.server_button, QtCore.Qt.LeftButton)
self.assertEqual(mode.server_status.status, 0)

View File

@ -130,11 +130,6 @@ class GuiShareTest(GuiBaseTest):
self.web_server_is_stopped()
def 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())
# 'Grouped' tests follow from here
def run_all_share_mode_setup_tests(self):
@ -171,7 +166,7 @@ class GuiShareTest(GuiBaseTest):
self.server_is_stopped(self.gui.share_mode, stay_open)
self.web_server_is_stopped()
self.server_status_indicator_says_closed(self.gui.share_mode, stay_open)
self.add_button_visible()
self.add_button_visible(self.gui.share_mode)
self.server_working_on_start_button_pressed(self.gui.share_mode)
self.server_is_started(self.gui.share_mode)
self.history_indicator(self.gui.share_mode, public_mode)
@ -184,7 +179,7 @@ class GuiShareTest(GuiBaseTest):
self.server_is_stopped(self.gui.share_mode, stay_open)
self.web_server_is_stopped()
self.server_status_indicator_says_closed(self.gui.share_mode, stay_open)
self.add_button_visible()
self.add_button_visible(self.gui.share_mode)
self.server_working_on_start_button_pressed(self.gui.share_mode)
self.server_is_started(self.gui.share_mode)
self.history_indicator(self.gui.share_mode, public_mode)

View File

@ -54,7 +54,6 @@ class GuiWebsiteTest(GuiShareTest):
except:
pass
def view_website(self, public_mode):
'''Test that we can download the share'''
url = "http://127.0.0.1:{}/".format(self.gui.app.port)
@ -88,10 +87,14 @@ class GuiWebsiteTest(GuiShareTest):
self.server_status_indicator_says_started(self.gui.website_mode)
def run_all_website_mode_download_tests(self, public_mode, stay_open):
def run_all_website_mode_download_tests(self, public_mode):
"""Tests in website mode after viewing the site"""
self.run_all_website_mode_setup_tests()
self.run_all_website_mode_started_tests(public_mode, startup_time=2000)
self.view_website(public_mode)
self.history_widgets_present(self.gui.website_mode)
self.server_is_stopped(self.gui.website_mode, False)
self.web_server_is_stopped()
self.server_status_indicator_says_closed(self.gui.website_mode, False)
self.add_button_visible(self.gui.website_mode)

View File

@ -67,7 +67,7 @@ class TorGuiShareTest(TorGuiBaseTest, GuiShareTest):
self.server_is_stopped(self.gui.share_mode, stay_open)
self.web_server_is_stopped()
self.server_status_indicator_says_closed(self.gui.share_mode, stay_open)
self.add_button_visible()
self.add_button_visible(self.gui.share_mode)
self.server_working_on_start_button_pressed(self.gui.share_mode)
self.server_is_started(self.gui.share_mode, startup_time=45000)
self.history_indicator(self.gui.share_mode, public_mode)

View File

@ -19,7 +19,7 @@ class LocalWebsiteModeTest(unittest.TestCase, GuiWebsiteTest):
@pytest.mark.skipif(pytest.__version__ < '2.9', reason="requires newer pytest")
def test_gui(self):
#self.run_all_common_setup_tests()
self.run_all_website_mode_download_tests(False, False)
self.run_all_website_mode_download_tests(False)
if __name__ == "__main__":
unittest.main()