diff --git a/catalyst_voices/apps/voices/integration_test/app_test.dart b/catalyst_voices/apps/voices/integration_test/app_test.dart index 3e1b0bcc19b..487c720b0cf 100644 --- a/catalyst_voices/apps/voices/integration_test/app_test.dart +++ b/catalyst_voices/apps/voices/integration_test/app_test.dart @@ -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) { @@ -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); + } }, ); diff --git a/catalyst_voices/apps/voices/integration_test/pageobject/spaces_drawer_page.dart b/catalyst_voices/apps/voices/integration_test/pageobject/spaces_drawer_page.dart index 1e446527031..056d611b171 100644 --- a/catalyst_voices/apps/voices/integration_test/pageobject/spaces_drawer_page.dart +++ b/catalyst_voices/apps/voices/integration_test/pageobject/spaces_drawer_page.dart @@ -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'); @@ -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); @@ -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 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 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; } }