aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/test_error_detection.py
blob: 7cd9bf9462b954100abffb3910f5e24ca6156a76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
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']}")