mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 18:11:08 -05:00
- Add complete backend/ directory with full Django application - Add frontend/ directory with Vite + TypeScript setup ready for Next.js - Add comprehensive shared/ directory with: - Complete documentation and memory-bank archives - Media files and avatars (letters, park/ride images) - Deployment scripts and automation tools - Shared types and utilities - Add architecture/ directory with migration guides - Configure pnpm workspace for monorepo development - Update .gitignore to exclude .django_tailwind_cli/ build artifacts - Preserve all historical documentation in shared/docs/memory-bank/ - Set up proper structure for full-stack development with shared resources
92 lines
3.1 KiB
Python
92 lines
3.1 KiB
Python
from playwright.sync_api import expect, Page
|
|
|
|
|
|
def test_login_page(page: Page):
|
|
# Navigate to login page
|
|
page.goto("http://localhost:8000/accounts/login/")
|
|
|
|
# Check login form elements
|
|
expect(page.get_by_label("Username")).to_be_visible()
|
|
expect(page.get_by_label("Password")).to_be_visible()
|
|
expect(page.get_by_role("button", name="Sign In")).to_be_visible()
|
|
|
|
# Check social login buttons
|
|
expect(page.get_by_role("link", name="Sign in with Google")).to_be_visible()
|
|
expect(page.get_by_role("link", name="Sign in with Discord")).to_be_visible()
|
|
|
|
|
|
def test_successful_login(page: Page):
|
|
# Navigate to login page
|
|
page.goto("http://localhost:8000/accounts/login/")
|
|
|
|
# Fill in login form
|
|
page.get_by_label("Username").fill("testuser")
|
|
page.get_by_label("Password").fill("testpass123")
|
|
|
|
# Click login button
|
|
page.get_by_role("button", name="Sign In").click()
|
|
|
|
# Verify redirect to home page
|
|
expect(page).to_have_url("http://localhost:8000/")
|
|
expect(page.get_by_role("link", name="Profile")).to_be_visible()
|
|
|
|
|
|
def test_failed_login(page: Page):
|
|
# Navigate to login page
|
|
page.goto("http://localhost:8000/accounts/login/")
|
|
|
|
# Fill in incorrect credentials
|
|
page.get_by_label("Username").fill("wronguser")
|
|
page.get_by_label("Password").fill("wrongpass")
|
|
|
|
# Click login button
|
|
page.get_by_role("button", name="Sign In").click()
|
|
|
|
# Verify error message
|
|
expect(page.get_by_text("Invalid username or password")).to_be_visible()
|
|
|
|
|
|
def test_signup_page(page: Page):
|
|
# Navigate to signup page
|
|
page.goto("http://localhost:8000/accounts/signup/")
|
|
|
|
# Check signup form elements
|
|
expect(page.get_by_label("Username")).to_be_visible()
|
|
expect(page.get_by_label("Email")).to_be_visible()
|
|
expect(page.get_by_label("Password")).to_be_visible()
|
|
expect(page.get_by_label("Password (again)")).to_be_visible()
|
|
expect(page.get_by_role("button", name="Sign Up")).to_be_visible()
|
|
|
|
|
|
def test_successful_signup(page: Page):
|
|
# Navigate to signup page
|
|
page.goto("http://localhost:8000/accounts/signup/")
|
|
|
|
# Fill in signup form
|
|
page.get_by_label("Username").fill("newuser")
|
|
page.get_by_label("Email").fill("newuser@example.com")
|
|
page.get_by_label("Password").fill("newpass123")
|
|
page.get_by_label("Password (again)").fill("newpass123")
|
|
|
|
# Click signup button
|
|
page.get_by_role("button", name="Sign Up").click()
|
|
|
|
# Verify redirect to home page
|
|
expect(page).to_have_url("http://localhost:8000/")
|
|
expect(page.get_by_role("link", name="Profile")).to_be_visible()
|
|
|
|
|
|
def test_logout(page: Page):
|
|
# First login
|
|
page.goto("http://localhost:8000/accounts/login/")
|
|
page.get_by_label("Username").fill("testuser")
|
|
page.get_by_label("Password").fill("testpass123")
|
|
page.get_by_role("button", name="Sign In").click()
|
|
|
|
# Click logout
|
|
page.get_by_role("link", name="Logout").click()
|
|
|
|
# Verify redirect to home page and logged out state
|
|
expect(page).to_have_url("http://localhost:8000/")
|
|
expect(page.get_by_role("link", name="Login")).to_be_visible()
|