Skip to content

Commit 2470778

Browse files
committed
fix error test
1 parent 5e59332 commit 2470778

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

test/widgets/action_sheet_test.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,19 @@ void main() {
9999
}
100100

101101
group('AddReactionButton', () {
102-
Future<void> tapButton(WidgetTester tester) async {
102+
Future<void> tapThumbsUpEmoji(WidgetTester tester) async {
103103
await tester.ensureVisible(find.byIcon(Icons.add_reaction_outlined, skipOffstage: false));
104104
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('👍'));
106115
}
107116

108117
testWidgets('success', (WidgetTester tester) async {
@@ -112,17 +121,7 @@ void main() {
112121

113122
final connection = store.connection as FakeApiConnection;
114123
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);
126125
await tester.pump(Duration.zero);
127126

128127
check(connection.lastRequest).isA<http.Request>()
@@ -147,7 +146,7 @@ void main() {
147146
'msg': 'Invalid message(s)',
148147
'result': 'error',
149148
});
150-
await tapButton(tester);
149+
await tapThumbsUpEmoji(tester);
151150
await tester.pump(Duration.zero); // error arrives; error dialog shows
152151

153152
await tester.tap(find.byWidget(checkErrorDialog(tester,

0 commit comments

Comments
 (0)