""" 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