Kord/apps/dashboard/e2e/dashboard.spec.ts

31 lines
1.3 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('BDD: E2E Dashboard Integration', () => {
test('Given the Dashboard is running, When user visits the root, Then the title should resolve', async ({ page }) => {
// Next.js 페이지 접속
await page.goto('/');
// 랜딩 렌더링 확인
// (현재 페이지 구조에 따라 expect 조건 변경 가능: 예: expect(page).toHaveTitle(/Kord/))
await expect(page).not.toBeNull();
});
test('Given the gRPC is exposed, When calling /api/grpc-test via E2E, Then it should proxy to Bot Layer', async ({ request }) => {
// API Route 호출 시뮬레이션
const response = await request.get('/api/grpc-test?msg=E2E_Test');
// HTTP 응답 검증
expect(response.ok()).toBeTruthy();
// 서버측 Payload 검증 (Dashboard -> gRPC -> Bot 통신 성공 여부)
const data = await response.json();
// 봇 내부의 로컬 핑이 죽어있거나 연결이 안되면 실패하게 됨으로써 E2E 구간 검증 가능
if (data.success) {
expect(data.reply).toContain('E2E_Test');
} else {
// 로컬 Bot 레이어가 내려가 있을 경우 실패 안내 (또는 Mock 설정 연동)
console.warn('Bot server might be offline, E2E gRPC test received: ', data.error);
}
});
});