Skip to content

Commit

Permalink
Add simple flutter integration test #118
Browse files Browse the repository at this point in the history
  • Loading branch information
up2code committed Jul 12, 2021
1 parent ceae886 commit 3d9ab35
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
21 changes: 21 additions & 0 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:vocadb_app/main.dart' as app;

void main() {
group('App Test', () {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets("full app test", (WidgetTester tester) async {
await app.main();
await tester.pumpAndSettle();

expect(find.byKey(Key('songShortcut')), findsWidgets);
expect(find.byKey(Key('artistShortcut')), findsWidgets);
expect(find.byKey(Key('albumShortcut')), findsWidgets);
expect(find.byKey(Key('tagShortcut')), findsWidgets);
expect(find.byKey(Key('eventShortcut')), findsWidgets);
});
});
}
6 changes: 6 additions & 0 deletions lib/src/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,34 @@ class HomePage extends GetView<HomePageController> {
SpaceDivider.small(),
Center(
child: Wrap(
key: Key('shortcutButtons'),
crossAxisAlignment: WrapCrossAlignment.center,
alignment: WrapAlignment.start,
runAlignment: WrapAlignment.center,
runSpacing: 24.0,
children: <Widget>[
_ShortcutMenuButton(
key: Key('songShortcut'),
title: 'songs'.tr,
iconData: Icons.music_note,
onPressed: this._onTapSongSearchIcon),
_ShortcutMenuButton(
key: Key('artistShortcut'),
title: 'artists'.tr,
iconData: Icons.person,
onPressed: this._onTapArtistSearchIcon),
_ShortcutMenuButton(
key: Key('albumShortcut'),
title: 'albums'.tr,
iconData: Icons.album,
onPressed: this._onTapAlbumSearchIcon),
_ShortcutMenuButton(
key: Key('tagShortcut'),
title: 'tags'.tr,
iconData: Icons.label,
onPressed: this._onTapTagSearchIcon),
_ShortcutMenuButton(
key: Key('eventShortcut'),
title: 'events'.tr,
iconData: Icons.event,
onPressed: this._onTapEventSearchIcon),
Expand Down
63 changes: 63 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -479,6 +486,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.10"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
octo_image:
dependency: transitive
description:
Expand Down Expand Up @@ -612,6 +626,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.4"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
shelf_web_socket:
dependency: transitive
description:
Expand All @@ -638,6 +666,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10"
source_span:
dependency: transitive
description:
Expand Down Expand Up @@ -708,13 +750,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.8"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.19"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -813,6 +869,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
win32:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dev_dependencies:
flutter_driver:
sdk: flutter
build_runner: ^2.0.5
test: ^1.16.8

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
3 changes: 3 additions & 0 deletions test_driver/integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:integration_test/integration_test_driver.dart';

void main() => integrationDriver();

0 comments on commit 3d9ab35

Please sign in to comment.