Skip to content

Commit

Permalink
Merge branch 'main' into mve3
Browse files Browse the repository at this point in the history
  • Loading branch information
dtscalac committed Dec 23, 2024
2 parents 0289c36 + 71cb106 commit bd56a5c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 48 deletions.
34 changes: 11 additions & 23 deletions catalyst_voices/apps/voices/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,12 @@ void main() async {
await $(OverallSpacesPage.guestShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
SpacesDrawerPage.guestLooksAsExpected($);
SpacesDrawerPage.commonElementsLookAsExpected($);

// iterate thru spaces by clicking on spaces icons directly
for (final space in Space.values) {
await $(SpacesDrawerPage.chooserItem(space)).tap();
expect(
$(SpacesDrawerPage.chooserIcon(space)),
findsOneWidget,
);
final children = find.descendant(
of: $(SpacesDrawerPage.guestMenuItems),
matching: find.byWidgetPredicate((widget) => true),
);
expect($(children), findsAtLeast(1));
await SpacesDrawerPage.guestLooksAsExpected($, space);
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserNextBtn));
},
Expand All @@ -75,25 +67,17 @@ void main() async {
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();

// iterate thru spaces by clicking next
for (var i = 0; i < Space.values.length; i++) {
for (final space in Space.values) {
await SpacesDrawerPage.guestLooksAsExpected($, space);
await $(SpacesDrawerPage.chooserNextBtn).tap();
final children = find.descendant(
of: $(SpacesDrawerPage.guestMenuItems),
matching: find.byWidgetPredicate((widget) => true),
);
expect($(children), findsAtLeast(1));
SelectorUtils.isEnabled($, $(SpacesDrawerPage.chooserPrevBtn));
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserNextBtn));

// iterate thru spaces by clicking previous
for (var i = 0; i < Space.values.length; i++) {
for (final space in Space.values.reversed) {
await SpacesDrawerPage.guestLooksAsExpected($, space);
await $(SpacesDrawerPage.chooserPrevBtn).tap();
final children = find.descendant(
of: $(SpacesDrawerPage.guestMenuItems),
matching: find.byWidgetPredicate((widget) => true),
);
expect($(children), findsAtLeast(1));
SelectorUtils.isEnabled($, $(SpacesDrawerPage.chooserNextBtn));
}
SelectorUtils.isDisabled($, $(SpacesDrawerPage.chooserPrevBtn));
Expand All @@ -107,7 +91,11 @@ void main() async {
await $(OverallSpacesPage.userShortcutBtn)
.tap(settleTimeout: const Duration(seconds: 10));
await $(AppBarPage.spacesDrawerButton).waitUntilVisible().tap();
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,8 +5,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol_finders/patrol_finders.dart';

import '../utils/selector_utils.dart';

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

static void guestLooksAsExpected(PatrolTester $) {
static void commonElementsLookAsExpected(PatrolTester $) {
expect($(closeBtn), findsOneWidget);
expect($(allSpacesBtn), findsOneWidget);
expect($(chooserPrevBtn), findsOneWidget);
SelectorUtils.isDisabled($, $(chooserPrevBtn));
expect($(chooserNextBtn), findsOneWidget);
expect($(chooserItemContainer), findsExactly(5));
}

static Future<void> guestLooksAsExpected(PatrolTester $, Space space) async {
expect(
$(chooserIcon(Space.discovery)),
$(SpacesDrawerPage.chooserIcon(space)),
findsOneWidget,
);
final children = find.descendant(
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 bd56a5c

Please sign in to comment.