File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_test/flutter_test.dart' ;
3+
4+ import 'package:feathr/screens/login.dart' ;
5+
6+ import '../utils.dart' ;
7+
8+ void main () {
9+ testWidgets ('Login screen is rendered correctly' ,
10+ (WidgetTester tester) async {
11+ final apiService = getTestApiService ();
12+
13+ await tester.pumpWidget (MaterialApp (
14+ home: Login (
15+ apiService: apiService,
16+ ),
17+ ));
18+
19+ // Expect to find the app's name
20+ expect (find.text ('feathr' ), findsOneWidget);
21+ });
22+ }
Original file line number Diff line number Diff line change 1+ import 'package:feathr/widgets/timeline.dart' ;
2+ import 'package:flutter/material.dart' ;
3+ import 'package:flutter_test/flutter_test.dart' ;
4+
5+ import 'package:feathr/screens/user.dart' ;
6+
7+ import '../utils.dart' ;
8+
9+ void main () {
10+ testWidgets ('User screen displays user information' ,
11+ (WidgetTester tester) async {
12+ final apiService = getTestApiService ();
13+ final account = apiService.currentAccount! ;
14+
15+ await tester.pumpWidget (MaterialApp (
16+ home: User (
17+ account: account,
18+ apiService: apiService,
19+ ),
20+ ));
21+
22+ // Expect to find the user's name
23+ expect (find.text (account.displayName), findsOneWidget);
24+
25+ // Expect to find the user's acct
26+ expect (find.text (account.acct), findsOneWidget);
27+
28+ // Expect to find a Timeline widget
29+ expect (find.byType (Timeline ), findsOneWidget);
30+ });
31+ }
You can’t perform that action at this time.
0 commit comments