From 08298d9ffdeade1fb5cf678e921d3a428c6d3a29 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Fri, 8 Nov 2019 20:48:38 +0800 Subject: [PATCH] Added test_autostart_timer_too_short --- tests2/test_gui_share.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests2/test_gui_share.py b/tests2/test_gui_share.py index 55010b16..a6f52db6 100644 --- a/tests2/test_gui_share.py +++ b/tests2/test_gui_share.py @@ -391,3 +391,26 @@ class TestShare(GuiBaseTest): self.web_server_is_stopped(tab) self.close_all_tabs() + + @pytest.mark.gui + def test_autostart_timer_too_short(self): + """ + Autostart timer should throw a warning if the scheduled time is too soon + """ + tab = self.new_share_tab() + tab.get_mode().mode_settings_widget.toggle_advanced_button.click() + tab.get_mode().mode_settings_widget.autostart_timer_checkbox.click() + + def accept_dialog(): + window = tab.common.gui.qtapp.activeWindow() + if window: + window.close() + + self.run_all_common_setup_tests() + self.run_all_share_mode_setup_tests(tab) + # Set a low timeout + self.set_autostart_timer(tab, 2) + QtTest.QTest.qWait(2200) + QtCore.QTimer.singleShot(200, accept_dialog) + tab.get_mode().server_status.server_button.click() + self.assertEqual(tab.get_mode().server_status.status, 0)