@@ -9,6 +9,7 @@ import 'package:zulip/api/model/web_auth.dart';
9
9
import 'package:zulip/api/route/account.dart' ;
10
10
import 'package:zulip/api/route/realm.dart' ;
11
11
import 'package:zulip/model/binding.dart' ;
12
+ import 'package:zulip/model/database.dart' ;
12
13
import 'package:zulip/model/localizations.dart' ;
13
14
import 'package:zulip/widgets/app.dart' ;
14
15
import 'package:zulip/widgets/home.dart' ;
@@ -118,22 +119,26 @@ void main() {
118
119
});
119
120
}
120
121
121
- testWidgets ('basic happy case' , (tester) async {
122
- final serverSettings = eg.serverSettings ();
123
- await prepare (tester, serverSettings);
124
- check (testBinding.globalStore.accounts).isEmpty ();
125
-
126
- await tester.enterText (findUsernameInput, eg.selfAccount.email);
122
+ Future <void > login (WidgetTester tester, Account account) async {
123
+ await tester.enterText (findUsernameInput, account.email);
127
124
await tester.enterText (findPasswordInput, 'p455w0rd' );
128
125
testBinding.globalStore.useCachedApiConnections = true ;
129
126
connection.prepare (json: FetchApiKeyResult (
130
- apiKey: eg.selfAccount .apiKey,
131
- email: eg.selfAccount .email,
132
- userId: eg.selfAccount .userId,
127
+ apiKey: account .apiKey,
128
+ email: account .email,
129
+ userId: account .userId,
133
130
).toJson ());
134
131
await tester.tap (findSubmitButton);
135
- checkFetchApiKey (username: eg.selfAccount .email, password: 'p455w0rd' );
132
+ checkFetchApiKey (username: account .email, password: 'p455w0rd' );
136
133
await tester.idle ();
134
+ }
135
+
136
+ testWidgets ('basic happy case' , (tester) async {
137
+ final serverSettings = eg.serverSettings ();
138
+ await prepare (tester, serverSettings);
139
+ check (testBinding.globalStore.accounts).isEmpty ();
140
+
141
+ await login (tester, eg.selfAccount);
137
142
check (testBinding.globalStore.accounts).single
138
143
.equals (eg.selfAccount.copyWith (
139
144
id: testBinding.globalStore.accounts.single.id));
0 commit comments