Replace static post-installation configuration with dynamic test-time configuration to support testing multiple MCP server deployments. Changes: - Remove static MCP server URL and OAuth client setup from post-installation - Add configure_astrolabe_for_mcp_server fixture (session-scoped) - Fixture dynamically configures: * Nextcloud system config (mcp_server_url, mcp_server_public_url) * OAuth client creation via occ oidc:create * Client credential storage (astrolabe_client_id, astrolabe_client_secret) - Update existing OAuth tests to use dynamic configuration - Add test_astrolabe_multi_server_integration.py with parametrized tests Benefits: - Test Astrolabe with mcp-oauth, mcp-keycloak, mcp-multi-user-basic - Each test configures for its specific MCP server - No static configuration conflicts between deployments - Cleaner post-installation (37 lines, down from 85) Test Results: - test_astrolabe_configuration_for_different_servers: PASSED (mcp-oauth, mcp-keycloak) - test_astrolabe_reconfiguration: PASSED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
84 lines
2.8 KiB
Python
84 lines
2.8 KiB
Python
"""Debug test to capture what's on the NC PHP app settings page."""
|
|
|
|
import logging
|
|
import os
|
|
|
|
import pytest
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
pytestmark = [pytest.mark.integration, pytest.mark.oauth]
|
|
|
|
|
|
async def test_capture_settings_page(browser, configure_astrolabe_for_mcp_server):
|
|
"""Capture what's actually rendered on the personal settings page."""
|
|
# Configure Astrolabe for mcp-oauth server
|
|
await configure_astrolabe_for_mcp_server(
|
|
mcp_server_internal_url="http://mcp-oauth:8001",
|
|
mcp_server_public_url="http://localhost:8001",
|
|
)
|
|
|
|
nextcloud_host = os.getenv("NEXTCLOUD_HOST", "http://localhost:8080")
|
|
username = os.getenv("NEXTCLOUD_USERNAME", "admin")
|
|
password = os.getenv("NEXTCLOUD_PASSWORD", "admin")
|
|
|
|
context = await browser.new_context()
|
|
page = await context.new_page()
|
|
|
|
try:
|
|
# Login
|
|
logger.info(f"Logging in to {nextcloud_host} as {username}...")
|
|
await page.goto(f"{nextcloud_host}/login")
|
|
await page.fill('input[name="user"]', username)
|
|
await page.fill('input[name="password"]', password)
|
|
await page.click('button[type="submit"]')
|
|
await page.wait_for_url(f"{nextcloud_host}/apps/dashboard/", timeout=10000)
|
|
logger.info("✓ Logged in")
|
|
|
|
# Navigate to settings
|
|
logger.info("Navigating to personal MCP settings...")
|
|
await page.goto(f"{nextcloud_host}/settings/user/mcp")
|
|
await page.wait_for_load_state("networkidle")
|
|
|
|
# Capture page content
|
|
page_content = await page.content()
|
|
|
|
# Save screenshot
|
|
screenshot_path = "/tmp/nc-php-app-settings-debug.png"
|
|
await page.screenshot(path=screenshot_path, full_page=True)
|
|
logger.info(f"Screenshot saved to: {screenshot_path}")
|
|
|
|
# Log what we found
|
|
logger.info(f"Page URL: {page.url}")
|
|
logger.info(f"Page title: {await page.title()}")
|
|
|
|
# Check for key strings
|
|
checks = [
|
|
"Authorize Access",
|
|
"Authorization Required",
|
|
"MCP Server",
|
|
"Sign In Again",
|
|
"astrolabe",
|
|
]
|
|
|
|
for check in checks:
|
|
found = check in page_content
|
|
logger.info(f" '{check}': {'FOUND' if found else 'NOT FOUND'}")
|
|
|
|
# Print first 500 chars of body
|
|
body = await page.locator("body").text_content()
|
|
logger.info(f"Body text (first 500 chars): {body[:500] if body else 'NO BODY'}")
|
|
|
|
# Try to find links
|
|
links = await page.locator("a").all_text_contents()
|
|
logger.info(f"Found {len(links)} links on page")
|
|
for i, link_text in enumerate(links[:10]):
|
|
logger.info(f" Link {i}: {link_text}")
|
|
|
|
# Check for error messages
|
|
if "error" in page_content.lower():
|
|
logger.warning("Page contains 'error' keyword")
|
|
|
|
finally:
|
|
await context.close()
|