@@ -715,20 +715,24 @@ void main() {
715
715
.isA <Icon >().color.isNotNull ().isSameColorAs (expectedIconColor);
716
716
}
717
717
718
- group ('attach from media library' , () {
719
- testWidgets ('success' , (tester) async {
720
- TypingNotifier .debugEnable = false ;
721
- addTearDown (TypingNotifier .debugReset);
718
+ Future <void > prepare (WidgetTester tester) async {
719
+ TypingNotifier .debugEnable = false ;
720
+ addTearDown (TypingNotifier .debugReset);
722
721
723
- final channel = eg.stream ();
724
- final narrow = ChannelNarrow (channel.streamId);
725
- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
722
+ final channel = eg.stream ();
723
+ final narrow = ChannelNarrow (channel.streamId);
724
+ await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
726
725
727
- // (When we check that the send button looks disabled, it should be because
728
- // the file is uploading, not a pre-existing reason.)
729
- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
730
- controller! .content.value = const TextEditingValue (text: 'see image: ' );
731
- await tester.pump ();
726
+ // (When we check that the send button looks disabled, it should be because
727
+ // the file is uploading, not a pre-existing reason.)
728
+ await enterTopic (tester, narrow: narrow, topic: 'some topic' );
729
+ controller! .content.value = const TextEditingValue (text: 'see image: ' );
730
+ await tester.pump ();
731
+ }
732
+
733
+ group ('attach from media library' , () {
734
+ testWidgets ('success' , (tester) async {
735
+ await prepare (tester);
732
736
checkAppearsLoading (tester, false );
733
737
734
738
testBinding.pickFilesResult = FilePickerResult ([PlatformFile (
@@ -776,18 +780,7 @@ void main() {
776
780
777
781
group ('attach from camera' , () {
778
782
testWidgets ('success' , (tester) async {
779
- TypingNotifier .debugEnable = false ;
780
- addTearDown (TypingNotifier .debugReset);
781
-
782
- final channel = eg.stream ();
783
- final narrow = ChannelNarrow (channel.streamId);
784
- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
785
-
786
- // (When we check that the send button looks disabled, it should be because
787
- // the file is uploading, not a pre-existing reason.)
788
- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
789
- controller! .content.value = const TextEditingValue (text: 'see image: ' );
790
- await tester.pump ();
783
+ await prepare (tester);
791
784
checkAppearsLoading (tester, false );
792
785
793
786
testBinding.pickImageResult = XFile .fromData (
0 commit comments