import { render, screen } from '@testing-library/react' import '@testing-library/jest-dom' import React from 'react' import BuilderClientPage from '@/components/BuilderClientPage' import I18nProvider from '@/components/I18nProvider' import en from '@/messages/en.json' import ko from '@/messages/ko.json' function renderWith(locale: 'en' | 'ko') { const messages = locale === 'en' ? en : ko return render( }> ) } describe('i18n regression - key presence on main UI', () => { it('en: shows expected labels and buttons', () => { renderWith('en') expect(screen.getByRole('heading', { name: 'Landing Page Builder' })).toBeInTheDocument() expect(screen.getByLabelText('Title')).toBeInTheDocument() expect(screen.getByLabelText('Locale')).toBeInTheDocument() expect(screen.getByLabelText('Primary Color')).toBeInTheDocument() expect(screen.getByLabelText('Font Family')).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Export ZIP' })).toBeInTheDocument() // form actions expect(screen.getByRole('button', { name: 'Add Text' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Email' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Tel' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Date' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Textarea' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Checkbox' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Select' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add Radio' })).toBeInTheDocument() // preview expect(screen.getByRole('button', { name: 'Desktop' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Mobile' })).toBeInTheDocument() }) it('ko: shows expected labels and buttons', () => { renderWith('ko') expect(screen.getByRole('heading', { name: '랜딩 페이지 빌더' })).toBeInTheDocument() expect(screen.getByLabelText('제목')).toBeInTheDocument() expect(screen.getByLabelText('로케일')).toBeInTheDocument() expect(screen.getByLabelText('대표 색상')).toBeInTheDocument() expect(screen.getByLabelText('폰트')).toBeInTheDocument() expect(screen.getByRole('button', { name: 'ZIP 내보내기' })).toBeInTheDocument() // form actions expect(screen.getByRole('button', { name: '텍스트 필드 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '이메일 필드 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '전화번호 필드 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '날짜 필드 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '텍스트영역 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '체크박스 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '셀렉트 추가' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '라디오 추가' })).toBeInTheDocument() // preview expect(screen.getByRole('button', { name: 'Desktop' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Mobile' })).toBeInTheDocument() }) })