@@ -319,13 +319,21 @@ void main() {
319
319
});
320
320
321
321
group ('log out' , () {
322
- Future <(Widget , Widget )> prepare (WidgetTester tester, {required Account account}) async {
323
- await setupChooseAccountPage (tester, accounts: [account]);
324
-
325
- final findThreeDotsButton = find.descendant (
326
- of: find.widgetWithText (Card , eg.selfAccount.realmUrl.toString ()),
322
+ Future <(Widget , Widget )> prepare (WidgetTester tester, {
323
+ required List <Account > accounts,
324
+ required Account logoutAccount,
325
+ }) async {
326
+ assert (accounts.contains (logoutAccount));
327
+
328
+ await setupChooseAccountPage (tester, accounts: accounts);
329
+
330
+ final findAccountCard = find.ancestor (of: find.text (logoutAccount.realmUrl.toString ()),
331
+ matching: find.ancestor (of: find.text (logoutAccount.email),
332
+ matching: find.byType (Card )));
333
+ final findThreeDotsButton = find.descendant (of: findAccountCard,
327
334
matching: find.byIcon (Icons .adaptive.more));
328
335
336
+ await tester.scrollUntilVisible (findThreeDotsButton, 50 );
329
337
await tester.tap (findThreeDotsButton);
330
338
await tester.pump ();
331
339
await tester.tap (find.descendant (
@@ -338,14 +346,16 @@ void main() {
338
346
}
339
347
340
348
testWidgets ('user confirms logging out' , (tester) async {
341
- final (actionButton, _) = await prepare (tester, account: eg.selfAccount);
349
+ final (actionButton, _) = await prepare (tester,
350
+ accounts: [eg.selfAccount], logoutAccount: eg.selfAccount);
342
351
await tester.tap (find.byWidget (actionButton));
343
352
await tester.pump (TestGlobalStore .removeAccountDuration);
344
353
check (testBinding.globalStore).accounts.isEmpty ();
345
354
});
346
355
347
356
testWidgets ('user cancels logging out' , (tester) async {
348
- final (_, cancelButton) = await prepare (tester, account: eg.selfAccount);
357
+ final (_, cancelButton) = await prepare (tester,
358
+ accounts: [eg.selfAccount], logoutAccount: eg.selfAccount);
349
359
await tester.tap (find.byWidget (cancelButton));
350
360
await tester.pumpAndSettle ();
351
361
check (testBinding.globalStore).accounts.deepEquals ([eg.selfAccount]);
0 commit comments