@@ -631,6 +631,16 @@ def assert_logging_on_exception(
631631class TestWHOISSelenium (CreateWHOISMixin , SeleniumTestMixin , StaticLiveServerTestCase ):
632632 @mock .patch .object (app_settings , "WHOIS_CONFIGURED" , True )
633633 def test_whois_device_admin (self ):
634+ def _assert_no_js_errors ():
635+ browser_logs = []
636+ for log in self .get_browser_logs ():
637+ if self .browser == "chrome" and log ["source" ] != "console-api" :
638+ continue
639+ elif log ["message" ] in ["wrong event specified: touchleave" ]:
640+ continue
641+ browser_logs .append (log )
642+ self .assertEqual (browser_logs , [])
643+
634644 whois_obj = self ._create_whois_info ()
635645 device = self ._create_device (last_ip = whois_obj .ip_address )
636646 self .login ()
@@ -655,6 +665,7 @@ def test_whois_device_admin(self):
655665 self .assertIn (whois_obj .timezone , additional_text [1 ].text )
656666 self .assertIn (whois_obj .formatted_address , additional_text [2 ].text )
657667 self .assertIn (whois_obj .cidr , additional_text [3 ].text )
668+ _assert_no_js_errors ()
658669
659670 with mock .patch .object (app_settings , "WHOIS_CONFIGURED" , False ):
660671 with self .subTest (
@@ -664,6 +675,7 @@ def test_whois_device_admin(self):
664675 self .open (reverse ("admin:config_device_change" , args = [device .pk ]))
665676 self .wait_for_invisibility (By .CSS_SELECTOR , "table.whois-table" )
666677 self .wait_for_invisibility (By .CSS_SELECTOR , "details.whois" )
678+ _assert_no_js_errors ()
667679
668680 with self .subTest (
669681 "WHOIS details not visible in device admin when WHOIS is disabled"
@@ -674,6 +686,7 @@ def test_whois_device_admin(self):
674686 self .open (reverse ("admin:config_device_change" , args = [device .pk ]))
675687 self .wait_for_invisibility (By .CSS_SELECTOR , "table.whois-table" )
676688 self .wait_for_invisibility (By .CSS_SELECTOR , "details.whois" )
689+ _assert_no_js_errors ()
677690
678691 with self .subTest (
679692 "WHOIS details not visible in device admin when WHOIS Info does not exist"
@@ -685,3 +698,4 @@ def test_whois_device_admin(self):
685698 self .open (reverse ("admin:config_device_change" , args = [device .pk ]))
686699 self .wait_for_invisibility (By .CSS_SELECTOR , "table.whois-table" )
687700 self .wait_for_invisibility (By .CSS_SELECTOR , "details.whois" )
701+ _assert_no_js_errors ()
0 commit comments