aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/test_smoke.py
blob: cc44165edbb17e49f96851ed3bf1e8ca233e3900 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
Smoke tests for basic application functionality.
"""
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

pytestmark = [pytest.mark.nondestructive]


@pytest.mark.smoke
def test_page_loads(app):
    """Test that the page loads successfully."""
    assert "Amulet" in app.title or app.title != ""


@pytest.mark.smoke
def test_canvas_exists(app):
    """Test that the canvas element exists."""
    canvas = app.find_element(By.ID, "canvas")
    assert canvas is not None
    assert canvas.is_displayed()


@pytest.mark.smoke
def test_canvas_dimensions(app):
    """Test that canvas has proper dimensions."""
    canvas = app.find_element(By.ID, "canvas")
    
    # Canvas should have width and height attributes
    width = canvas.get_attribute("width")
    height = canvas.get_attribute("height")
    
    assert width is not None
    assert height is not None
    assert int(width) > 0
    assert int(height) > 0


@pytest.mark.smoke
def test_no_javascript_errors(app):
    """Test that there are no JavaScript errors on page load."""
    # Get browser console logs
    logs = app.get_log("browser")
    
    # Filter for severe errors (not warnings)
    errors = [log for log in logs if log["level"] == "SEVERE"]
    
    # Filter out favicon 404 errors (expected)
    errors = [log for log in errors if "favicon.ico" not in log.get("message", "")]
    
    # Assert no severe errors
    assert len(errors) == 0, f"JavaScript errors found: {errors}"


@pytest.mark.smoke
def test_status_overlay_present(app):
    """Test that the status overlay exists (for loading indication)."""
    status_overlay = app.find_element(By.ID, "status-overlay")
    assert status_overlay is not None


@pytest.mark.smoke
def test_container_structure(app):
    """Test that the main container structure is correct."""
    container = app.find_element(By.ID, "container")
    assert container is not None
    
    # Check for canvas inside container
    canvas = container.find_element(By.ID, "canvas")
    assert canvas is not None