-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_notes_test.dart
56 lines (50 loc) · 2.18 KB
/
save_notes_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// import 'package:firebase_core/firebase_core.dart';
// import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
// import 'package:flutter_quill/flutter_quill.dart';
// import 'package:flutter_quill_test/flutter_quill_test.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:flutter/material.dart';
// import 'package:testnote/home.dart';
// // import 'package:firebase_auth_mocks/firebase_auth_mocks.dart';
// import 'package:flutter/services.dart';
// typedef Callback = void Function(MethodCall call);
// void setupFirebaseAuthMocks([Callback? customHandlers]) {
// TestWidgetsFlutterBinding.ensureInitialized();
// setupFirebaseCoreMocks();
// }
// void main() {
// TestWidgetsFlutterBinding.ensureInitialized();
// setupFirebaseAuthMocks();
// setUpAll(() async {
// await Firebase.initializeApp();
// });
// group('Save Notes', () {
// Firebase.initializeApp();
// testWidgets('Initial state', (WidgetTester tester) async {
// await tester.pumpWidget(const MaterialApp(home: NotepadHomePage()));
// // print(find.byType(QuillEditor));
// await tester.quillEnterText(find.byType(QuillEditor).first, 'Note 1 Testing Yes\n');
// await tester.tap(find.byKey(const Key('save_note_button')));
// // erase the content of note
// // await tester.quillUpdateEditingValue(find.byType(QuillEditor), 'a');
// await tester.tap(find.byKey(const Key('notes_list_button')));
// await tester.pumpAndSettle();
// // Print all text on the page
// final textFinder = find.byType(QuillEditor);
// final texts = tester.widgetList<QuillEditor>(textFinder);
// bool found = false;
// for (final text in texts) {
// if (text.configurations.controller.document.toPlainText() == 'Note 1 Testing Yes\n') {
// found = true;
// }
// }
// expect(found, true);
// // final textFinder = find.byType(Text);
// // final texts = tester.widgetList<Text>(textFinder);
// // for (final text in texts) {
// // print(text.data);
// // }
// // expect(find.text('Note 1 Testing Yes'), findsOneWidget);
// });
// });
// }