From b276f3f831af628f21b069c17fd716dc3992bec7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 28 Nov 2024 13:43:44 +0100 Subject: [PATCH] test: Only run alert and logout cleanups if Cockpit is actually opened Some tests like `testAddDiskNFS` fail during setup [1], so the test teardown runs while the browser still shows a blank page. Use the new `Browser.have_test_api()` from https://github.com/cockpit-project/cockpit/pull/21349 instead of merely checking if the browser is running to clean that up. [1] https://github.com/cockpit-project/bots/issues/7137 --- Makefile | 2 +- test/machineslib.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fdfd7d22b..9076fe648 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ COCKPIT_REPO_FILES = \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git -COCKPIT_REPO_COMMIT = 7090fab7372ef7e87e508d207e6468ba76983f9f # 329 + 58 commits +COCKPIT_REPO_COMMIT = b453940e6a7cde684832d750ba56d4afd44a699e # 329 + 66 commits $(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP) COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}' diff --git a/test/machineslib.py b/test/machineslib.py index c6a1ebc3c..52e8c3f8b 100644 --- a/test/machineslib.py +++ b/test/machineslib.py @@ -494,7 +494,7 @@ def stop_all(): self.allow_journal_messages(r".* couldn't get all properties of org.freedesktop.NetworkManager.Device at /org/freedesktop/NetworkManager/Devices/\d+: Timeout was reached") # noqa: E501 # avoid error noise about resources getting cleaned up - self.addCleanup(lambda: not self.browser.valid or self.browser.logout()) + self.addCleanup(lambda: not self.browser.have_test_api() or self.browser.logout()) # noVNC warns about this for non-TLS connections; for RHEL downstream testing self.allow_browser_errors("noVNC requires a secure context") @@ -557,7 +557,7 @@ def downloadVmsArtifacts(self): def tearDown(self): b = self.browser - if b.valid and b.is_present("#button.alert-link.more-button"): + if b.have_test_api() and b.is_present("#button.alert-link.more-button"): b.click("button.alert-link.more-button") if self.getError():