07b59ca4d8
Merge to Main - Full Pipeline / Stage 1: Fast Gates (push) Failing after 3s
Merge to Main - Full Pipeline / Stage 2: Critical Gates (push) Has been skipped
Merge to Main - Full Pipeline / Stage 3: Integration Tests (push) Has been skipped
Merge to Main - Full Pipeline / Stage 4: Build and Package (push) Has been skipped
Merge to Main - Full Pipeline / Stage 5: Deploy to Production (push) Has been skipped
Merge to Main - Full Pipeline / Pipeline Summary (push) Successful in 0s
- Changed expected content check from exact "Create" to regex match /Create|추가|사용자/i - Users/Create page uses Korean title "새 사용자 추가" (Add New User) - Test now properly validates page content in both English and Korean contexts - All 8 E2E tests now pass (7.0s total runtime) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
160 lines
5.0 KiB
TypeScript
160 lines
5.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Complete Admin Flow - All Pages', () => {
|
|
const BASE_URL = 'http://localhost:5000';
|
|
const LOGIN_URL = `${BASE_URL}/Account/Login`;
|
|
const ADMIN_DASHBOARD = `${BASE_URL}/Admin/Dashboard`;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
// 1. 로그인 페이지 접근
|
|
await page.goto(LOGIN_URL);
|
|
await expect(page).toHaveTitle(/Login|로그인/i);
|
|
|
|
// 2. 로그인 시도
|
|
await page.fill('#username', 'admin');
|
|
await page.fill('#password', 'quant123!');
|
|
await page.click('button[type="submit"]');
|
|
|
|
// 3. 로그인 후 리다이렉트 대기
|
|
await page.waitForURL(/Admin|Dashboard/);
|
|
});
|
|
|
|
test('Admin Dashboard 접근 가능', async ({ page }) => {
|
|
console.log('Testing: Admin Dashboard');
|
|
await page.goto(ADMIN_DASHBOARD);
|
|
|
|
// 페이지 로드 확인
|
|
await expect(page).toHaveTitle(/Dashboard|대시보드/i);
|
|
|
|
// 주요 엘리먼트 확인
|
|
const body = await page.content();
|
|
expect(body).toContain('Dashboard');
|
|
|
|
console.log('✓ Dashboard loaded successfully');
|
|
});
|
|
|
|
test('Admin Users 페이지 접근', async ({ page }) => {
|
|
console.log('Testing: Users Page');
|
|
await page.goto(`${BASE_URL}/Admin/Users`);
|
|
|
|
// 페이지 로드 확인
|
|
const statusCode = (await page.goto(`${BASE_URL}/Admin/Users`)).status();
|
|
expect([200, 301, 302]).toContain(statusCode);
|
|
|
|
const content = await page.content();
|
|
expect(content).not.toContain('500');
|
|
expect(content).not.toContain('error');
|
|
|
|
console.log('✓ Users page accessible');
|
|
});
|
|
|
|
test('Admin Collection 페이지 접근', async ({ page }) => {
|
|
console.log('Testing: Collection Page');
|
|
const response = await page.goto(`${BASE_URL}/Admin/Collection`);
|
|
|
|
expect(response?.status()).toBeLessThan(400);
|
|
const content = await page.content();
|
|
expect(content).not.toContain('500');
|
|
|
|
console.log('✓ Collection page accessible');
|
|
});
|
|
|
|
test('Admin Monitoring 페이지 접근', async ({ page }) => {
|
|
console.log('Testing: Monitoring Page');
|
|
const response = await page.goto(`${BASE_URL}/Admin/Monitoring`);
|
|
|
|
expect(response?.status()).toBeLessThan(400);
|
|
const content = await page.content();
|
|
expect(content).not.toContain('500');
|
|
|
|
console.log('✓ Monitoring page accessible');
|
|
});
|
|
|
|
test('Admin Operations 페이지 접근', async ({ page }) => {
|
|
console.log('Testing: Operations Page');
|
|
const response = await page.goto(`${BASE_URL}/Admin/Operations`);
|
|
|
|
expect(response?.status()).toBeLessThan(400);
|
|
const content = await page.content();
|
|
expect(content).not.toContain('500');
|
|
|
|
console.log('✓ Operations page accessible');
|
|
});
|
|
|
|
test('Users Create 페이지 접근', async ({ page }) => {
|
|
console.log('Testing: Users Create Page');
|
|
const response = await page.goto(`${BASE_URL}/Admin/Users/Create`);
|
|
|
|
expect(response?.status()).toBeLessThan(400);
|
|
const content = await page.content();
|
|
expect(content).not.toContain('500');
|
|
expect(content).toMatch(/Create|추가|사용자/i);
|
|
|
|
console.log('✓ Users Create page accessible');
|
|
});
|
|
|
|
test('모든 Admin 페이지가 200 이상 500 미만 상태코드 반환', async ({ page }) => {
|
|
console.log('Testing: All Admin Pages Status Codes');
|
|
|
|
const adminPages = [
|
|
'/Admin/Dashboard',
|
|
'/Admin/Users',
|
|
'/Admin/Collection',
|
|
'/Admin/Monitoring',
|
|
'/Admin/Operations',
|
|
'/Admin/Users/Create',
|
|
];
|
|
|
|
const results = [];
|
|
|
|
for (const path of adminPages) {
|
|
const fullUrl = `${BASE_URL}${path}`;
|
|
const response = await page.goto(fullUrl);
|
|
const status = response?.status() || 0;
|
|
|
|
results.push({
|
|
path,
|
|
status,
|
|
success: status >= 200 && status < 500,
|
|
});
|
|
|
|
console.log(` ${path} → ${status} ${status >= 200 && status < 500 ? '✓' : '❌'}`);
|
|
|
|
// 각 페이지에서 500 에러가 없는지 확인
|
|
const content = await page.content();
|
|
expect(content).not.toContain('500');
|
|
expect(content).not.toContain('System.InvalidOperationException');
|
|
}
|
|
|
|
// 모든 페이지가 정상인지 확인
|
|
const allSuccess = results.every(r => r.success);
|
|
expect(allSuccess).toBe(true);
|
|
|
|
console.log('\n✅ All Admin pages passed');
|
|
});
|
|
|
|
test('로그아웃 후 보호된 페이지 접근 불가', async ({ page }) => {
|
|
console.log('Testing: Access Control');
|
|
|
|
// 대시보드 접근 가능 확인
|
|
let response = await page.goto(ADMIN_DASHBOARD);
|
|
expect(response?.status()).toBeLessThan(400);
|
|
|
|
// 로그아웃 (쿠키 삭제)
|
|
await page.context().clearCookies();
|
|
|
|
// 보호된 페이지 접근 시도
|
|
response = await page.goto(ADMIN_DASHBOARD);
|
|
|
|
// 로그인 페이지로 리다이렉트되거나 401/403 에러
|
|
const url = page.url();
|
|
expect(
|
|
url.includes('/Account/Login') ||
|
|
url.includes('/Account/AccessDenied') ||
|
|
(response?.status() && [401, 403].includes(response.status()))
|
|
).toBe(true);
|
|
|
|
console.log('✓ Access control working correctly');
|
|
});
|
|
});
|