feat: SDLC database separation for CI/testing #35

Merged
david merged 12 commits from feat/e2e-test-improvements into main 2026-05-11 06:40:06 +00:00
3 changed files with 17 additions and 8 deletions
Showing only changes of commit 413ebaeaee - Show all commits
+1 -1
View File
@@ -46,7 +46,7 @@ jobs:
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
- name: Run acceptance tests
run: DATABASE_URL="${{ vars.CI_DATABASE_URL }}" bun test:acceptance
run: DATABASE_URL="${{ secrets.CI_DATABASE_URL }}" bun test:acceptance
env:
CI: true
+1 -1
View File
@@ -21,7 +21,7 @@ export default defineConfig({
globalTeardown: require.resolve('./e2e/global.teardown'),
// Use base URL for relative navigation
use: {
baseURL: 'http://localhost:3000',
baseURL: process.env.CI ? 'https://euchre-ci.notsosm.art' : 'http://localhost:3000',
// Collect trace when retrying the failed test.
trace: 'on-first-retry',
// Capture screenshot only on failure
+15 -6
View File
@@ -8,6 +8,7 @@
import { describe, it, expect, mock, beforeEach, afterEach } from 'bun:test'
import { render, screen, waitFor } from '@testing-library/react'
import Navigation from '@/components/Navigation'
import { RoleSwitcherProvider } from '@/components/RoleSwitcher'
// Mock next/link
mock.module('next/link', () => ({
@@ -31,6 +32,14 @@ mock.module('@/lib/auth-client', () => ({
// Mock fetch for role API call
global.fetch = mock(async () => new Response()) as any
function renderNavigation() {
return render(
<RoleSwitcherProvider>
<Navigation />
</RoleSwitcherProvider>
)
}
import { useSession as useSessionOriginal } from '@/components/SessionProvider'
const useSession = useSessionOriginal as any
@@ -61,7 +70,7 @@ describe('Epic 1: Navigation Component', () => {
refreshSession: mock(() => {}),
})
render(<Navigation />)
renderNavigation()
expect(screen.getByText('EuchreCamp')).toBeInTheDocument()
expect(screen.getByText('Rankings')).toBeInTheDocument()
@@ -84,7 +93,7 @@ describe('Epic 1: Navigation Component', () => {
refreshSession: mock(() => {}),
})
render(<Navigation />)
renderNavigation()
await waitFor(() => {
expect(screen.getByText('Test User')).toBeInTheDocument()
@@ -109,7 +118,7 @@ describe('Epic 1: Navigation Component', () => {
refreshSession: mock(() => {}),
})
render(<Navigation />)
renderNavigation()
await waitFor(() => {
expect(screen.getByText('Tournaments')).toBeInTheDocument()
@@ -142,7 +151,7 @@ describe('Epic 1: Navigation Component', () => {
return new Response(JSON.stringify({}), { status: 200 })
})
render(<Navigation />)
renderNavigation()
await waitFor(() => {
expect(screen.getByText('Admin')).toBeInTheDocument()
@@ -177,7 +186,7 @@ describe('Epic 1: Navigation Component', () => {
} as Response
})
render(<Navigation />)
renderNavigation()
await waitFor(() => {
expect(screen.getByText('Tournaments')).toBeInTheDocument()
@@ -192,7 +201,7 @@ describe('Epic 1: Navigation Component', () => {
refreshSession: mock(() => {}),
})
render(<Navigation />)
renderNavigation()
expect(screen.getByText('Loading...')).toBeInTheDocument()
})