앱 단위·화면·통합 테스트
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// F0 공통 2화면 캡처. 방법은 `capture_common.dart` 참고.
|
||||
//
|
||||
// 하단 탭은 부분이 아니라 **앱 전체**를 띄워서 찍는다 — 탭 목록은 원격 플래그가
|
||||
// 정하므로 셸을 손으로 흉내내면 실제 빌드와 달라질 수 있다.
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:fancake/app.dart';
|
||||
import 'package:fancake/features/auth/auth.dart';
|
||||
import 'package:fancake/features/auth/auth_repository.dart';
|
||||
import 'package:fancake/features/notification/notification_screen.dart';
|
||||
|
||||
import 'capture_common.dart';
|
||||
|
||||
void main() {
|
||||
final cap = Capture();
|
||||
|
||||
setUpAll(cap.prepare);
|
||||
|
||||
testWidgets('F0 공통', (tester) async {
|
||||
// 실기기에서는 소셜 로그인을 통과해야 셸에 닿는데, 확정 4종 가운데
|
||||
// Google 만 열려 있고 그 계정은 이 에뮬레이터에 없다. 복원된 세션으로 연다 —
|
||||
// 로그인 이후의 화면이라는 사실은 같다.
|
||||
final auth = AuthRepository(
|
||||
session: const _RestoredSession(
|
||||
AuthAccount(uid: 'capture-user', provider: AuthProviderKind.google),
|
||||
),
|
||||
releaseMode: true,
|
||||
);
|
||||
addTearDown(auth.dispose);
|
||||
|
||||
await tester.pumpWidget(FancakeApp(auth: auth));
|
||||
await cap.settle(tester);
|
||||
await cap.shot('F0_01_하단탭');
|
||||
|
||||
await cap.capture(
|
||||
tester,
|
||||
'F0_02_알림',
|
||||
const NotificationScreen(repository: SampleNotificationRepository()),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
final class _RestoredSession implements AuthSession {
|
||||
const _RestoredSession(this.currentAccount);
|
||||
|
||||
@override
|
||||
final AuthAccount? currentAccount;
|
||||
|
||||
@override
|
||||
Stream<AuthAccount?> get accountChanges => const Stream.empty();
|
||||
|
||||
@override
|
||||
Future<void> signOut() async {}
|
||||
}
|
||||
Reference in New Issue
Block a user