|
| 1 | +""" |
| 2 | +Smoke tests for production website at empathy-framework.vercel.app |
| 3 | +
|
| 4 | +Run manually: |
| 5 | + python -m pytest tests/test_production_smoke.py -v |
| 6 | +
|
| 7 | +Run with custom URL: |
| 8 | + PRODUCTION_URL=https://empathy-framework.vercel.app python -m pytest tests/test_production_smoke.py -v |
| 9 | +""" |
| 10 | + |
| 11 | +import os |
| 12 | + |
| 13 | +import httpx |
| 14 | +import pytest |
| 15 | + |
| 16 | +# Production URL - can be overridden via environment variable |
| 17 | +PRODUCTION_URL = os.getenv("PRODUCTION_URL", "https://empathy-framework.vercel.app") |
| 18 | + |
| 19 | +# Timeout for requests (seconds) |
| 20 | +REQUEST_TIMEOUT = 30 |
| 21 | + |
| 22 | + |
| 23 | +@pytest.fixture |
| 24 | +def client(): |
| 25 | + """HTTP client with reasonable timeout.""" |
| 26 | + return httpx.Client(timeout=REQUEST_TIMEOUT, follow_redirects=True) |
| 27 | + |
| 28 | + |
| 29 | +class TestProductionPages: |
| 30 | + """Test that key pages load successfully.""" |
| 31 | + |
| 32 | + def test_homepage_loads(self, client): |
| 33 | + """Homepage returns 200 and contains expected content.""" |
| 34 | + response = client.get(f"{PRODUCTION_URL}/") |
| 35 | + assert response.status_code == 200 |
| 36 | + assert "Empathy Framework" in response.text |
| 37 | + |
| 38 | + def test_debug_wizard_page_loads(self, client): |
| 39 | + """Debug wizard page returns 200 and contains expected content.""" |
| 40 | + response = client.get(f"{PRODUCTION_URL}/tools/debug-wizard") |
| 41 | + assert response.status_code == 200 |
| 42 | + assert "Memory-Enhanced Debugging" in response.text or "Debug" in response.text |
| 43 | + |
| 44 | + def test_docs_page_loads(self, client): |
| 45 | + """Docs page returns 200.""" |
| 46 | + response = client.get(f"{PRODUCTION_URL}/docs") |
| 47 | + # May redirect or return 200 |
| 48 | + assert response.status_code in (200, 301, 302, 307, 308) |
| 49 | + |
| 50 | + def test_pricing_page_loads(self, client): |
| 51 | + """Pricing page returns 200.""" |
| 52 | + response = client.get(f"{PRODUCTION_URL}/pricing") |
| 53 | + # May redirect or return 200 |
| 54 | + assert response.status_code in (200, 301, 302, 307, 308) |
| 55 | + |
| 56 | + |
| 57 | +class TestProductionPerformance: |
| 58 | + """Basic performance checks.""" |
| 59 | + |
| 60 | + def test_homepage_response_time(self, client): |
| 61 | + """Homepage responds within acceptable time.""" |
| 62 | + response = client.get(f"{PRODUCTION_URL}/") |
| 63 | + # Should respond within 5 seconds |
| 64 | + assert response.elapsed.total_seconds() < 5 |
| 65 | + |
| 66 | + def test_debug_wizard_response_time(self, client): |
| 67 | + """Debug wizard page responds within acceptable time.""" |
| 68 | + response = client.get(f"{PRODUCTION_URL}/tools/debug-wizard") |
| 69 | + # Should respond within 5 seconds |
| 70 | + assert response.elapsed.total_seconds() < 5 |
| 71 | + |
| 72 | + |
| 73 | +class TestProductionHeaders: |
| 74 | + """Test security and cache headers.""" |
| 75 | + |
| 76 | + def test_security_headers(self, client): |
| 77 | + """Check for basic security headers.""" |
| 78 | + response = client.get(f"{PRODUCTION_URL}/") |
| 79 | + |
| 80 | + # Vercel typically sets these |
| 81 | + # Just check the response is valid, not strict header requirements |
| 82 | + assert response.status_code == 200 |
| 83 | + |
| 84 | + def test_content_type(self, client): |
| 85 | + """HTML pages return correct content type.""" |
| 86 | + response = client.get(f"{PRODUCTION_URL}/") |
| 87 | + content_type = response.headers.get("content-type", "") |
| 88 | + assert "text/html" in content_type |
| 89 | + |
| 90 | + |
| 91 | +class TestDebugWizardContent: |
| 92 | + """Verify debug wizard page has expected content.""" |
| 93 | + |
| 94 | + def test_debug_wizard_has_form(self, client): |
| 95 | + """Debug wizard page contains the error input form.""" |
| 96 | + response = client.get(f"{PRODUCTION_URL}/tools/debug-wizard") |
| 97 | + assert response.status_code == 200 |
| 98 | + # Check for key UI elements |
| 99 | + html = response.text.lower() |
| 100 | + assert "error" in html or "bug" in html or "debug" in html |
| 101 | + |
| 102 | + def test_debug_wizard_has_features_section(self, client): |
| 103 | + """Debug wizard page has the features section.""" |
| 104 | + response = client.get(f"{PRODUCTION_URL}/tools/debug-wizard") |
| 105 | + assert response.status_code == 200 |
| 106 | + # Check for memory/pattern feature mentions |
| 107 | + html = response.text.lower() |
| 108 | + assert "memory" in html or "pattern" in html |
| 109 | + |
| 110 | + |
| 111 | +if __name__ == "__main__": |
| 112 | + pytest.main([__file__, "-v"]) |
0 commit comments