@@ -463,20 +463,24 @@ void main() {
463
463
.isA <Icon >().color.isNotNull ().isSameColorAs (expectedIconColor);
464
464
}
465
465
466
- group ('attach from media library' , () {
467
- testWidgets ('success' , (tester) async {
468
- TypingNotifier .debugEnable = false ;
469
- addTearDown (TypingNotifier .debugReset);
466
+ Future <void > prepare (WidgetTester tester) async {
467
+ TypingNotifier .debugEnable = false ;
468
+ addTearDown (TypingNotifier .debugReset);
470
469
471
- final channel = eg.stream ();
472
- final narrow = ChannelNarrow (channel.streamId);
473
- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
470
+ final channel = eg.stream ();
471
+ final narrow = ChannelNarrow (channel.streamId);
472
+ await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
474
473
475
- // (When we check that the send button looks disabled, it should be because
476
- // the file is uploading, not a pre-existing reason.)
477
- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
478
- controller! .content.value = const TextEditingValue (text: 'see image: ' );
479
- await tester.pump ();
474
+ // (When we check that the send button looks disabled, it should be because
475
+ // the file is uploading, not a pre-existing reason.)
476
+ await enterTopic (tester, narrow: narrow, topic: 'some topic' );
477
+ controller! .content.value = const TextEditingValue (text: 'see image: ' );
478
+ await tester.pump ();
479
+ }
480
+
481
+ group ('attach from media library' , () {
482
+ testWidgets ('success' , (tester) async {
483
+ await prepare (tester);
480
484
checkAppearsLoading (tester, false );
481
485
482
486
testBinding.pickFilesResult = FilePickerResult ([PlatformFile (
@@ -525,18 +529,7 @@ void main() {
525
529
526
530
group ('attach from camera' , () {
527
531
testWidgets ('success' , (tester) async {
528
- TypingNotifier .debugEnable = false ;
529
- addTearDown (TypingNotifier .debugReset);
530
-
531
- final channel = eg.stream ();
532
- final narrow = ChannelNarrow (channel.streamId);
533
- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
534
-
535
- // (When we check that the send button looks disabled, it should be because
536
- // the file is uploading, not a pre-existing reason.)
537
- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
538
- controller! .content.value = const TextEditingValue (text: 'see image: ' );
539
- await tester.pump ();
532
+ await prepare (tester);
540
533
checkAppearsLoading (tester, false );
541
534
542
535
testBinding.pickImageResult = XFile .fromData (
0 commit comments