Features: - Add auth module (utils/auth.py) for Yonyou BIP login/logout - Add environment configuration support with python-dotenv - Add Playwright browser automation with customizable path - Add comprehensive test suite (tests/) with login/logout tests - Add dependency management (requirements.txt) - Add environment variable template (.env.example) Key capabilities: - Login with username/password from environment variables - Auto-handle force login popup - Logout with confirmation dialog handling - Configurable headless mode and HTTPS error handling - Auto-close browser option Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""
|
|
Test if auth module configuration is correct
|
|
"""
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
from dotenv import load_dotenv
|
|
from pathlib import Path
|
|
import os
|
|
|
|
# Load environment variables
|
|
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
|
load_dotenv(PROJECT_ROOT / ".env")
|
|
|
|
# Configure browser path
|
|
os.environ["PLAYWRIGHT_BROWSERS_PATH"] = os.getenv("PLAYWRIGHT_BROWSERS_PATH")
|
|
|
|
print("=" * 50)
|
|
print("ERP System Configuration Check")
|
|
print("=" * 50)
|
|
|
|
# Display configuration information
|
|
print(f"Browser Path: {os.getenv('PLAYWRIGHT_BROWSERS_PATH')}")
|
|
print(f"ERP URL: {os.getenv('ERP_URL')}")
|
|
print(f"Username: {os.getenv('ERP_USERNAME')}")
|
|
print(f"Password: {'*' * len(os.getenv('ERP_PASSWORD', ''))}")
|
|
print(f"Headless Mode: {os.getenv('ERP_HEADLESS')}")
|
|
print(f"Ignore HTTPS Errors: {os.getenv('ERP_IGNORE_HTTPS_ERRORS')}")
|
|
print(f"Auto Close Browser: {os.getenv('ERP_AUTO_CLOSE_BROWSER')}")
|
|
|
|
print("\n" + "=" * 50)
|
|
print("Check Playwright Browser")
|
|
print("=" * 50)
|
|
|
|
with sync_playwright() as p:
|
|
chromium_path = p.chromium.executable_path
|
|
print(f"Chromium Path: {chromium_path}")
|
|
|
|
# Check if browser file exists
|
|
if os.path.exists(chromium_path):
|
|
print("[OK] Browser file exists")
|
|
else:
|
|
print("[ERROR] Browser file not found")
|
|
|
|
print("\n[OK] Configuration check completed!")
|