mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-02 00:02:19 -07:00
refactor UI backend calls to python endpoints
This commit is contained in:
47
test/ui/conftest.py
Normal file
47
test/ui/conftest.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Pytest configuration and fixtures for UI tests
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add test directory to path
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
|
||||
from test_helpers import get_driver, get_api_token, BASE_URL, API_BASE_URL # noqa: E402 [flake8 lint suppression]
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def driver():
|
||||
"""Provide a Selenium WebDriver instance for each test"""
|
||||
driver_instance = get_driver()
|
||||
if not driver_instance:
|
||||
pytest.skip("Browser not available")
|
||||
|
||||
yield driver_instance
|
||||
|
||||
driver_instance.quit()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def api_token():
|
||||
"""Provide API token for the session"""
|
||||
token = get_api_token()
|
||||
if not token:
|
||||
pytest.skip("API token not available")
|
||||
return token
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def base_url():
|
||||
"""Provide base URL for UI"""
|
||||
return BASE_URL
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def api_base_url():
|
||||
"""Provide base URL for API"""
|
||||
return API_BASE_URL
|
||||
Reference in New Issue
Block a user