Fakultas Ilmu Komputer UI

Commit b1cb6c91 authored by Manuel Yoseph Ray's avatar Manuel Yoseph Ray
Browse files

[REFACTOR] benerin test ferdi

parent 95ebc8c7
Pipeline #81934 passed with stages
in 7 minutes and 22 seconds
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-06-07 04:55:01.189349","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-06-07 05:10:51.694683","version":"2.0.1"}
\ No newline at end of file
......@@ -13,7 +13,7 @@ Widget unregisteredUser(BuildContext context) {
child: GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return MaterialApp(home: BiodataBody());
return MaterialApp(home: Transaction());
}));
},
child: Card(
......
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fundex_app/pages/kyc/alamat_body.dart';
void main() {
testWidgets('Page mempunyai app bar', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
expect(find.text('e-KYC Pemodal'), findsOneWidget);
});
testWidgets('Terdapat Checkpoint', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.byKey(Key("checkpoint")), findsOneWidget);
expect(find.byKey(Key("line")), findsOneWidget);
});
testWidgets('Terdapat text alamat', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.byKey(Key('teksAlamat')), findsOneWidget);
expect(find.text('Alamat Lengkap Sesuai KTP *'), findsOneWidget);
});
test('Field alamat tidak diisi', (){
var tes = ValidasiAlamat.validate('');
expect(tes, 'Alamat harus di isi');
});
test('Field alamat diisi', (){
var tes = ValidasiAlamat.validate('Jl. Raya gede banget');
expect(tes, null);
});
testWidgets('Terdapat text kode pos', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.text('Kode Pos *'), findsOneWidget);
});
test('Field kode pos tidak diisi', (){
var tes = ValidasiKodePos.validate('');
expect(tes, 'kode pos harus di isi');
});
test('kode pos tidak valid', (){
var tes = ValidasiKodePos.validate('147qwer');
expect(tes, 'kode pos tidak valid');
});
test('Field kode pos diisi', (){
var tes = ValidasiKodePos.validate('1475302');
expect(tes, null);
});
testWidgets('typeAHead berhasil', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.text("Provinsi *"), findsOneWidget);
final typeAHead = find.byKey(Key('typeahead'));
expect(typeAHead, findsOneWidget);
await tester.tap(typeAHead);
await tester.enterText(typeAHead, 'DKI Jakarta');
await tester.tap(typeAHead);
await tester.pump();
expect(find.text('DKI Jakarta'), findsWidgets);
});
test('Field Tempat Lahir tidak diisi', (){
var tes = ValidasiTempat.validate('');
expect(tes, 'Provinsi harus di isi');
});
test('Field Tempat Lahir diisi', (){
var tes = ValidasiTempat.validate('DKI Jakarta');
expect(tes, null);
});
testWidgets('typeAHead kabupaten berhasil', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.text("Kabupaten / Kota *"), findsOneWidget);
final typeAHead = find.byKey(Key('typeaheadKabupaten'));
expect(typeAHead, findsOneWidget);
await tester.tap(typeAHead);
await tester.enterText(typeAHead, 'Jakarta Timur');
await tester.tap(typeAHead);
await tester.pump();
expect(find.text('Jakarta Timur'), findsWidgets);
});
test('Field Kabupaten tidak diisi', (){
var tes = ValidasiKabupaten.validate('');
expect(tes, 'Kabupaten harus di isi');
});
test('Field Kabupaten diisi', (){
var tes = ValidasiKabupaten.validate('Jakarta Timur');
expect(tes, null);
});
testWidgets('typeAHead kecamatan berhasil', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.text("Kecamatan *"), findsOneWidget);
final typeAHead = find.byKey(Key('typeaheadKecamatan'));
expect(typeAHead, findsOneWidget);
await tester.tap(typeAHead);
await tester.enterText(typeAHead, 'Ciracas');
await tester.tap(typeAHead);
await tester.pump();
expect(find.text('Ciracas'), findsWidgets);
});
test('Field Kecamatan tidak diisi', (){
var tes = ValidasiKecamatan.validate('');
expect(tes, 'Kecamatan harus di isi');
});
test('Field Kecamatan diisi', (){
var tes = ValidasiKecamatan.validate('Ciracas');
expect(tes, null);
});
testWidgets('textfield kelurahan berhasil', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.text("Kelurahan *"), findsOneWidget);
});
test('Field Kecamatan tidak diisi', (){
var tes = ValidasiKelurahan.validate('');
expect(tes, 'Kelurahan harus di isi');
});
test('Field Kecamatan diisi', (){
var tes = ValidasiKelurahan.validate('Ciracas');
expect(tes, null);
});
testWidgets('checkbox berhasil', (WidgetTester tester) async {
bool _checkBox = false;
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(find.text('Alamat domisili tidak sesuai dengan KTP'), findsOneWidget);
await tester.tap(find.byType(Checkbox));
await tester.pumpAndSettle();
expect(_checkBox, false);
_checkBox = true;
await tester.pumpAndSettle();
expect(_checkBox, true);
});
testWidgets('Button selanjutnya', (WidgetTester tester) async {
final buttonSelanjutnya = find.byKey(Key('selanjutnyaButton'));
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(buttonSelanjutnya, findsOneWidget);
expect(find.text("Selanjutnya"), findsOneWidget);
await tester.tap(buttonSelanjutnya);
await tester.pumpAndSettle();
});
testWidgets('Button sebelumnya', (WidgetTester tester) async {
final buttonSebelumnya= find.byKey(Key('sebelumnyaButton'));
await tester.pumpWidget(MaterialApp(home: AlamatBody()));
expect(buttonSebelumnya, findsOneWidget);
expect(find.text("Sebelumnya"), findsOneWidget);
await tester.tap(buttonSebelumnya);
await tester.pumpAndSettle();
});
}
\ No newline at end of file
// import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fundex_app/pages/kyc/biodata_keluarga_body.dart';
void main() {
// testWidgets('button selanjutnya mengarah ke page selanjutnya ketika ditekan',
// (WidgetTester tester) async {
// // initialize
// final namaIbuFormField = find.byKey(Key('nama'));
// final textFieldnamaAhli = find.byKey(Key('namaAhli'));
// final textFieldHubunganAhli = find.byKey(Key('namaHubunganAhli'));
// final textFieldNomor = find.byKey(Key('nomor'));
// final textFieldAlamat = find.byKey(Key('keyAlamatAhli'));
// final buttonSelanjutnya = find.byKey(Key('selanjutnyaButton'));
// // execute
// await tester.pumpWidget(MaterialApp(
// home: BiodataKeluarga(),
// ));
// await tester.tap(find.byKey(Key('key1')));
// await tester.tap(namaIbuFormField);
// await tester.enterText(namaIbuFormField, 'Siti');
// await tester.tap(namaIbuFormField);
// await tester.enterText(textFieldnamaAhli, 'Maimunah');
// await tester.tap(textFieldHubunganAhli);
// await tester.enterText(textFieldHubunganAhli, 'Ibu dan Anak');
// await tester.tap(textFieldNomor);
// await tester.enterText(textFieldNomor, '082110938231');
// await tester.tap(textFieldAlamat);
// await tester.enterText(textFieldAlamat, 'JL. Raya Pondok Gede');
// await tester.tap(buttonSelanjutnya);
// await tester.pumpAndSettle();
// });
// testWidgets('Page mempunyai app bar', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.byType(IconButton), findsOneWidget);
// expect(find.byIcon(Icons.arrow_back), findsOneWidget);
// expect(find.text('e-KYC Pemodal'), findsOneWidget);
// });
// testWidgets('IconButton AppBar size', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// final RenderBox barBox = tester.renderObject(find.byType(AppBar));
// final RenderBox iconBox = tester.renderObject(find.byType(IconButton));
// expect(iconBox.size.height, isNot(barBox.size.height));
// });
// testWidgets('Terdapat Checkpoint', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.byKey(Key('checkpoint')), findsOneWidget);
// expect(find.byKey(Key("container garis bulat checkpoint")), findsOneWidget);
// expect(find.byKey(Key("container text checkpoint")), findsOneWidget);
// expect(find.byKey(Key("line")), findsOneWidget);
// });
// testWidgets('Terdapat 3 icon checklist', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.byIcon(Icons.check_outlined), findsNWidgets(3));
// });
// testWidgets('Terdapat text pada container form', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.byKey(Key('teksBiodata')), findsOneWidget);
// expect(find.text('Nama Gadis Ibu Kandung *'), findsOneWidget);
// });
// testWidgets('onChanged callbacks are called', (WidgetTester tester) async {
// final textFieldnama = find.byKey(Key('nama'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(textFieldnama, findsOneWidget);
// await tester.enterText(textFieldnama, 'Muhammad Farhan Ghaffar');
// await tester.pump();
// expect(find.text('Muhammad Farhan Ghaffar'), findsOneWidget);
// });
test('Field kosong', (){
var tes = ValidasiNama.validate('');
expect(tes, 'Nama harus di isi');
});
test('Field tidak kosong', (){
var tes = ValidasiNama.validate('Siti');
expect(tes, null);
});
// testWidgets('Radio control test', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.text('Status Menikah *'), findsOneWidget);
// expect(find.text('Belum Menikah'), findsOneWidget);
// expect(find.text('Menikah'), findsOneWidget);
// await tester.tap(find.byKey(Key('key1')));
// await tester.tap(find.byKey(Key('key2')));
// });
// testWidgets('Terdapat text pada container form nama ahli waris', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.text('Nama Ahli Waris'), findsOneWidget);
// });
// testWidgets('fungsi textfield nama ahli waris berhasil', (WidgetTester tester) async {
// final textFieldnama = find.byKey(Key('namaAhli'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(textFieldnama, findsOneWidget);
// await tester.enterText(textFieldnama, 'Maimunah');
// await tester.pump();
// expect(find.text('Maimunah'), findsOneWidget);
// });
// testWidgets('Terdapat text pada container form hubungan dengan ahli waris', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.text('Hubungan dengan Ahli Waris'), findsOneWidget);
// });
// testWidgets('fungsi textfield hubungan dengan ahli waris berhasil', (WidgetTester tester) async {
// final textFieldnama = find.byKey(Key('namaHubunganAhli'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(textFieldnama, findsOneWidget);
// await tester.enterText(textFieldnama, 'Ibu dan Anak');
// await tester.pump();
// expect(find.text('Ibu dan Anak'), findsOneWidget);
// });
// testWidgets('Terdapat text ', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.text('Nomor Handphone Ahli Waris'), findsOneWidget);
// });
// testWidgets('fungsi textfield No. HP berhasil', (WidgetTester tester) async {
// final textFieldnama = find.byKey(Key('nomor'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(textFieldnama, findsOneWidget);
// await tester.enterText(textFieldnama, '082110938231');
// await tester.pump();
// expect(find.text('082110938231'), findsOneWidget);
// });
// testWidgets('Terdapat text ', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(find.text('Alamat Ahli Waris'), findsOneWidget);
// });
// testWidgets('fungsi textfield Alamat Ahli berhasil', (WidgetTester tester) async {
// final textFieldnama = find.byKey(Key('keyAlamatAhli'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(textFieldnama, findsOneWidget);
// await tester.enterText(textFieldnama, 'JL. Raya Pondok Gede');
// await tester.pump();
// expect(find.text('JL. Raya Pondok Gede'), findsOneWidget);
// });
// testWidgets('Button selanjutnya', (WidgetTester tester) async {
// final buttonSelanjutnya = find.byKey(Key('selanjutnyaButton'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(buttonSelanjutnya, findsOneWidget);
// expect(find.text("Selanjutnya"), findsOneWidget);
// await tester.tap(buttonSelanjutnya);
// await tester.pumpAndSettle();
// });
// testWidgets('Button sebelumnya', (WidgetTester tester) async {
// final buttonSebelumnya= find.byKey(Key('sebelumnyaButton'));
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// expect(buttonSebelumnya, findsOneWidget);
// expect(find.text("Sebelumnya"), findsOneWidget);
// await tester.tap(buttonSebelumnya);
// await tester.pumpAndSettle();
// });
// testWidgets('textfield ketika status menikah muncul', (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: BiodataKeluarga()));
// await tester.tap(find.byKey(Key('key2')));
// await tester.pump();
// expect(find.text("Nama Lengkap Pasangan *"), findsOneWidget);
// await tester.enterText(find.byKey(Key('namaLengkapPasangan')), 'jupri');
// expect(find.text("jupri"), findsOneWidget);
// });
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fundex_app/pages/kyc/biodata_body.dart';
void main() {
testWidgets('Page mempunyai app bar', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
expect(find.text('e-KYC Pemodal'), findsOneWidget);
});
testWidgets('Terdapat Checkpoint', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.byKey(Key('checkpoint')), findsOneWidget);
expect(find.byKey(Key("line")), findsOneWidget);
});
testWidgets('Terdapat text', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.byKey(Key('teksBiodata')), findsOneWidget);
expect(find.text('Nama Lengkap *'), findsOneWidget);
});
test('Field nama tidak diisi', () {
var tes = ValidasiNama.validate('');
expect(tes, 'Nama harus di isi');
});
test('Field nama diisi', () {
var tes = ValidasiNama.validate('Muhammad Farhan Ghaffar');
expect(tes, null);
});
testWidgets('Terdapat text ', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.text('Email *'), findsOneWidget);
});
test('Field email tidak diisi', () {
var tes = ValidasiEmail.validate('');
expect(tes, 'Email harus di isi');
});
test('Email tidak valid', () {
var tes = ValidasiEmail.validate('woyowyo.!');
expect(tes, 'Email tidak valid');
});
test('Field email diisi', () {
var tes = ValidasiEmail.validate('Farhan26@gmail.com');
expect(tes, null);
});
testWidgets('Terdapat text ', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.text('No. Handphone *'), findsOneWidget);
});
test('Field No. HP tidak diisi', () {
var tes = ValidasiNomor.validate('');
expect(tes, 'No. Handphone harus di isi');
});
test('No. HP tidak valid', () {
var tes = ValidasiNomor.validate('aq903902');
expect(tes, 'No. HP tidak valid');
});
test('Field email diisi', () {
var tes = ValidasiNomor.validate('098765432112');
expect(tes, null);
});
testWidgets('Radio control test', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.text('Jenis Kelamin *'), findsOneWidget);
expect(find.text('Laki-Laki'), findsOneWidget);
expect(find.text('Perempuan'), findsOneWidget);
await tester.tap(find.byKey(Key('key1')));
await tester.tap(find.byKey(Key('key2')));
});
testWidgets('typeAHead berhasil', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.text("Tempat Lahir *"), findsOneWidget);
final typeAHead = find.byKey(Key('typeahead'));
expect(typeAHead, findsOneWidget);
await tester.tap(typeAHead);
await tester.enterText(typeAHead, 'DKI Jakarta');
await tester.tap(typeAHead);
await tester.pump();
expect(find.text('DKI Jakarta'), findsWidgets);
});
test('Field Tempat Lahir tidak diisi', () {
var tes = ValidasiTempat.validate('');
expect(tes, 'Tempat lahir harus di isi');
});
test('Field Tempat Lahir diisi', () {
var tes = ValidasiTempat.validate('DKI Jakarta');
expect(tes, null);
});
testWidgets('DatePicker berhasil', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(find.text("Tanggal Lahir *"), findsOneWidget);
final tanggalKey = find.byKey(Key('tanggal'));
expect(tanggalKey, findsOneWidget);
await tester.tap(tanggalKey);
await tester.pump();
expect(find.text("27"), findsWidgets);
await tester.tap(find.text('27'));
await tester.tap(find.text('OK'));
expect(find.text("2021/05/27"), findsWidgets);
});
test('Field Tanggal lahir tidak diisi', () {
var tes = ValidasiTanggal.validate('');
expect(tes, 'Tanggal harus di isi');
});
test('Field Tanggal lahir diisi', () {
var tes = ValidasiTanggal.validate('27/03/2021');
expect(tes, null);
});
testWidgets('Button selanjutnya', (WidgetTester tester) async {
final buttonSelanjutnya = find.byKey(Key('selanjutnya button'));
await tester.pumpWidget(MaterialApp(home: BiodataBody()));
expect(buttonSelanjutnya, findsOneWidget);
expect(find.text("Selanjutnya"), findsOneWidget);
await tester.tap(buttonSelanjutnya);
await tester.pumpAndSettle();
});
}
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fundex_app/pages/kyc/data_identitas.dart';
void main() {
testWidgets('page berhasil', (WidgetTester tester) async {
final noKtp = find.byKey(Key('noKtp'));
final noNpwp = find.byKey(Key('noNpwp'));
final dottedKTP = find.byKey(Key("dottedKTP"));
final dottedNPWP = find.byKey(Key("dottedNPWP"));
final dottedFotoSelfie = find.byKey(Key("dottedFotoSelfie"));
final dottedFotoSelfieDenganKTP = find.byKey(Key("dottedFotoSelfieDenganKTP"));
final sebelumnyaButton = find.byKey(Key('sebelumnyaButton'));
final selanjutnyaButton = find.byKey(Key('selanjutnyaButton'));
await tester.pumpWidget(MaterialApp(
home: DataIdentitas(),
));
await tester.tap(noKtp);
await tester.enterText(noKtp, '0394857623');
await tester.tap(noNpwp);
await tester.enterText(noNpwp, '0394813');
expect(dottedKTP, findsWidgets);
expect(find.byKey(Key('cameraIconKTP')), findsOneWidget);
await tester.tap(dottedKTP);
await tester.pumpAndSettle();
expect(dottedNPWP, findsWidgets);
expect(find.byKey(Key('cameraIconNPWP')), findsOneWidget);
await tester.tap(dottedNPWP);
await tester.pumpAndSettle();
expect(dottedFotoSelfie, findsWidgets);
expect(find.byKey(Key('cameraIconFS')), findsOneWidget);
await tester.tap(dottedFotoSelfie);
await tester.pumpAndSettle();
expect(dottedFotoSelfieDenganKTP, findsWidgets);
expect(find.byKey(Key('cameraIconFSKTP')), findsOneWidget);
await tester.tap(dottedFotoSelfieDenganKTP);
await tester.pumpAndSettle();
expect(sebelumnyaButton, findsOneWidget);
expect(selanjutnyaButton, findsOneWidget);
});
testWidgets('Page mempunyai app bar', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: DataIdentitas()));
expect(find.byType(IconButton), findsOneWidget);
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
expect(find.text('e-KYC Pemodal'), findsOneWidget);
});
testWidgets('IconButton AppBar size', (WidgetTester tester) async {
await tester.pumpWidget<