-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description - Integration - interaction between different components of the app. - Unit - individual functions and methods in isolation (will only cover the Bloc). - Widget - user interface components of the app. - To make the process easier for other developers, we would like you to create reusable components for testing which can easily be used by the rest of the team. ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [x] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read and ran all relevant commands as specififed in the Running Tests section of the [Contributor Guide]. - [ ] The title of the PR follows the [Conventional Commits] guideline - [ ] My local branch follows the naming standards in the [Deepsource Branch Naming Convention] or [Biodiversity Branch Naming Convention] - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated `pubspec.yaml` with an appropriate new version according to the [pub versioning philosophy], - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] All existing and new tests are passing. [Contributor Guide]: https://github.com/FlutterPlaza/.github/blob/main/CONTRIBUTING.md [Conventional Commits]: https://www.conventionalcommits.org/en/v1.0.0-beta.4/ [pub versioning philosophy]: https://dart.dev/tools/pub/versioning [Biodiversity Branch Naming Convention]: https://bit.ly/3DyYSwM [Deepsource Branch Naming Convention]: https://bit.ly/3Y08Gs4
- Loading branch information
Showing
27 changed files
with
1,252 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import 'bottom_nav_bar_test.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
group('Development App', () { | ||
bottomNavBarTest(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:fpb/core/domain/user.dart'; | ||
import 'package:fpb/core/shared/helpers/value_injector.dart'; | ||
import 'package:fpb/home/home_screen.dart'; | ||
import 'package:fpb/home/view/budget_screen.dart'; | ||
import 'package:fpb/home/view/dashboard.dart'; | ||
import 'package:fpb/home/view/home_container.dart'; | ||
import 'package:fpb/home/view/widgets/bottom_nav_bar.dart'; | ||
import 'package:fpb/savings/view/savings_page.dart'; | ||
|
||
import '../test/helpers/helpers.dart'; | ||
|
||
void bottomNavBarTest() { | ||
late MockCached cached; | ||
late MockIFacebookRepositoryFacade mockIFacebookRepositoryFacade; | ||
late MockIGoogleRepositoryFacade mockIGoogleRepositoryFacade; | ||
late MockIAuthFacade mockIAuthFacade; | ||
|
||
setUp(() { | ||
cached = MockCached(); | ||
mockIAuthFacade = MockIAuthFacade(); | ||
mockIFacebookRepositoryFacade = MockIFacebookRepositoryFacade(); | ||
mockIGoogleRepositoryFacade = MockIGoogleRepositoryFacade(); | ||
}); | ||
|
||
testWidgets('renders home bottom nav bar buttons', (tester) async { | ||
arrangeAuthRepositoryReturnsStreamWithUser(mockIAuthFacade); | ||
arrangeAuthRepositoryReturnsCurrentUser(mockIAuthFacade); | ||
arrangeCachedReturnsLastView(cached, 0); | ||
|
||
await tester.pumpApp( | ||
ValueInjector<User>( | ||
value: testUser, | ||
child: HomeBody( | ||
user: testUser, | ||
), | ||
), | ||
mockCachedForHomeBloc: cached, | ||
mockIAuthFacadeForAuthBloc: mockIAuthFacade, | ||
); | ||
|
||
await tester.pumpAndSettle(); | ||
|
||
// await tester.pump(); | ||
|
||
expect(find.byType(HomeContainer), findsOneWidget); | ||
expect(find.byType(BottomNavBar), findsOneWidget); | ||
expect(find.byType(DashBoard), findsOneWidget); | ||
|
||
await tester.tap( | ||
find.byKey( | ||
Key("BNB-savings-page-button"), | ||
), | ||
); | ||
|
||
await tester.pumpAndSettle(); | ||
|
||
expect(find.byType(SavingsPage), findsOneWidget); | ||
|
||
await tester.tap( | ||
find.byKey( | ||
Key("BNB-budget-page-button"), | ||
), | ||
); | ||
|
||
await tester.pumpAndSettle(); | ||
|
||
expect(find.byType(BudgetScreen), findsOneWidget); | ||
|
||
// await tester.tap( | ||
// find.byKey( | ||
// Key("BNB-userSearch-page-button"), | ||
// ), | ||
// ); | ||
|
||
// await tester.pumpAndSettle(); | ||
|
||
// expect(find.byType(UserSearchScreen), findsOneWidget); | ||
|
||
await Future.delayed( | ||
const Duration(seconds: 3), | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.