Skip to content

Commit

Permalink
Update GUI tests to run by default
Browse files Browse the repository at this point in the history
Removed the '--guitests' option from pytest configuration and updated all GUI tests to run without needing this flag. This change simplifies the testing process, making it more straightforward to execute all tests, including those for the graphical user interface.
  • Loading branch information
drew2a committed Apr 29, 2024
1 parent ca6aec1 commit 9b8ab7f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/vars/pytest.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PYTEST_TUNNELS_ARGUMENTS_WIN='${PYTEST_TUNNELS_ARGUMENTS}'
PYTEST_TUNNELS_ARGUMENTS_LINUX='${PYTEST_TUNNELS_ARGUMENTS} --looptime'
PYTEST_TUNNELS_ARGUMENTS_MAC='${PYTEST_TUNNELS_ARGUMENTS} --looptime'

PYTEST_GUI_ARGUMENTS='./src/tribler/gui --guitests ${PYTEST_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS='./src/tribler/gui ${PYTEST_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS_WIN='${PYTEST_GUI_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS_LINUX='${PYTEST_GUI_ARGUMENTS} --looptime'
PYTEST_GUI_ARGUMENTS_MAC='${PYTEST_GUI_ARGUMENTS} --looptime'
13 changes: 0 additions & 13 deletions src/tribler/gui/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,10 @@ def pytest_cmdline_main(config: Config):
enable_extended_logging = config.option.verbose > 0


def pytest_addoption(parser):
parser.addoption('--guitests', action='store_true', dest="guitests",
default=False, help="enable longrundecorated tests")


def pytest_collection_modifyitems(config, items):
for item in items:
item.add_marker(pytest.mark.timeout(60))

if config.getoption("--guitests"):
# --guitests given in cli: do not skip GUI tests
return
skip_guitests = pytest.mark.skip(reason="need --guitests option to run")
for item in items:
if "guitest" in item.keywords:
item.add_marker(skip_guitests)


@pytest.hookimpl
def pytest_collection_finish(session):
Expand Down
14 changes: 0 additions & 14 deletions src/tribler/gui/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ def fake_core_response_popular(window):
})


@pytest.mark.guitest
def test_popular_page(window):
QTest.mouseClick(window.left_menu_button_popular, Qt.LeftButton)
widget = window.popular_page
Expand All @@ -306,7 +305,6 @@ def test_popular_page(window):
screenshot(window, name="popular_page")


@pytest.mark.guitest
def test_settings(window):
QTest.mouseClick(window.settings_button, Qt.LeftButton)
QTest.mouseClick(window.settings_general_button, Qt.LeftButton)
Expand All @@ -325,7 +323,6 @@ def test_settings(window):
wait_for_signal(window.settings_page.settings_edited)


@pytest.mark.guitest
def test_downloads(window):
go_to_and_wait_for_downloads(window)
screenshot(window, name="downloads_all")
Expand All @@ -339,7 +336,6 @@ def test_downloads(window):
screenshot(window, name="downloads_inactive")


@pytest.mark.guitest
def test_download_start_stop_remove_recheck(window):
go_to_and_wait_for_downloads(window)
QTest.mouseClick(window.downloads_list.topLevelItem(0).progress_slider, Qt.LeftButton)
Expand All @@ -350,7 +346,6 @@ def test_download_start_stop_remove_recheck(window):
QTest.mouseClick(window.downloads_page.dialog.buttons[2], Qt.LeftButton)


@pytest.mark.guitest
def test_download_details(window):
go_to_and_wait_for_downloads(window)
QTest.mouseClick(window.downloads_list.topLevelItem(0).progress_slider, Qt.LeftButton)
Expand All @@ -373,23 +368,20 @@ def test_download_details(window):
screenshot(window, name="download_trackers")


@pytest.mark.guitest
def test_search_suggestions(window):
QTest.keyClick(window.top_search_bar, 't')
QTest.keyClick(window.top_search_bar, 'o')
wait_for_signal(window.received_search_completions)
screenshot(window, name="search_suggestions")


@pytest.mark.guitest
def test_search(window):
window.top_search_bar.setText("torrent") # This is likely to trigger some search results
QTest.keyClick(window.top_search_bar, Qt.Key_Enter)
QTest.qWait(WAIT_INTERVAL_MSEC)
screenshot(window, name="search_loading_page")


@pytest.mark.guitest
def test_add_download_url(window):
go_to_and_wait_for_downloads(window)
window.on_add_torrent_from_url()
Expand Down Expand Up @@ -418,7 +410,6 @@ def test_add_download_url(window):
wait_for_signal(window.downloads_page.received_downloads)


@pytest.mark.guitest
def test_add_deeptorrent(window):
# Test that the `deeptorrent.torrent` file doesn't cause the RecursionError
#
Expand All @@ -442,7 +433,6 @@ def test_add_deeptorrent(window):
assert not window.error_handler._handled_exceptions


@pytest.mark.guitest
def test_feedback_dialog(window):
def screenshot_dialog():
screenshot(dialog, name="feedback_dialog")
Expand All @@ -456,7 +446,6 @@ def screenshot_dialog():
dialog.exec_()


@pytest.mark.guitest
def test_feedback_dialog_report_sent(window):
def screenshot_dialog():
screenshot(dialog, name="feedback_dialog")
Expand All @@ -477,7 +466,6 @@ def on_report_sent():
assert on_report_sent.did_send_report


@pytest.mark.guitest
def test_debug_pane(window):
wait_for_variable(window, "tribler_settings")
QTest.mouseClick(window.settings_button, Qt.LeftButton)
Expand Down Expand Up @@ -555,7 +543,6 @@ def test_debug_pane(window):
window.debug_window.close()


@pytest.mark.guitest
def test_tags_dialog(window):
"""
Test the behaviour of the dialog where a user can edit tags.
Expand Down Expand Up @@ -676,7 +663,6 @@ def test_tags_dialog(window):
QTest.qWait(200) # It can take a bit of time to hide the dialog


@pytest.mark.guitest
def test_no_tags(window):
"""
Test removing all tags from a content item.
Expand Down

0 comments on commit 9b8ab7f

Please sign in to comment.