/** * Smoke Test: EuchreCamp Application * * This test suite provides comprehensive acceptance/regression testing * for the core functionality of the EuchreCamp application. */ import { test, expect } from '@playwright/test' test.describe('Smoke Test: EuchreCamp Application', () => { test.describe('Admin Panel Navigation', () => { test('should navigate to admin dashboard', async ({ page }) => { await page.goto('/admin') // Admin dashboard should be visible await expect(page.locator('text=Admin')).toBeVisible() }) test('should navigate to matches admin page', async ({ page }) => { await page.goto('/admin/matches') await expect(page.locator('text=Match Management')).toBeVisible() }) test('should navigate to players admin page', async ({ page }) => { await page.goto('/admin/players') await expect(page.locator('text=Player Management')).toBeVisible() }) test('should navigate to users admin page', async ({ page }) => { await page.goto('/admin/users') await expect(page.locator('text=User Management')).toBeVisible() }) }) test.describe('Match Management', () => { test('should display matches page', async ({ page }) => { await page.goto('/admin/matches') // Verify page header is visible await expect(page.locator('text=Match Management')).toBeVisible() // Page should load successfully - verify either table or empty state is present const hasTable = await page.locator('table').count().then(c => c > 0) const hasEmptyState = await page.locator('text=/no matches|No matches/').count().then(c => c > 0) // At least one should be present expect(hasTable || hasEmptyState).toBeTruthy() }) test('should have delete button for matches when matches exist', async ({ page }) => { await page.goto('/admin/matches') // Check if delete buttons exist in the table const deleteButtons = page.locator('button:has-text("Delete")') const count = await deleteButtons.count() // Table might be empty, but if there are matches, delete buttons should exist if (count > 0) { await expect(page.locator('text=Actions')).toBeVisible() } }) }) test.describe('Player Management', () => { test('should display players table', async ({ page }) => { await page.goto('/admin/players') await expect(page.locator('table')).toBeVisible() await expect(page.locator('text=Player Name')).toBeVisible() await expect(page.locator('text=Current Elo')).toBeVisible() await expect(page.locator('text=Actions')).toBeVisible() }) test('should have edit and delete buttons for players', async ({ page }) => { await page.goto('/admin/players') // At minimum, verify the Actions column exists await expect(page.locator('text=Actions')).toBeVisible() }) test('should allow editing player name', async ({ page }) => { await page.goto('/admin/players') // Click edit on first player const editButton = page.locator('button:has-text("Edit")').first() if (await editButton.isVisible()) { await editButton.click() // Verify edit modal appears await expect(page.locator('text=Edit Player Name')).toBeVisible() // Close modal await page.click('text=Cancel') await expect(page.locator('text=Edit Player Name')).not.toBeVisible() } }) }) test.describe('User Management', () => { test('should display users page', async ({ page }) => { await page.goto('/admin/users') // Page should load with either a table or "no users" message const hasTable = await page.locator('table').isVisible().catch(() => false) const hasNoUsers = await page.locator('text=No users found').isVisible().catch(() => false) // At least one of these should be true expect(hasTable || hasNoUsers).toBeTruthy() // Verify page header is visible await expect(page.locator('text=User Management')).toBeVisible() }) test('should have create user link', async ({ page }) => { await page.goto('/admin/users') // Check for the main create user link (with green button styling) const createLink = page.locator('a.bg-green-600:has-text("Create User")') await expect(createLink).toBeVisible() }) }) test.describe('Public Pages', () => { test('should display rankings page', async ({ page }) => { await page.goto('/rankings') // Rankings page should be accessible even when authenticated // Just verify the page loads without error await expect(page.locator('body')).toBeVisible() }) test('should display player profile page', async ({ page }) => { // Navigate to a player profile (using player ID 1 which should exist) await page.goto('/players/1/profile') // Profile page should be accessible even when authenticated // Just verify the page loads without error await expect(page.locator('body')).toBeVisible() }) }) })