From 2216e9b05d2a5bcd3d593628b3797d32e516f6ce Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 6 Nov 2023 11:25:25 +0100 Subject: [PATCH] :white_check_mark: [#1834] Disable flakey e2e test in firefox --- src/open_inwoner/accounts/tests/test_action_views.py | 5 +++++ src/open_inwoner/utils/tests/playwright.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/open_inwoner/accounts/tests/test_action_views.py b/src/open_inwoner/accounts/tests/test_action_views.py index 9ba3c4c03b..23d7b92a20 100644 --- a/src/open_inwoner/accounts/tests/test_action_views.py +++ b/src/open_inwoner/accounts/tests/test_action_views.py @@ -13,6 +13,7 @@ from open_inwoner.cms.tests import cms_tools from open_inwoner.configurations.models import SiteConfiguration +from open_inwoner.utils.tests.playwright import get_driver_name from ...utils.tests.playwright import PlaywrightSyncLiveServerTestCase from ..choices import StatusChoices @@ -337,6 +338,10 @@ def setUp(self) -> None: self.action_list_url = reverse("profile:action_list") def test_action_status(self, mock_solo): + # @skipIf(...) causes issues together with Playwright + if get_driver_name() == "firefox": + self.skipTest("Test is flakey in firefox") + mock_solo.return_value.cookiebanner_enabled = False context = self.browser.new_context(storage_state=self.user_login_state) diff --git a/src/open_inwoner/utils/tests/playwright.py b/src/open_inwoner/utils/tests/playwright.py index 04d2bcb265..d627661826 100644 --- a/src/open_inwoner/utils/tests/playwright.py +++ b/src/open_inwoner/utils/tests/playwright.py @@ -20,6 +20,10 @@ BROWSER_DEFAULT = "chromium" +def get_driver_name() -> str: + return os.environ.get("E2E_DRIVER", BROWSER_DEFAULT) + + class PlaywrightSyncLiveServerTestCase(StaticLiveServerTestCase): """ base class for convenient synchronous Playwright in Django @@ -73,7 +77,7 @@ def launch_browser(cls, playwright: Playwright) -> Browser: @classmethod def get_browser_launcher(cls) -> Callable[[Playwright], Browser]: - name = os.environ.get("E2E_DRIVER", BROWSER_DEFAULT) + name = get_driver_name() if name in BROWSER_DRIVERS: return BROWSER_DRIVERS[name] else: