-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
92 additions
and
5 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
87 changes: 87 additions & 0 deletions
87
.../features/pirate_coins/presentation/pirate_coins_page/pirate_coins_page_teacher_test.dart
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,87 @@ | ||
import "package:flutter_test/flutter_test.dart"; | ||
import "package:mocktail/mocktail.dart"; | ||
import "package:pirate_code/features/auth/data/auth_repository.dart"; | ||
import "package:pirate_code/features/pirate_coins/presentation/pirate_coins_page/pirate_coins_student_page.dart"; | ||
|
||
import "../../../../helpers/pump_app.dart"; | ||
|
||
void main() { | ||
group("Pirate Coins page is accessible...", () { | ||
group("is accessible...", () { | ||
testWidgets("on Android.", (tester) async { | ||
final mockAuthRepository = _MockAuthRepository(); | ||
verifyZeroInteractions(mockAuthRepository); | ||
|
||
await tester.pumpApp( | ||
overrides: [ | ||
authProvider.overrideWithValue(mockAuthRepository), | ||
], | ||
const PirateCoinsStudentPage(), | ||
); | ||
|
||
verify(() => mockAuthRepository.authenticate(anonymous: true)) | ||
.called(1); | ||
|
||
final handle = tester.ensureSemantics(); | ||
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); | ||
handle.dispose(); | ||
}); | ||
testWidgets("on iOS.", (tester) async { | ||
final mockAuthRepository = _MockAuthRepository(); | ||
verifyZeroInteractions(mockAuthRepository); | ||
|
||
await tester.pumpApp( | ||
overrides: [ | ||
authProvider.overrideWithValue(mockAuthRepository), | ||
], | ||
const PirateCoinsStudentPage(), | ||
); | ||
|
||
verify(() => mockAuthRepository.authenticate(anonymous: true)) | ||
.called(1); | ||
|
||
final handle = tester.ensureSemantics(); | ||
await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); | ||
handle.dispose(); | ||
}); | ||
testWidgets("according to the WCAG.", (tester) async { | ||
final mockAuthRepository = _MockAuthRepository(); | ||
verifyZeroInteractions(mockAuthRepository); | ||
|
||
await tester.pumpApp( | ||
overrides: [ | ||
authProvider.overrideWithValue(mockAuthRepository), | ||
], | ||
const PirateCoinsStudentPage(), | ||
); | ||
|
||
verify(() => mockAuthRepository.authenticate(anonymous: true)) | ||
.called(1); | ||
|
||
final handle = tester.ensureSemantics(); | ||
await expectLater(tester, meetsGuideline(textContrastGuideline)); | ||
handle.dispose(); | ||
}); | ||
testWidgets("with regard to labeling buttons.", (tester) async { | ||
final mockAuthRepository = _MockAuthRepository(); | ||
verifyZeroInteractions(mockAuthRepository); | ||
|
||
await tester.pumpApp( | ||
overrides: [ | ||
authProvider.overrideWithValue(mockAuthRepository), | ||
], | ||
const PirateCoinsStudentPage(), | ||
); | ||
|
||
verify(() => mockAuthRepository.authenticate(anonymous: true)) | ||
.called(1); | ||
|
||
final handle = tester.ensureSemantics(); | ||
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); | ||
handle.dispose(); | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
class _MockAuthRepository extends Mock implements AuthRepository {} |