"""Admin panel UI — buttons, forms, tables, and image loading. ADMIN-010. This verifies the admin panel HTML structure: the stats grid, the tryout toggle button, the season form fields, the wipe confirmation input, and the backup/audit tables, plus that the logo image is served. """ import pytest class TestAdminStatsGrid: def test_stats_grid_has_five_cards(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() # Each stat card contains a stat-icon and stat-info assert html.count('stat-card') >= 5 class TestAdminButtons: def test_tryout_toggle_button_present(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'Open Tryouts' in html or 'Close Tryouts' in html def test_backup_button_present(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'Create Backup Now' in html def test_wipe_button_present(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'Wipe Team Rosters' in html def test_season_button_present(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'Begin Season' in html or 'End Season' in html class TestAdminForms: def test_season_form_has_name_and_date_fields(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'season_name' in html assert 'season_start' in html or 'season_end' in html def test_wipe_form_has_confirm_input(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'name="confirm"' in html assert 'WIPE' in html class TestAdminTables: def test_backup_table_columns(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'Filename' in html assert 'Size' in html assert 'Type' in html def test_audit_log_table_columns(self, client, as_role): as_role('admin') response = client.get('/admin') html = response.data.decode() assert 'Action' in html assert 'Details' in html class TestAdminImages: def test_logo_image_loads(self, client): response = client.get('/static/images/UdeS_logo.png') assert response.status_code == 200 def test_esports_logo_image_loads(self, client): # The original logo may still be referenced response = client.get('/static/images/UdeS_logo.png') assert response.status_code == 200