Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/playwright/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
from playwright.sync_api import APIRequestContext, Page, Playwright
import pytest

# First-Party
from mcpgateway.config import Settings

# Get configuration from environment
BASE_URL = os.getenv("TEST_BASE_URL", "http://localhost:8000")
API_TOKEN = os.getenv("MCP_AUTH", "test-token")
Expand Down Expand Up @@ -85,8 +88,14 @@ def authenticated_page(page: Page) -> Page:
@pytest.fixture
def admin_page(page: Page):
"""Provide a logged-in admin page for UI tests."""
settings = Settings()
# Go directly to admin - HTTP Basic Auth is handled by the page fixture
page.goto("/admin")
# Handle login page redirect if auth is required
if re.search(r"login", page.url):
page.fill('[name="email"]', settings.basic_auth_user)
page.fill('[name="password"]', settings.basic_auth_password.get_secret_value())
page.click('button[type="submit"]')
# Verify we're on the admin page
page.wait_for_url(re.compile(r".*admin"))
return page
Expand Down
Loading