@@ -1045,20 +1045,24 @@ void main() {
10451045 .isA <Icon >().color.isNotNull ().isSameColorAs (expectedIconColor);
10461046 }
10471047
1048- group ('attach from media library' , () {
1049- testWidgets ('success' , (tester) async {
1050- TypingNotifier .debugEnable = false ;
1051- addTearDown (TypingNotifier .debugReset);
1048+ Future <void > prepare (WidgetTester tester) async {
1049+ TypingNotifier .debugEnable = false ;
1050+ addTearDown (TypingNotifier .debugReset);
10521051
1053- final channel = eg.stream ();
1054- final narrow = ChannelNarrow (channel.streamId);
1055- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
1052+ final channel = eg.stream ();
1053+ final narrow = ChannelNarrow (channel.streamId);
1054+ await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
10561055
1057- // (When we check that the send button looks disabled, it should be because
1058- // the file is uploading, not a pre-existing reason.)
1059- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
1060- controller! .content.value = const TextEditingValue (text: 'see image: ' );
1061- await tester.pump ();
1056+ // (When we check that the send button looks disabled, it should be because
1057+ // the file is uploading, not a pre-existing reason.)
1058+ await enterTopic (tester, narrow: narrow, topic: 'some topic' );
1059+ controller! .content.value = const TextEditingValue (text: 'see image: ' );
1060+ await tester.pump ();
1061+ }
1062+
1063+ group ('attach from media library' , () {
1064+ testWidgets ('success' , (tester) async {
1065+ await prepare (tester);
10621066 checkAppearsLoading (tester, false );
10631067
10641068 testBinding.pickFilesResult = FilePickerResult ([PlatformFile (
@@ -1106,18 +1110,7 @@ void main() {
11061110
11071111 group ('attach from camera' , () {
11081112 testWidgets ('success' , (tester) async {
1109- TypingNotifier .debugEnable = false ;
1110- addTearDown (TypingNotifier .debugReset);
1111-
1112- final channel = eg.stream ();
1113- final narrow = ChannelNarrow (channel.streamId);
1114- await prepareComposeBox (tester, narrow: narrow, streams: [channel]);
1115-
1116- // (When we check that the send button looks disabled, it should be because
1117- // the file is uploading, not a pre-existing reason.)
1118- await enterTopic (tester, narrow: narrow, topic: 'some topic' );
1119- controller! .content.value = const TextEditingValue (text: 'see image: ' );
1120- await tester.pump ();
1113+ await prepare (tester);
11211114 checkAppearsLoading (tester, false );
11221115
11231116 testBinding.pickImageResult = XFile .fromData (
0 commit comments