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