| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  | import 'package:app_flowy/startup/startup.dart'; | 
					
						
							| 
									
										
										
										
											2022-03-01 10:55:52 -05:00
										 |  |  | import 'package:app_flowy/user/application/auth_service.dart'; | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  | import 'package:flowy_infra/uuid.dart'; | 
					
						
							| 
									
										
										
										
											2022-07-04 15:07:11 +08:00
										 |  |  | import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart'; | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2022-02-19 17:12:44 +08:00
										 |  |  | import 'package:flutter_test/flutter_test.dart'; | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | class FlowyTest { | 
					
						
							|  |  |  |   static Future<FlowyTest> setup() async { | 
					
						
							| 
									
										
										
										
											2022-02-19 17:12:44 +08:00
										 |  |  |     TestWidgetsFlutterBinding.ensureInitialized(); | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  |     // await EasyLocalization.ensureInitialized();
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-20 16:10:50 +08:00
										 |  |  |     await FlowyRunner.run(FlowyTestApp()); | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  |     return FlowyTest(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-19 14:40:56 +08:00
										 |  |  |   Future<UserProfilePB> signIn() async { | 
					
						
							| 
									
										
										
										
											2022-03-01 10:55:52 -05:00
										 |  |  |     final authService = getIt<AuthService>(); | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  |     const password = "AppFlowy123@"; | 
					
						
							|  |  |  |     final uid = uuid(); | 
					
						
							|  |  |  |     final userEmail = "$uid@appflowy.io"; | 
					
						
							| 
									
										
										
										
											2022-03-01 10:55:52 -05:00
										 |  |  |     final result = await authService.signUp( | 
					
						
							| 
									
										
										
										
											2022-02-19 16:48:57 +08:00
										 |  |  |       name: "FlowyTestUser", | 
					
						
							|  |  |  |       password: password, | 
					
						
							|  |  |  |       email: userEmail, | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     return result.fold( | 
					
						
							|  |  |  |       (user) => user, | 
					
						
							|  |  |  |       (error) { | 
					
						
							|  |  |  |         throw StateError("$error"); | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FlowyTestApp implements EntryPoint { | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget create() { | 
					
						
							|  |  |  |     return Container(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |