@@ -99,10 +99,19 @@ void main() {
99
99
}
100
100
101
101
group ('AddReactionButton' , () {
102
- Future <void > tapButton (WidgetTester tester) async {
102
+ Future <void > tapThumbsUpEmoji (WidgetTester tester) async {
103
103
await tester.ensureVisible (find.byIcon (Icons .add_reaction_outlined, skipOffstage: false ));
104
104
await tester.tap (find.byIcon (Icons .add_reaction_outlined));
105
- await tester.pump (); // [MenuItemButton.onPressed] called in a post-frame callback: flutter/flutter@e4a39fa2e
105
+ await tester.pumpAndSettle (); // Wait for emoji picker to appear
106
+ await tester.ensureVisible (find.byIcon (Icons .tag_faces));
107
+ await tester.tap (find.byIcon (Icons .tag_faces));
108
+ await tester.dragUntilVisible (
109
+ find.text ('👍' ).hitTestable (),
110
+ // TODO use a constant imported from emoji_picker_flutter once that's upstreamed.
111
+ find.byKey (const Key ('emojiScrollView' )),
112
+ const Offset (0 , - 300 ),
113
+ );
114
+ await tester.tap (find.text ('👍' ));
106
115
}
107
116
108
117
testWidgets ('success' , (WidgetTester tester) async {
@@ -112,17 +121,7 @@ void main() {
112
121
113
122
final connection = store.connection as FakeApiConnection ;
114
123
connection.prepare (json: {});
115
- await tapButton (tester);
116
- // Wait for bottom modal to appear
117
- await tester.pumpAndSettle ();
118
- await tester.ensureVisible (find.byIcon (Icons .tag_faces, skipOffstage: false ));
119
- await tester.tap (find.byIcon (Icons .tag_faces));
120
- await tester.dragUntilVisible (
121
- find.text ('👍' ).hitTestable (),
122
- find.byKey (const Key ('emojiScrollView' )),
123
- const Offset (0 , - 300 ),
124
- );
125
- await tester.tap (find.text ('👍' ));
124
+ await tapThumbsUpEmoji (tester);
126
125
await tester.pump (Duration .zero);
127
126
128
127
check (connection.lastRequest).isA< http.Request > ()
@@ -147,7 +146,7 @@ void main() {
147
146
'msg' : 'Invalid message(s)' ,
148
147
'result' : 'error' ,
149
148
});
150
- await tapButton (tester);
149
+ await tapThumbsUpEmoji (tester);
151
150
await tester.pump (Duration .zero); // error arrives; error dialog shows
152
151
153
152
await tester.tap (find.byWidget (checkErrorDialog (tester,
0 commit comments