Create test_ui_smoke.py
Browse files- tests/test_ui_smoke.py +18 -0
tests/test_ui_smoke.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tests/test_ui_smoke.py
|
| 2 |
+
import pytest
|
| 3 |
+
from gradio.testing import start_server
|
| 4 |
+
import time
|
| 5 |
+
import requests
|
| 6 |
+
|
| 7 |
+
@pytest.fixture(scope="module")
|
| 8 |
+
def app_server():
|
| 9 |
+
proc, url = start_server("app:demo") # adjust import path if different
|
| 10 |
+
# give it a moment
|
| 11 |
+
time.sleep(3)
|
| 12 |
+
yield url
|
| 13 |
+
proc.kill()
|
| 14 |
+
|
| 15 |
+
def test_homepage_loads(app_server):
|
| 16 |
+
resp = requests.get(app_server)
|
| 17 |
+
assert resp.status_code == 200
|
| 18 |
+
assert "<!DOCTYPE html>" in resp.text or "<html" in resp.text
|