Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oldGreg5 committed Dec 23, 2024
1 parent f3adc69 commit e86ca36
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
9 changes: 6 additions & 3 deletions catalyst_voices/apps/voices/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void main() async {
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.guestCommonElementsLookAsExpected($);
SpacesDrawerPage.commonElementsLookAsExpected($);

// iterate thru spaces by clicking on spaces icons directly
for (final space in Space.values) {
Expand Down Expand Up @@ -91,8 +91,11 @@ void main() async {
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.guestCommonElementsLookAsExpected($);
await SpacesDrawerPage.userLooksAsExpected($);
SpacesDrawerPage.commonElementsLookAsExpected($);
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
await SpacesDrawerPage.userLooksAsExpected($, space);
}
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol_finders/patrol_finders.dart';


class SpacesDrawerPage {
static const closeBtn = Key('MenuCloseButton');
static const guestMenuItems = Key('GuestMenuItems');
Expand Down Expand Up @@ -39,7 +38,7 @@ class SpacesDrawerPage {
return Key('Header.${space.name}');
}

static void guestCommonElementsLookAsExpected(PatrolTester $) {
static void commonElementsLookAsExpected(PatrolTester $) {
expect($(closeBtn), findsOneWidget);
expect($(allSpacesBtn), findsOneWidget);
expect($(chooserPrevBtn), findsOneWidget);
Expand All @@ -53,32 +52,29 @@ class SpacesDrawerPage {
findsOneWidget,
);
final children = find.descendant(
of: $(SpacesDrawerPage.guestMenuItems),
of: $(guestMenuItems),
matching: find.byWidgetPredicate((widget) => true),
);
expect($(children), findsAtLeast(1));
}

static Future<void> userLooksAsExpected(PatrolTester $) async {
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
switch (space) {
case Space.discovery:
userDiscoveryLooksAsExpected($);
break;
case Space.workspace:
userWorkspaceLooksAsExpected($);
break;
case Space.voting:
userVotingLooksAsExpected($);
break;
case Space.fundedProjects:
userFundedProjectsLooksAsExpected($);
break;
case Space.treasury:
userTreasuryLooksAsExpected($);
break;
}
static Future<void> userLooksAsExpected(PatrolTester $, Space space) async {
switch (space) {
case Space.discovery:
userDiscoveryLooksAsExpected($);
break;
case Space.workspace:
userWorkspaceLooksAsExpected($);
break;
case Space.voting:
userVotingLooksAsExpected($);
break;
case Space.fundedProjects:
userFundedProjectsLooksAsExpected($);
break;
case Space.treasury:
userTreasuryLooksAsExpected($);
break;
}
}

Expand Down

0 comments on commit e86ca36

Please sign in to comment.