3fefc550fe
- Django backend with DRF (clubs, wrestlers, trainers, exercises, templates, trainings, homework, locations, leistungstest) - Next.js 16 frontend with React, Shadcn UI, Tailwind - JWT authentication - Full CRUD for all entities - Calendar view for trainings - Homework management system - Leistungstest tracking
81 lines
2.6 KiB
Python
81 lines
2.6 KiB
Python
from playwright.sync_api import sync_playwright
|
|
import sys
|
|
|
|
def test_login_page():
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True)
|
|
page = browser.new_page()
|
|
|
|
# Navigate to login page
|
|
print("Navigating to login page...")
|
|
page.goto('http://localhost:3000/login')
|
|
page.wait_for_load_state('networkidle')
|
|
|
|
# Check page title
|
|
title = page.title()
|
|
print(f"Page title: {title}")
|
|
|
|
# Check for login form elements
|
|
print("Checking form elements...")
|
|
|
|
# Logo/branding
|
|
logo = page.locator('text=WrestleDesk').first
|
|
if logo.is_visible():
|
|
print("✓ Logo 'WrestleDesk' is visible")
|
|
else:
|
|
print("✗ Logo 'WrestleDesk' not found")
|
|
browser.close()
|
|
sys.exit(1)
|
|
|
|
# Username input
|
|
username_input = page.locator('input[id="username"]')
|
|
if username_input.is_visible():
|
|
print("✓ Username input is visible")
|
|
else:
|
|
print("✗ Username input not found")
|
|
browser.close()
|
|
sys.exit(1)
|
|
|
|
# Password input
|
|
password_input = page.locator('input[id="password"]')
|
|
if password_input.is_visible():
|
|
print("✓ Password input is visible")
|
|
else:
|
|
print("✗ Password input not found")
|
|
browser.close()
|
|
sys.exit(1)
|
|
|
|
# Submit button
|
|
submit_btn = page.locator('button[type="submit"]')
|
|
if submit_btn.is_visible():
|
|
print("✓ Submit button is visible")
|
|
print(f" Button text: {submit_btn.text_content()}")
|
|
else:
|
|
print("✗ Submit button not found")
|
|
browser.close()
|
|
sys.exit(1)
|
|
|
|
# Check for console errors
|
|
console_errors = []
|
|
page.on("console", lambda msg: console_errors.append(msg.text) if msg.type == "error" else None)
|
|
|
|
# Reload to capture console errors
|
|
page.reload()
|
|
page.wait_for_load_state('networkidle')
|
|
|
|
if console_errors:
|
|
print(f"⚠ Console errors found: {console_errors}")
|
|
else:
|
|
print("✓ No console errors")
|
|
|
|
# Take screenshot
|
|
screenshot_path = '/tmp/login_page.png'
|
|
page.screenshot(path=screenshot_path, full_page=True)
|
|
print(f"✓ Screenshot saved to {screenshot_path}")
|
|
|
|
browser.close()
|
|
print("\n✅ All tests passed!")
|
|
|
|
if __name__ == "__main__":
|
|
test_login_page()
|