diff --git a/test/decisions_test.dart b/test/decisions_test.dart index 9b38cc6..a3a7226 100644 --- a/test/decisions_test.dart +++ b/test/decisions_test.dart @@ -128,8 +128,16 @@ void main() { await tester.pumpAndSettle(); expect(find.text('이번 업데이트로 바뀐 기본 설정'), findsOneWidget); await tester.tap(find.text('확인')); - // 파일 쓰기 (진짜 입출력) 가 끝나게 몇 번 돌려 준다 - for (var i = 0; i < 20; i++) { + // 파일 쓰기 (진짜 입출력) 가 끝날 때까지 (정해 둔 시간이 아니라 파일에 실제로 쓰일 때까지 - 전체 시험 중 느려도 흔들리지 않게) + for (var i = 0; i < 200; i++) { + final now = await tester.runAsync(() async { + try { + return (await SettingsStore(file, MemorySecretStore()).load()).migrated; + } catch (_) { + return null; // 쓰는 도중 + } + }); + if (now != null && now.isEmpty) break; await tester.runAsync(() => Future.delayed(const Duration(milliseconds: 50))); await tester.pump(); } diff --git a/test/drop_test.dart b/test/drop_test.dart index 9f5b2ac..63eaa64 100644 --- a/test/drop_test.dart +++ b/test/drop_test.dart @@ -81,9 +81,12 @@ void main() { for (var i = 0; i < 250 && c.videos.isEmpty; i++) { await Future.delayed(const Duration(milliseconds: 20)); } - await Future.delayed(const Duration(milliseconds: 100)); }); - await tester.pump(); + // 안내가 뜰 때까지 (정해 둔 시간이 아니라 - 전체 시험 중 느려도 흔들리지 않게) + for (var i = 0; i < 100 && find.textContaining('동영상 목록에 1개를 추가했습니다').evaluate().isEmpty; i++) { + await tester.runAsync(() => Future.delayed(const Duration(milliseconds: 50))); + await tester.pump(); + } expect([for (final v in c.videos) v.fileName], ['끌어온 영상.mp4']); expect(c.selected, c.videos.single); expect(find.textContaining('여기에 놓으면'), findsNothing); @@ -92,12 +95,10 @@ void main() { // 같은 것을 다시 놓으면 "이미 있음" await _native(tester, 'entered', [400.0, 300.0]); await tester.pump(); - await tester.runAsync(() async { - await _native(tester, 'performOperation', [file]); - await Future.delayed(const Duration(milliseconds: 1000)); - }); - // 앞의 안내가 사라지고 새 안내가 나올 때까지 - for (var i = 0; i < 10; i++) { + await tester.runAsync(() => _native(tester, 'performOperation', [file])); + // 앞의 안내가 사라지고 새 안내가 나올 때까지 (될 때까지 기다림, 최대 10초) + for (var i = 0; i < 50 && find.textContaining('이미 동영상 목록에 있습니다').evaluate().isEmpty; i++) { + await tester.runAsync(() => Future.delayed(const Duration(milliseconds: 50))); await tester.pump(const Duration(milliseconds: 200)); } expect(c.videos, hasLength(1));