Fakultas Ilmu Komputer UI

Commit a722fd15 authored by Fakhira Devina's avatar Fakhira Devina
Browse files

[REFACTOR] test fasilitas page

parent 8969d79c
Pipeline #38677 passed with stages
in 5 minutes and 13 seconds
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.6\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-04-07 01:23:10.522134","version":"1.15.17"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.6\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-04-07 01:32:49.994188","version":"1.15.17"}
\ No newline at end of file
......@@ -12,17 +12,53 @@ import 'package:ppl_disabilitas/page/filter_fasilitas/fasilitas.dart';
void main() {
Widget buildTestableWidget(Widget widget) {
// https://docs.flutter.io/flutter/widgets/MediaQuery-class.html
return MediaQuery(data: MediaQueryData(), child: MaterialApp(home: widget));
}
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(buildTestableWidget(Fasilitas(
alamat: 'Itu',
nama: 'Ya',
telpon: '9217424',
url: 'afalklksafn',
)));
await tester.tap(find.byKey(Key('FilterButton')));
await tester.pump(Duration(seconds: 1));
// inside filter
expect(find.byType(Container), findsNWidgets(28));
expect(find.byType(Row), findsNWidgets(17));
expect(find.byType(Column), findsNWidgets(4));
expect(find.byType(Text), findsNWidgets(21));
expect(find.byType(Flex), findsNothing);
expect(find.text('jns fasilitas'), findsNothing);
expect(find.text('urutn'), findsNothing);
expect(find.text('hps smw'), findsNothing);
// filter
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(Icon), findsNWidgets(5));
await tester.tap(find.byKey(Key('Tambah Informasi')));
await tester.pump();
});
testWidgets('find fasilitas page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(MaterialApp(home: Fasilitas()));
await tester.pumpWidget(buildTestableWidget(Fasilitas(
alamat: 'Itu',
nama: 'Ya',
telpon: '9217424',
url: 'afalklksafn',
)));
// Search for the childWidget in the tree and verify it exists.
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(Container), findsNWidgets(14));
expect(find.byType(Icon), findsNWidgets(6));
expect(find.byType(Container), findsNWidgets(10));
expect(find.byType(Icon), findsNWidgets(4));
expect(find.byType(Column), findsNWidgets(2));
expect(find.byType(Row), findsNWidgets(10));
expect(find.byType(Text), findsNWidgets(13));
expect(find.byType(Flexible), findsNWidgets(3));
expect(find.byType(Row), findsNWidgets(5));
expect(find.byType(Text), findsNWidgets(7));
expect(find.byType(Flexible), findsNWidgets(2));
expect(find.byType(FlatButton), findsNWidgets(2));
});
......
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ppl_disabilitas/page/filter_fasilitas/fasilitas.dart';
void main() {
Widget buildTestableWidget(Widget widget) {
// https://docs.flutter.io/flutter/widgets/MediaQuery-class.html
return MediaQuery(data: MediaQueryData(), child: MaterialApp(home: widget));
}
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(buildTestableWidget(Fasilitas(
alamat: 'Itu',
nama: 'Ya',
telpon: '9217424',
url: 'afalklksafn',
)));
await tester.tap(find.byKey(Key('FilterButton')));
await tester.pump(Duration(seconds: 1));
// inside filter
expect(find.byType(Container), findsNWidgets(28));
expect(find.byType(Row), findsNWidgets(17));
expect(find.byType(Column), findsNWidgets(4));
expect(find.byType(Text), findsNWidgets(21));
expect(find.byType(Flex), findsNothing);
expect(find.text('jns fasilitas'), findsNothing);
expect(find.text('urutn'), findsNothing);
expect(find.text('hps smw'), findsNothing);
// filter
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(Icon), findsNWidgets(5));
await tester.tap(find.byKey(Key('Tambah Informasi')));
await tester.pump();
});
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment