mirror of
https://github.com/johndoe6345789/docker-swarm-termina.git
synced 2026-04-24 13:45:01 +00:00
Created a Node.js mock backend server that responds to API endpoints
needed for e2e tests:
- POST /api/auth/login - handles login (admin/admin123)
- POST /api/auth/logout - handles logout
- GET /api/containers - returns mock container data
- Container operations (start, stop, restart, delete, exec)
- GET /health - health check endpoint
Updated Playwright config to start both the mock backend (port 5000)
and the frontend dev server (port 3000) before running tests.
Test Results:
✓ 3/11 e2e tests now passing (all login page UI tests)
✗ 8/11 e2e tests failing (navigation/API integration issues)
The passing tests prove the button text fix ("Sign In") works correctly.
Remaining failures appear to be API communication issues between frontend
and mock backend that need further debugging.
https://claude.ai/code/session_01T57NPQfoRb2fS7ihdWkTxq
39 lines
952 B
TypeScript
39 lines
952 B
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: [
|
|
['html', { outputFolder: 'playwright-report' }],
|
|
['list'],
|
|
],
|
|
use: {
|
|
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
],
|
|
webServer: process.env.CI ? undefined : [
|
|
{
|
|
command: 'node e2e/mock-backend.js',
|
|
url: 'http://localhost:5000/health',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 10 * 1000,
|
|
},
|
|
{
|
|
command: 'npm run dev',
|
|
url: 'http://localhost:3000',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120 * 1000,
|
|
},
|
|
],
|
|
});
|