Files
euchre_camp/e2e/admin-features.test.ts
T
david e455d5dba5
Build CI Images / build-ci-base (push) Successful in 1m53s
Release / release (push) Failing after 12m42s
fix: mount /apps and docker socket in PR workflow build-and-deploy-ci job (#41)
Reviewed-on: #41
Co-authored-by: David Gwilliam <dhgwilliam@gmail.com>
Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
2026-05-20 19:51:35 +00:00

99 lines
3.7 KiB
TypeScript

/**
* Admin Features Test: Match and Player Deletion
*
* This test suite specifically tests the new admin features:
* - Match deletion from admin panel
* - Player deletion from admin panel
*
* @chromium-admin - Tests that require admin authentication
*/
import { test, expect } from '@playwright/test'
import { prisma } from '@/lib/prisma'
test.describe.skip('Admin Features: Match and Player Management @chromium-admin', () => {
test.describe('Match Management', () => {
test('should access matches admin page', async ({ page }) => {
await page.goto('/admin/matches')
// Verify page loads
await expect(page.locator('text=Match Management')).toBeVisible()
})
test('should show delete buttons for matches', async ({ page }) => {
await page.goto('/admin/matches')
// Verify delete buttons exist in the table
const deleteButtons = page.locator('button:has-text("Delete")')
const count = await deleteButtons.count()
// Table might be empty, but the column should exist
await expect(page.locator('text=Actions')).toBeVisible()
})
test('should have proper match data structure', async ({ page }) => {
await page.goto('/admin/matches')
// Verify table headers (using more specific selectors)
await expect(page.locator('th:has-text("Date")')).toBeVisible()
await expect(page.locator('th:has-text("Tournament")')).toBeVisible()
await expect(page.locator('th:has-text("Team 1")')).toBeVisible()
await expect(page.locator('th:has-text("Score")').first()).toBeVisible()
await expect(page.locator('th:has-text("Team 2")')).toBeVisible()
})
})
test.describe('Player Management', () => {
test('should access players admin page', async ({ page }) => {
await page.goto('/admin/players')
// Verify page loads
await expect(page.locator('text=Player Management')).toBeVisible()
})
test('should show edit and delete buttons for players', async ({ page }) => {
await page.goto('/admin/players')
// Verify action buttons exist
await expect(page.locator('text=Actions')).toBeVisible()
})
test('should have proper player data structure', async ({ page }) => {
await page.goto('/admin/players')
// Verify table headers
await expect(page.locator('text=Player Name')).toBeVisible()
await expect(page.locator('text=Current Elo')).toBeVisible()
await expect(page.locator('text=Games')).toBeVisible()
await expect(page.locator('text=Record')).toBeVisible()
await expect(page.locator('text=Win Rate')).toBeVisible()
})
})
test.describe('API Endpoints', () => {
test('should have matches API endpoint', async ({ page }) => {
// Try to access the matches API
const response = await page.request.get('/api/matches')
expect(response.ok()).toBeTruthy()
})
test('should have players admin API endpoint', async ({ page }) => {
// Try to access the players API
const response = await page.request.get('/api/players')
expect(response.ok()).toBeTruthy()
})
})
test.describe('Navigation Updates', () => {
test('should show admin links when authenticated', async ({ page }) => {
// Go to admin page (already authenticated via chromium-admin project)
await page.goto('/admin')
// Verify admin links ARE visible (using exact text matching)
await expect(page.locator('a:has-text("Admin")').first()).toBeVisible()
await expect(page.locator('a:has-text("Matches")').first()).toBeVisible()
await expect(page.locator('a:has-text("Players")').first()).toBeVisible()
await expect(page.locator('a:has-text("Users")').first()).toBeVisible()
})
})
})