앱 단위·화면·통합 테스트

This commit is contained in:
Sn-Kinos
2026-10-04 01:43:10 +09:00
parent de44739e63
commit 4f6e1eac61
63 changed files with 14700 additions and 230 deletions
+29
View File
@@ -0,0 +1,29 @@
import 'dart:io';
import 'package:integration_test/integration_test_driver_extended.dart';
/// 구현 확인물 캡처 드라이버 — 화면마다 PNG 하나를 `build/captures/` 에 떨어뜨린다.
///
/// 드라이버는 호스트 VM 에서 도는 별개 프로그램이라 `--dart-define` 이 닿지 않는다.
/// 그래서 경로를 인자로 받지 않고 빌드 산출물 폴더에 모은 뒤 밖에서 옮긴다.
///
/// ```
/// export ANDROID_HOME=/opt/homebrew/share/android-commandlinetools
/// adb shell input keyevent KEYCODE_WAKEUP # ← 이거 빼먹으면 앱이 죽는다
/// fvm flutter drive --driver=test_driver/capture_driver.dart \
/// --target=integration_test/capture_f2_test.dart -d emulator-5554
/// ```
///
/// **화면을 먼저 깨워야 한다.** 잠긴 에뮬레이터에서는 창에 surface 가 없어
/// `takeScreenshot` 이 `PixelCopy … Window doesn't have a backing surface!` 로
/// **앱을 죽인다.** 드라이버는 그때 `DriverError: Service has disappeared` 만
/// 남기므로 원인이 화면 잠금이라는 게 로그에 드러나지 않는다 — logcat 을 봐야 나온다.
Future<void> main() => integrationDriver(
onScreenshot: (String name, List<int> bytes, [Map<String, Object?>? _]) async {
final file = File('build/captures/$name.png');
file.parent.createSync(recursive: true);
file.writeAsBytesSync(bytes);
stdout.writeln('[capture] ${file.path}');
return true;
},
);