@@ -319,13 +319,23 @@ void main() {
319319 });
320320
321321 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+ List <Account >? accounts,
324+ Account ? logoutAccount,
325+ }) async {
326+ accounts ?? = [eg.selfAccount];
327+ logoutAccount ?? = eg.selfAccount;
328+ assert (accounts.contains (logoutAccount));
329+
330+ await setupChooseAccountPage (tester, accounts: accounts);
331+
332+ final findAccountCard = find.ancestor (of: find.text (logoutAccount.realmUrl.toString ()),
333+ matching: find.ancestor (of: find.text (logoutAccount.email),
334+ matching: find.byType (Card )));
335+ final findThreeDotsButton = find.descendant (of: findAccountCard,
327336 matching: find.byIcon (Icons .adaptive.more));
328337
338+ await tester.scrollUntilVisible (findThreeDotsButton, 50 );
329339 await tester.tap (findThreeDotsButton);
330340 await tester.pump ();
331341 await tester.tap (find.descendant (
@@ -338,14 +348,14 @@ void main() {
338348 }
339349
340350 testWidgets ('user confirms logging out' , (tester) async {
341- final (actionButton, _) = await prepare (tester, account : eg.selfAccount );
351+ final (actionButton, _) = await prepare (tester);
342352 await tester.tap (find.byWidget (actionButton));
343353 await tester.pump (TestGlobalStore .removeAccountDuration);
344354 check (testBinding.globalStore).accounts.isEmpty ();
345355 });
346356
347357 testWidgets ('user cancels logging out' , (tester) async {
348- final (_, cancelButton) = await prepare (tester, account : eg.selfAccount );
358+ final (_, cancelButton) = await prepare (tester);
349359 await tester.tap (find.byWidget (cancelButton));
350360 await tester.pumpAndSettle ();
351361 check (testBinding.globalStore).accounts.deepEquals ([eg.selfAccount]);
0 commit comments