Files
Andrej Spielmann 3fefc550fe Initial commit: WrestleDesk full project
- 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
2026-03-26 13:24:57 +01:00

102 lines
3.9 KiB
Python

from playwright.sync_api import sync_playwright
import sys
def test_all_pages():
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
console_errors = []
page.on("console", lambda msg: console_errors.append(msg.text) if msg.type == "error" else None)
# Login first
print("Logging in...")
page.goto('http://localhost:3000/login')
page.wait_for_load_state('networkidle')
page.fill('input[id="username"]', 'admin')
page.fill('input[id="password"]', 'admin123')
page.click('button[type="submit"]')
page.wait_for_url('**/dashboard**', timeout=10000)
print("✓ Logged in\n")
# Test dashboard
print("Testing Dashboard...")
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/01_dashboard.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Navigate to wrestlers
print("Testing Wrestlers page...")
page.click('text=Ringer')
page.wait_for_url('**/wrestlers**', timeout=5000)
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/02_wrestlers.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Navigate to trainers
print("Testing Trainers page...")
page.click('text=Trainer')
page.wait_for_url('**/trainers**', timeout=5000)
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/03_trainers.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Navigate to exercises
print("Testing Exercises page...")
page.click('text=Übungen')
page.wait_for_url('**/exercises**', timeout=5000)
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/04_exercises.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Navigate to trainings
print("Testing Trainings page...")
page.click('text=Training')
page.wait_for_url('**/trainings**', timeout=5000)
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/05_trainings.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Navigate to homework
print("Testing Homework page...")
page.click('text=Hausaufgaben')
page.wait_for_url('**/homework**', timeout=5000)
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/06_homework.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Navigate to clubs
print("Testing Clubs page...")
page.click('text=Clubs')
page.wait_for_url('**/clubs**', timeout=5000)
page.wait_for_load_state('networkidle')
h1 = page.locator('h1').first
print(f" Title: {h1.text_content()}")
page.screenshot(path='/tmp/07_clubs.png', full_page=True)
print(" ✓ Screenshot saved\n")
# Check for console errors
if console_errors:
print(f"⚠ Console errors: {console_errors}")
else:
print("✓ No console errors")
browser.close()
print("\n✅ All page tests passed!")
print("Screenshots saved to /tmp/01_dashboard.png through /tmp/07_clubs.png")
if __name__ == "__main__":
test_all_pages()