Skip to content

Instantly share code, notes, and snippets.

@Benson194
Last active August 24, 2021 05:43
Show Gist options
  • Save Benson194/6f0adbb8d8507dc9a2c8462650feb5fc to your computer and use it in GitHub Desktop.
Save Benson194/6f0adbb8d8507dc9a2c8462650feb5fc to your computer and use it in GitHub Desktop.
Golden Test
import 'dart:io';
void homeScreenTest() {
late Directory currentDirectory;
setUp(() {
currentDirectory = Directory.current;
});
group('Mock HomeScreen\n', () {
testWidgets('3. Golden test', (WidgetTester tester) async {
await tester.pumpWidget(homeScreen);
await expectLater(
find.byWidget(homeScreen),
matchesGoldenFile(
'${currentDirectory.path}/test/screens/home_screen/home_screen_test.png'));
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment