Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cat-voices): Adding account tests #1479

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions catalyst_voices/apps/voices/integration_test/all_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import 'package:catalyst_voices/configs/bootstrap.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'app_test.dart' as app_test;
import 'onboarding_test.dart' as onboarding_test;
import 'suites/account_test.dart' as account_test;
import 'suites/app_test.dart' as app_test;
import 'suites/onboarding_test.dart' as onboarding_test;

void main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -14,4 +15,5 @@ void main() async {

app_test.main();
onboarding_test.main();
account_test.main();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol_finders/patrol_finders.dart';

class AccountDropdownPage {
static const popUpMenuAccountHeader = Key('PopUpMenuAccountHeader');
static const popUpMenuMyAccount = Key('PopUpMenuMyAccount');
static const popUpMenuProfileAndKeychain = Key('PopUpMenuProfileAndKeychain');
static const popUpMenuLock = Key('PopUpMenuLockAccount');

static Future<void> accountDropdownLooksAsExpected(
PatrolTester $,
) async {
expect($(popUpMenuAccountHeader), findsOneWidget);
expect($(popUpMenuMyAccount), findsOneWidget);
expect($(popUpMenuProfileAndKeychain), findsOneWidget);
expect($(popUpMenuLock), findsOneWidget);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import 'package:flutter/material.dart';
class AppBarPage {
static const spacesDrawerButton = Key('DrawerButton');
static const getStartedBtn = Key('GetStartedButton');
static const accountPopupBtn = Key('AccountPopupButton');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:catalyst_voices/app/view/app.dart';
import 'package:catalyst_voices/configs/bootstrap.dart';
import 'package:catalyst_voices/routes/routes.dart';
import 'package:catalyst_voices_models/catalyst_voices_models.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:go_router/go_router.dart';
import 'package:patrol_finders/patrol_finders.dart';

import '../pageobject/account_dropdown_page.dart';
import '../pageobject/app_bar_page.dart';
import '../pageobject/overall_spaces_page.dart';

void main() async {
late final GoRouter router;

setUpAll(() async {
router = buildAppRouter();
});

setUp(() async {
await registerDependencies(config: const AppConfig());
router.go(const DiscoveryRoute().location);
});

tearDown(() async {
await restartDependencies();
});

group(
'Account dropdown -',
() {
patrolWidgetTest(
'user - Account dropdown button opens account dropdown',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.accountPopupBtn).tap();
await AccountDropdownPage.accountDropdownLooksAsExpected($);
},
);
},
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:go_router/go_router.dart';
import 'package:patrol_finders/patrol_finders.dart';

import 'pageobject/app_bar_page.dart';
import 'pageobject/overall_spaces_page.dart';
import 'pageobject/spaces_drawer_page.dart';
import 'utils/selector_utils.dart';
import '../pageobject/app_bar_page.dart';
import '../pageobject/overall_spaces_page.dart';
import '../pageobject/spaces_drawer_page.dart';
import '../utils/selector_utils.dart';

void main() async {
late final GoRouter router;
Expand Down Expand Up @@ -42,6 +42,8 @@ void main() async {
);

patrolWidgetTest(
tags: 'https://github.com/input-output-hk/catalyst-voices/issues/1473',
skip: true,
'guest - chooser - clicking on icons works correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
Expand All @@ -60,6 +62,8 @@ void main() async {
);

patrolWidgetTest(
tags: 'https://github.com/input-output-hk/catalyst-voices/issues/1473',
skip: true,
'guest - chooser - next,previous buttons work correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:go_router/go_router.dart';
import 'package:patrol_finders/patrol_finders.dart';

import 'pageobject/app_bar_page.dart';
import 'pageobject/onboarding_page.dart';
import 'pageobject/overall_spaces_page.dart';
import '../pageobject/app_bar_page.dart';
import '../pageobject/onboarding_page.dart';
import '../pageobject/overall_spaces_page.dart';

void main() async {
late final GoRouter router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:catalyst_voices_shared/catalyst_voices_shared.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

const _padding = 12.0;

class AccountPopup extends StatelessWidget {
final String avatarLetter;
final VoidCallback? onProfileKeychainTap;
Expand Down Expand Up @@ -38,6 +40,7 @@ class AccountPopup extends StatelessWidget {
padding: EdgeInsets.zero,
enabled: false,
value: null,
key: const Key('PopUpMenuAccountHeader'),
child: _Header(
accountLetter: avatarLetter,
walletName: 'Wallet name',
Expand All @@ -52,6 +55,7 @@ class AccountPopup extends StatelessWidget {
),
),
const PopupMenuItem(
key: Key('PopUpMenuMyAccount'),
height: 48,
padding: EdgeInsets.zero,
enabled: false,
Expand All @@ -61,6 +65,7 @@ class AccountPopup extends StatelessWidget {
PopupMenuItem(
padding: EdgeInsets.zero,
value: _MenuItemValue.profileAndKeychain,
key: const Key('PopUpMenuProfileAndKeychain'),
child: _MenuItem(
'Profile & Keychain',
VoicesAssets.icons.userCircle,
Expand All @@ -69,6 +74,7 @@ class AccountPopup extends StatelessWidget {
PopupMenuItem(
padding: EdgeInsets.zero,
value: _MenuItemValue.lock,
key: const Key('PopUpMenuLockAccount'),
child: _MenuItem(
'Lock account',
VoicesAssets.icons.lockClosed,
Expand Down Expand Up @@ -221,6 +227,11 @@ class _MenuItem extends StatelessWidget {
}
}

enum _MenuItemValue {
profileAndKeychain,
lock,
}

class _Section extends StatelessWidget {
final String text;

Expand Down Expand Up @@ -251,10 +262,3 @@ class _Section extends StatelessWidget {
);
}
}

const _padding = 12.0;

enum _MenuItemValue {
profileAndKeychain,
lock,
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SessionStateHeader extends StatelessWidget {
avatarLetter: account?.acronym ?? '',
onLockAccountTap: () => _onLockAccount(context),
onProfileKeychainTap: () => _onSeeProfile(context),
key: const Key('AccountPopupButton'),
),
};
},
Expand Down