@@ -7,6 +7,7 @@ import 'package:zulip/api/model/initial_snapshot.dart';
7
7
import 'package:zulip/api/model/model.dart' ;
8
8
import 'package:zulip/model/narrow.dart' ;
9
9
import 'package:zulip/widgets/content.dart' ;
10
+ import 'package:zulip/widgets/icons.dart' ;
10
11
import 'package:zulip/widgets/message_list.dart' ;
11
12
import 'package:zulip/widgets/page.dart' ;
12
13
import 'package:zulip/widgets/profile.dart' ;
@@ -323,5 +324,37 @@ void main() {
323
324
324
325
check (find.textContaining (longString).evaluate ()).length.equals (7 );
325
326
});
327
+
328
+ group ('bot vs non-bot users' , () {
329
+ void checkUser (String fullName, {required bool isBot}) {
330
+ final nameFinder = find.text (fullName);
331
+ final botFinder = find.byIcon (ZulipIcons .bot);
332
+
333
+ check (nameFinder.evaluate ()).isNotEmpty ();
334
+ if (isBot) {
335
+ check (botFinder.evaluate ().singleOrNull).isNotNull ();
336
+ final botAndNameRowFinder = find.ancestor (
337
+ of: botFinder,
338
+ matching: find.ancestor (of: nameFinder, matching: find.byType (Row )));
339
+ check (botAndNameRowFinder.evaluate ().singleOrNull).isNotNull ();
340
+ } else {
341
+ check (botFinder.evaluate ().singleOrNull).isNull ();
342
+ }
343
+ }
344
+
345
+ testWidgets ('page builds; bot icon is shown with bot user\' s fullName' , (tester) async {
346
+ final user = eg.user (isBot: true );
347
+ await setupPage (tester, pageUserId: user.userId, users: [user]);
348
+
349
+ checkUser (user.fullName, isBot: true );
350
+ });
351
+
352
+ testWidgets ('page builds; bot icon is not shown with non-bot user\' s fullName' , (tester) async {
353
+ final user = eg.user (isBot: false );
354
+ await setupPage (tester, pageUserId: user.userId, users: [user]);
355
+
356
+ checkUser (user.fullName, isBot: false );
357
+ });
358
+ });
326
359
});
327
360
}
0 commit comments