From f9a4ae105a4ced8e4fa97bb6e0a2c4d206fa5ddc Mon Sep 17 00:00:00 2001 From: JiWoong Sul Date: Wed, 14 Jan 2026 02:26:27 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EC=83=88=20=EC=BA=90=EB=A6=AD=ED=84=B0?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/features/new_character_screen_test.dart | 42 ++++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/test/features/new_character_screen_test.dart b/test/features/new_character_screen_test.dart index 25e0ecc..15882da 100644 --- a/test/features/new_character_screen_test.dart +++ b/test/features/new_character_screen_test.dart @@ -5,10 +5,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; /// 테스트용 MaterialApp 래퍼 (localization 포함) +/// locale을 영어로 고정하여 테스트 텍스트와 일치시킴 Widget _buildTestApp(Widget child) { return MaterialApp( localizationsDelegates: L10n.localizationsDelegates, supportedLocales: L10n.supportedLocales, + locale: const Locale('en'), // 영어 locale 고정 home: child, ); } @@ -20,23 +22,25 @@ void main() { NewCharacterScreen(onCharacterCreated: (_, {bool testMode = false}) {}), ), ); + // Localization 로드 대기 + await tester.pumpAndSettle(); // 화면 타이틀 확인 (l10n 적용됨) - expect(find.text('ASCII NEVER DIE - New Character'), findsOneWidget); + expect(find.text('ASCII NEVER DIE - NEW CHARACTER'), findsOneWidget); - // 종족 섹션 확인 - expect(find.text('Race'), findsOneWidget); + // 종족 섹션 확인 (대문자 하드코딩) + expect(find.text('RACE'), findsOneWidget); - // 직업 섹션 확인 - expect(find.text('Class'), findsOneWidget); + // 직업 섹션 확인 (대문자 하드코딩) + expect(find.text('CLASS'), findsOneWidget); - // 능력치 섹션 확인 - expect(find.text('Stats'), findsOneWidget); + // 능력치 섹션 확인 (대문자 하드코딩) + expect(find.text('STATS'), findsOneWidget); expect(find.text('STR'), findsOneWidget); expect(find.text('CON'), findsOneWidget); // Sold! 버튼 확인 - expect(find.text('Sold!'), findsOneWidget); + expect(find.text('SOLD!'), findsOneWidget); }); testWidgets('Unroll button exists and can be tapped', (tester) async { @@ -45,17 +49,18 @@ void main() { NewCharacterScreen(onCharacterCreated: (_, {bool testMode = false}) {}), ), ); + await tester.pumpAndSettle(); - // Unroll 버튼 확인 - final unrollButton = find.text('Unroll'); + // Unroll 버튼 확인 (RetroTextButton이 대문자로 변환) + final unrollButton = find.text('UNROLL'); expect(unrollButton, findsOneWidget); // Unroll 버튼 탭 await tester.tap(unrollButton); - await tester.pump(); + await tester.pumpAndSettle(); - // Total이 표시되는지 확인 - expect(find.textContaining('Total'), findsOneWidget); + // Total이 표시되는지 확인 (TOTAL은 대문자로 표시됨) + expect(find.textContaining('TOTAL'), findsOneWidget); }); testWidgets('Sold button creates character with generated name', ( @@ -72,17 +77,18 @@ void main() { ), ), ); + await tester.pumpAndSettle(); // Sold! 버튼이 보이도록 스크롤 await tester.scrollUntilVisible( - find.text('Sold!'), + find.text('SOLD!'), 500.0, scrollable: find.byType(Scrollable).first, ); await tester.pumpAndSettle(); // Sold! 버튼 탭 - await tester.tap(find.text('Sold!')); + await tester.tap(find.text('SOLD!')); await tester.pumpAndSettle(); // 콜백이 호출되었는지 확인 @@ -99,6 +105,7 @@ void main() { NewCharacterScreen(onCharacterCreated: (_, {bool testMode = false}) {}), ), ); + await tester.pumpAndSettle(); // 능력치 라벨들이 표시되는지 확인 expect(find.text('STR'), findsOneWidget); @@ -108,8 +115,8 @@ void main() { expect(find.text('WIS'), findsOneWidget); expect(find.text('CHA'), findsOneWidget); - // Total 라벨 확인 - expect(find.textContaining('Total'), findsOneWidget); + // Total 라벨 확인 (TOTAL은 대문자로 표시됨) + expect(find.textContaining('TOTAL'), findsOneWidget); }); testWidgets('Name text field exists', (tester) async { @@ -118,6 +125,7 @@ void main() { NewCharacterScreen(onCharacterCreated: (_, {bool testMode = false}) {}), ), ); + await tester.pumpAndSettle(); // TextField 확인 (이름 입력 필드) expect(find.byType(TextField), findsOneWidget);