Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gtalha07 committed May 28, 2024
1 parent 876a887 commit 461c9c7
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions test/acter_avatar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,11 @@ void main() {
),
);
final options2 = AvatarOptions.GroupDM(
AvatarInfo(uniqueId: '@test:acter.org'),
groupAvatars: [
AvatarInfo(
uniqueId: '@kyra:acter.org',
onAvatarTap: () =>
onTapped(context, 'Group DM Avatar tapped'),
)
]);
AvatarInfo(
uniqueId: '@test:acter.org',
onAvatarTap: () =>
onTapped(context, 'Group DM Avatar tapped')),
);
final options3 = AvatarOptions(
AvatarInfo(
uniqueId: '@test:acter.org',
Expand All @@ -358,38 +355,42 @@ void main() {
}),
),
));

final dmGestureFinder = find.descendant(
of: find.byKey(TestKeys.circleAvatarKey),
matching: find.byType(GestureDetector));
// we have found the Gesture Detector, proceed with tester operation
expect(dmGestureFinder, findsOneWidget);

final groupDMGestureFinder = find.descendant(
of: find.byKey(TestKeys.stackedAvatarKey),
matching: find.byType(GestureDetector));
// we have found the Gesture Detector, proceed with tester operation
expect(groupDMGestureFinder, findsOneWidget);

final defaultAvatarGestureFinder = find.descendant(
of: find.byKey(TestKeys.widgetKey),
matching: find.byType(GestureDetector));
// we have found the Gesture Detector, proceed with tester operation
expect(defaultAvatarGestureFinder, findsOneWidget);

await tester.tap(dmGestureFinder);
await tester.pump();
expect(find.text('DM Avatar tapped'), findsOneWidget);

// dismissing snackbar
ScaffoldMessenger.of(navigatorKey.currentContext!).clearSnackBars();

await tester.tap(groupDMGestureFinder);
final groupDM1GestureFinder = find.descendant(
of: find.byKey(TestKeys.stackedAvatarKey),
matching: find.byTooltip('@test:acter.org'));
// we have found the Gesture Detector, proceed with tester operation
expect(groupDM1GestureFinder, findsOneWidget);

await tester.tap(groupDM1GestureFinder);
await tester.pump();
expect(find.text('Group DM Avatar tapped'), findsOneWidget);

// dismissing snackbar
ScaffoldMessenger.of(navigatorKey.currentContext!).clearSnackBars();

final defaultAvatarGestureFinder = find.descendant(
of: find.byKey(TestKeys.widgetKey),
matching: find.byType(GestureDetector));
// we have found the Gesture Detector, proceed with tester operation
expect(defaultAvatarGestureFinder, findsOneWidget);

// dismissing snackbar
ScaffoldMessenger.of(navigatorKey.currentContext!).clearSnackBars();

await tester.tap(defaultAvatarGestureFinder);
await tester.pump();
expect(find.text('Default Avatar tapped'), findsOneWidget);
Expand Down

0 comments on commit 461c9c7

Please sign in to comment.