Download tests/test_e2e.py from OpenVar/backend: direct link, hf CLI and curl.
- Browser
- Download file 2.37 kB
-
https://huggingface.co/spaces/OpenVar/backend/resolve/main/tests/test_e2e.py
- Command line
-
hf download hf://spaces/OpenVar/backend/tests/test_e2e.py
-
curl -L -o test_e2e.py https://huggingface.co/spaces/OpenVar/backend/resolve/main/tests/test_e2e.py
2.37 kB
| import pytest | |
| from playwright.sync_api import sync_playwright, expect | |
| BASE_URL = "http://localhost:3000" | |
| API_URL = "http://localhost:8000" | |
| class TestE2E: | |
| def setup(self, browser): | |
| self.context = browser.new_context() | |
| self.page = self.context.new_page() | |
| yield | |
| self.context.close() | |
| def test_homepage_loads(self): | |
| """Test that homepage loads successfully""" | |
| self.page.goto(BASE_URL) | |
| expect(self.page).to_have_title(/OpenVar/) | |
| expect(self.page.get_by_text("Clinical Variant Interpretation")).to_be_visible() | |
| def test_search_variants(self): | |
| """Test variant search functionality""" | |
| self.page.goto(BASE_URL) | |
| # Fill in search input | |
| search_input = self.page.get_by_placeholder("Search variants") | |
| search_input.fill("chr9-135800978-A-G") | |
| # Click search button | |
| self.page.get_by_role("button", name="Search").click() | |
| # Wait for results (or no results message) | |
| self.page.wait_for_timeout(1000) | |
| def test_genes_page(self): | |
| """Test genes page loads""" | |
| self.page.goto(f"{BASE_URL}/genes") | |
| expect(self.page.get_by_text("Genes")).to_be_visible() | |
| def test_knowledge_page(self): | |
| """Test knowledge base page loads""" | |
| self.page.goto(f"{BASE_URL}/knowledge") | |
| expect(self.page.get_by_text("Knowledge Base")).to_be_visible() | |
| class TestAPIE2E: | |
| def test_api_health(self, request): | |
| """Test API health endpoint""" | |
| import httpx | |
| response = httpx.get(f"{API_URL}/health") | |
| assert response.status_code == 200 | |
| assert response.json()["status"] == "healthy" | |
| def test_api_genes_list(self): | |
| """Test API genes list""" | |
| import httpx | |
| response = httpx.get(f"{API_URL}/api/genes") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert isinstance(data, list) | |
| assert len(data) > 0 | |
| def test_api_auth_login(self): | |
| """Test API login""" | |
| import httpx | |
| response = httpx.post( | |
| f"{API_URL}/api/auth/login", | |
| json={"email": "demo@openvar.io", "password": "demo"} | |
| ) | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "access_token" in data | |