Skip to content

Commit 4e929f1

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

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/widgets/emoji_reaction_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ void main() {
351351

352352
final searchFieldFinder = find.widgetWithText(TextField, 'Search emoji');
353353

354+
Finder findInPicker(Finder finder) =>
355+
find.descendant(of: find.byType(EmojiPicker), matching: finder);
356+
354357
Condition<Object?> conditionEmojiListEntry({
355358
required ReactionType emojiType,
356359
required String emojiCode,
@@ -429,9 +432,7 @@ void main() {
429432
await setupEmojiPicker(tester, message: message, narrow: TopicNarrow.ofMessage(message));
430433

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

437438
check(connection.lastRequest).isA<http.Request>()
@@ -453,9 +454,8 @@ void main() {
453454
connection.prepare(
454455
delay: const Duration(seconds: 2),
455456
apiException: eg.apiBadRequest(message: 'Invalid message(s)'));
456-
await tester.tap(find.descendant(
457-
of: find.byType(BottomSheet),
458-
matching: find.text('\u{1f4a4}'))); // 'zzz' emoji
457+
458+
await tester.tap(findInPicker(find.text('\u{1f4a4}'))); // 'zzz' emoji
459459
await tester.pump(); // register tap
460460
await tester.pump(const Duration(seconds: 1)); // emoji picker animates away
461461
await tester.pump(const Duration(seconds: 1)); // error arrives; error dialog shows

0 commit comments

Comments
 (0)