Skip to content

Commit c5c9d17

Browse files
committed
test suite update: error logging for browser errors
1 parent e68da79 commit c5c9d17

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_app/tests/utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
from django.db import connections
1515
from django.test.utils import modify_settings
1616
from playwright.sync_api import sync_playwright
17-
17+
from logging import getLogger
1818
from reactpy_django.utils import str_to_bool
1919

2020
if TYPE_CHECKING:
2121
from daphne.testing import DaphneProcess
2222

2323
GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS", "False")
24-
24+
_logger = getLogger(__name__)
2525

2626
class PlaywrightTestCase(ChannelsLiveServerTestCase):
2727
databases = {"default"}
@@ -115,6 +115,7 @@ def start_playwright_client(cls):
115115
cls.browser = cls.playwright.chromium.launch(headless=bool(headless))
116116
cls.page = cls.browser.new_page()
117117
cls.page.set_default_timeout(10000)
118+
cls.page.on("console", lambda msg: _logger.error(f"error: {msg.text}") if msg.type == "error" else None)
118119

119120
@classmethod
120121
def shutdown_playwright_client(cls):

0 commit comments

Comments
 (0)