Skip to content

Commit

Permalink
test(cat-voices): Add running all test files (#1449)
Browse files Browse the repository at this point in the history
  • Loading branch information
oldGreg5 authored Dec 31, 2024
1 parent ebb445a commit 1e1de78
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 107 deletions.
17 changes: 17 additions & 0 deletions catalyst_voices/apps/voices/integration_test/all_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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;

void main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

setUpAll(() async {
await bootstrap(router: buildAppRouter());
});

app_test.main();
onboarding_test.main();
}
172 changes: 87 additions & 85 deletions catalyst_voices/apps/voices/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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:integration_test/integration_test.dart';
import 'package:patrol_finders/patrol_finders.dart';

import 'pageobject/app_bar_page.dart';
Expand All @@ -13,12 +12,10 @@ import 'pageobject/spaces_drawer_page.dart';
import 'utils/selector_utils.dart';

void main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
late final GoRouter router;

setUpAll(() async {
router = buildAppRouter();
await bootstrap(router: router);
});

setUp(() async {
Expand All @@ -30,96 +27,101 @@ void main() async {
await restartDependencies();
});

patrolWidgetTest(
'Spaces drawer - visitor - no drawer button',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.visitorShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
expect($(AppBarPage.spacesDrawerButton).exists, false);
},
);
group(
'Spaces drawer -',
() {
patrolWidgetTest(
'visitor - no drawer button',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.visitorShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
expect($(AppBarPage.spacesDrawerButton).exists, false);
},
);

patrolWidgetTest(
'Spaces drawer - guest - chooser - clicking on icons works correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.commonElementsLookAsExpected($);
patrolWidgetTest(
'guest - chooser - clicking on icons works correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.commonElementsLookAsExpected($);

// iterate thru spaces by clicking on spaces icons directly
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
await SpacesDrawerPage.guestLooksAsExpected($, space);
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserNextBtn));
},
);
// iterate thru spaces by clicking on spaces icons directly
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
await SpacesDrawerPage.guestLooksAsExpected($, space);
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserNextBtn));
},
);

patrolWidgetTest(
'Spaces drawer - guest - chooser - next,previous buttons work correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
patrolWidgetTest(
'guest - chooser - next,previous buttons work correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();

// iterate thru spaces by clicking next
for (final space in Space.values) {
await SpacesDrawerPage.guestLooksAsExpected($, space);
await $(SpacesDrawerPage.chooserNextBtn).tap();
SelectorUtils.isEnabled($, $(SpacesDrawerPage.chooserPrevBtn));
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserNextBtn));
// iterate thru spaces by clicking next
for (final space in Space.values) {
await SpacesDrawerPage.guestLooksAsExpected($, space);
await $(SpacesDrawerPage.chooserNextBtn).tap();
SelectorUtils.isEnabled($, $(SpacesDrawerPage.chooserPrevBtn));
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserNextBtn));

// iterate thru spaces by clicking previous
for (final space in Space.values.reversed) {
await SpacesDrawerPage.guestLooksAsExpected($, space);
await $(SpacesDrawerPage.chooserPrevBtn).tap();
SelectorUtils.isEnabled($, $(SpacesDrawerPage.chooserNextBtn));
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserPrevBtn));
},
);
// iterate thru spaces by clicking previous
for (final space in Space.values.reversed) {
await SpacesDrawerPage.guestLooksAsExpected($, space);
await $(SpacesDrawerPage.chooserPrevBtn).tap();
SelectorUtils.isEnabled($, $(SpacesDrawerPage.chooserNextBtn));
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserPrevBtn));
},
);

patrolWidgetTest(
'Spaces drawer - user - chooser - clicking on icons works correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.commonElementsLookAsExpected($);
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
await SpacesDrawerPage.userLooksAsExpected($, space);
}
},
);
patrolWidgetTest(
'user - chooser - clicking on icons works correctly',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.commonElementsLookAsExpected($);
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
await SpacesDrawerPage.userLooksAsExpected($, space);
}
},
);

patrolWidgetTest(
'Spaces drawer - guest - chooser - all spaces button works',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
await $(SpacesDrawerPage.allSpacesBtn).tap();
expect($(OverallSpacesPage.spacesListView), findsOneWidget);
},
);
patrolWidgetTest(
'guest - chooser - all spaces button works',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
await $(SpacesDrawerPage.allSpacesBtn).tap();
expect($(OverallSpacesPage.spacesListView), findsOneWidget);
},
);

patrolWidgetTest(
'Spaces drawer - user - chooser - all spaces button works',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
await $(SpacesDrawerPage.allSpacesBtn).tap();
expect($(OverallSpacesPage.spacesListView), findsOneWidget);
patrolWidgetTest(
'user - chooser - all spaces button works',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
await $(SpacesDrawerPage.allSpacesBtn).tap();
expect($(OverallSpacesPage.spacesListView), findsOneWidget);
},
);
},
);
}
45 changes: 23 additions & 22 deletions catalyst_voices/apps/voices/integration_test/onboarding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ 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:integration_test/integration_test.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';

void main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
late final GoRouter router;

setUpAll(() async {
router = buildAppRouter();
await bootstrap(router: router);
});

setUp(() async {
Expand All @@ -28,24 +26,27 @@ void main() async {
await restartDependencies();
});

patrolWidgetTest(
'Onboarding - visitor - get started button works',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(AppBarPage.getStartedBtn)
.tap(settleTimeout: const Duration(seconds: 10));
expect($(OnboardingPage.registrationInfoPanel), findsOneWidget);
expect($(OnboardingPage.registrationDetailsPanel), findsOneWidget);
},
);
group('Onboarding -', () {
patrolWidgetTest(
'visitor - get started button works',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(OverallSpacesPage.visitorShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.getStartedBtn).tap();
expect($(OnboardingPage.registrationInfoPanel), findsOneWidget);
expect($(OnboardingPage.registrationDetailsPanel), findsOneWidget);
},
);

patrolWidgetTest(
'Onboarding - visitor - get started screen looks as expected',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(AppBarPage.getStartedBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await OnboardingPage.getStartedScreenLooksAsExpected($);
},
);
patrolWidgetTest(
'visitor - get started screen looks as expected',
(PatrolTester $) async {
await $.pumpWidgetAndSettle(App(routerConfig: router));
await $(AppBarPage.getStartedBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await OnboardingPage.getStartedScreenLooksAsExpected($);
},
);
});
}

0 comments on commit 1e1de78

Please sign in to comment.