@@ -574,20 +574,24 @@ void main() {
574
574
.isA <Icon >().color.isNotNull ().isSameColorAs (expectedIconColor);
575
575
}
576
576
577
- group ('attach from media library' , () {
578
- testWidgets ('success' , (tester) async {
579
- TypingNotifier .debugEnable = false ;
580
- addTearDown (TypingNotifier .debugReset);
577
+ Future <void > prepare (WidgetTester tester) async {
578
+ TypingNotifier .debugEnable = false ;
579
+ addTearDown (TypingNotifier .debugReset);
581
580
582
- final channel = eg.stream ();
583
- final narrow = ChannelNarrow (channel.streamId);
584
- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
581
+ final channel = eg.stream ();
582
+ final narrow = ChannelNarrow (channel.streamId);
583
+ await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
585
584
586
- // (When we check that the send button looks disabled, it should be because
587
- // the file is uploading, not a pre-existing reason.)
588
- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
589
- controller! .content.value = const TextEditingValue (text: 'see image: ' );
590
- await tester.pump ();
585
+ // (When we check that the send button looks disabled, it should be because
586
+ // the file is uploading, not a pre-existing reason.)
587
+ await enterTopic (tester, narrow: narrow, topic: 'some topic' );
588
+ controller! .content.value = const TextEditingValue (text: 'see image: ' );
589
+ await tester.pump ();
590
+ }
591
+
592
+ group ('attach from media library' , () {
593
+ testWidgets ('success' , (tester) async {
594
+ await prepare (tester);
591
595
checkAppearsLoading (tester, false );
592
596
593
597
testBinding.pickFilesResult = FilePickerResult ([PlatformFile (
@@ -635,18 +639,7 @@ void main() {
635
639
636
640
group ('attach from camera' , () {
637
641
testWidgets ('success' , (tester) async {
638
- TypingNotifier .debugEnable = false ;
639
- addTearDown (TypingNotifier .debugReset);
640
-
641
- final channel = eg.stream ();
642
- final narrow = ChannelNarrow (channel.streamId);
643
- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
644
-
645
- // (When we check that the send button looks disabled, it should be because
646
- // the file is uploading, not a pre-existing reason.)
647
- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
648
- controller! .content.value = const TextEditingValue (text: 'see image: ' );
649
- await tester.pump ();
642
+ await prepare (tester);
650
643
checkAppearsLoading (tester, false );
651
644
652
645
testBinding.pickImageResult = XFile .fromData (
0 commit comments