Spaces:
Runtime error
Runtime error
Download test_server.py from rawwerks/handwriting-ocr: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/spaces/rawwerks/handwriting-ocr/resolve/a597e2b437b9a090d56adfdca4016b43f4974ac0/test_server.py
- Command line
-
hf download hf://spaces/rawwerks/handwriting-ocr@a597e2b437b9a090d56adfdca4016b43f4974ac0/test_server.py
-
curl -L -o test_server.py https://huggingface.co/spaces/rawwerks/handwriting-ocr/resolve/a597e2b437b9a090d56adfdca4016b43f4974ac0/test_server.py
1.36 kB
| import os | |
| import pytest | |
| import pytest_asyncio | |
| from playwright.async_api import async_playwright, expect | |
| import asyncio | |
| def event_loop(): | |
| policy = asyncio.get_event_loop_policy() | |
| loop = policy.new_event_loop() | |
| yield loop | |
| loop.close() | |
| async def test_space_loads(): | |
| """Test that we can access the Space and see the heading""" | |
| async with async_playwright() as playwright: | |
| browser = await playwright.chromium.launch(headless=False) | |
| page = await browser.new_page() | |
| try: | |
| # Navigate to the Space | |
| await page.goto("https://huggingface.co/spaces/rawwerks/handwriting-ocr") | |
| if os.getenv('PWDEBUG'): | |
| await page.pause() | |
| # Now look for the login button from Gradio | |
| print("Looking for login button...") | |
| login_button = page.get_by_role("button").filter(has_text="Login") | |
| await login_button.wait_for(state="visible", timeout=5000) | |
| print("Found login button, clicking...") | |
| if os.getenv('PWDEBUG'): | |
| await page.pause() | |
| await login_button.click() | |
| print("Clicked login button") | |
| finally: | |
| await browser.close() | |