Skip to content

Commit d29f08b

Browse files
committed
emoji test: Make a more specific finder helper
Signed-off-by: Zixuan James Li <[email protected]>
1 parent abec662 commit d29f08b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/widgets/emoji_reaction_test.dart

+4-6
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ void main() {
350350
}
351351

352352
final searchFieldFinder = find.widgetWithText(TextField, 'Search emoji');
353+
Finder findInPicker(Finder finder) =>
354+
find.descendant(of: find.byType(EmojiPicker), matching: finder);
353355

354356
Condition<Object?> conditionEmojiListEntry({
355357
required ReactionType emojiType,
@@ -429,9 +431,7 @@ void main() {
429431
await setupEmojiPicker(tester, message: message, narrow: TopicNarrow.ofMessage(message));
430432

431433
connection.prepare(json: {});
432-
await tester.tap(find.descendant(
433-
of: find.byType(BottomSheet),
434-
matching: find.text('\u{1f4a4}'))); // 'zzz' emoji
434+
await tester.tap(findInPicker(find.text('\u{1f4a4}'))); // 'zzz' emoji
435435
await tester.pump(Duration.zero);
436436

437437
check(connection.lastRequest).isA<http.Request>()
@@ -458,9 +458,7 @@ void main() {
458458
'result': 'error',
459459
});
460460

461-
await tester.tap(find.descendant(
462-
of: find.byType(BottomSheet),
463-
matching: find.text('\u{1f4a4}'))); // 'zzz' emoji
461+
await tester.tap(findInPicker(find.text('\u{1f4a4}'))); // 'zzz' emoji
464462
await tester.pump(); // register tap
465463
await tester.pump(const Duration(seconds: 1)); // emoji picker animates away
466464
await tester.pump(const Duration(seconds: 1)); // error arrives; error dialog shows

0 commit comments

Comments
 (0)