Skip to content

Instantly share code, notes, and snippets.

@izznfkhrlislm
Created March 19, 2019 05:56
Show Gist options
  • Save izznfkhrlislm/327e02d44884017a6d5ce7485dc69e39 to your computer and use it in GitHub Desktop.
Save izznfkhrlislm/327e02d44884017a6d5ce7485dc69e39 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ScrumBooster/initScreen/HomeScreen.dart';
void main() {
final HomePage home = new HomePage();
testWidgets('Home Screen Drawer Test', (WidgetTester tester) async {
GlobalKey<ScaffoldState> scaffoldKey = home.getScaffoldKey();
await tester.pumpWidget(makeTestableWidget(child: home));
Key menu1 = new Key("Home");
Key menu2 = new Key("Ceremonies");
Key menu3 = new Key("Problems");
Key menu4 = new Key("Glossary");
Key menu5 = new Key("Pop Quiz!");
Key menu6 = new Key("About");
// Tap the 'burger menu' icon and trigger a frame.
scaffoldKey.currentState.openDrawer();
await tester.pump();
// Verify all the sidebar menu.
expect(find.byKey(menu1), findsOneWidget);
expect(find.byKey(menu2), findsOneWidget);
expect(find.byKey(menu3), findsOneWidget);
expect(find.byKey(menu4), findsOneWidget);
expect(find.byKey(menu5), findsOneWidget);
expect(find.byKey(menu6), findsOneWidget);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment