""" Test to verify that Amulet error detection is working. This test checks if the error detection mechanism can detect errors. """ import pytest from selenium.webdriver.common.by import By import time pytestmark = [pytest.mark.nondestructive] @pytest.mark.smoke def test_error_detection_mechanism(app): """Test that the error detection mechanism is set up correctly.""" # Wait for app to fully initialize time.sleep(3) # Check if window.amuletErrors is defined errors_defined = app.execute_script(""" return typeof window.amuletErrors !== 'undefined'; """) assert errors_defined, "window.amuletErrors is not defined - log_js_bridge may not be loaded" # Check initial state error_count = app.execute_script("return window.amuletErrors.length;") print(f"Initial error count: {error_count}") # If there are errors, print them if error_count > 0: errors = app.execute_script("return window.amuletErrors;") for err in errors: print(f" {err['level']}: {err['message']}")