| 
									
										
										
										
											2023-07-31 19:06:01 +07:00
										 |  |  | import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; | 
					
						
							| 
									
										
										
										
											2023-06-14 22:16:33 +08:00
										 |  |  | import 'package:flutter_test/flutter_test.dart'; | 
					
						
							|  |  |  | import 'package:integration_test/integration_test.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-27 18:54:31 -08:00
										 |  |  | import '../util/database_test_op.dart'; | 
					
						
							|  |  |  | import '../util/util.dart'; | 
					
						
							| 
									
										
										
										
											2023-06-14 22:16:33 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | void main() { | 
					
						
							|  |  |  |   IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   group('grid', () { | 
					
						
							|  |  |  |     testWidgets('create row of the grid', (tester) async { | 
					
						
							|  |  |  |       await tester.initializeAppFlowy(); | 
					
						
							|  |  |  |       await tester.tapGoButton(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  |       await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid); | 
					
						
							| 
									
										
										
										
											2023-06-14 22:16:33 +08:00
										 |  |  |       await tester.tapCreateRowButtonInGrid(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // The initial number of rows is 3
 | 
					
						
							|  |  |  |       await tester.assertNumberOfRowsInGridPage(4); | 
					
						
							|  |  |  |       await tester.pumpAndSettle(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     testWidgets('create row from row menu of the grid', (tester) async { | 
					
						
							|  |  |  |       await tester.initializeAppFlowy(); | 
					
						
							|  |  |  |       await tester.tapGoButton(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  |       await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid); | 
					
						
							| 
									
										
										
										
											2023-07-31 19:06:01 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 22:16:33 +08:00
										 |  |  |       await tester.hoverOnFirstRowOfGrid(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await tester.tapCreateRowButtonInRowMenuOfGrid(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // The initial number of rows is 3
 | 
					
						
							|  |  |  |       await tester.assertNumberOfRowsInGridPage(4); | 
					
						
							|  |  |  |       await tester.assertRowCountInGridPage(4); | 
					
						
							|  |  |  |       await tester.pumpAndSettle(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     testWidgets('delete row of the grid', (tester) async { | 
					
						
							|  |  |  |       await tester.initializeAppFlowy(); | 
					
						
							|  |  |  |       await tester.tapGoButton(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  |       await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid); | 
					
						
							| 
									
										
										
										
											2023-06-14 22:16:33 +08:00
										 |  |  |       await tester.hoverOnFirstRowOfGrid(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // Open the row menu and then click the delete
 | 
					
						
							|  |  |  |       await tester.tapRowMenuButtonInGrid(); | 
					
						
							|  |  |  |       await tester.tapDeleteOnRowMenu(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // The initial number of rows is 3
 | 
					
						
							|  |  |  |       await tester.assertNumberOfRowsInGridPage(2); | 
					
						
							|  |  |  |       await tester.assertRowCountInGridPage(2); | 
					
						
							|  |  |  |       await tester.pumpAndSettle(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     testWidgets('check number of row indicator in the initial grid', | 
					
						
							|  |  |  |         (tester) async { | 
					
						
							|  |  |  |       await tester.initializeAppFlowy(); | 
					
						
							|  |  |  |       await tester.tapGoButton(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  |       await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid); | 
					
						
							| 
									
										
										
										
											2023-06-14 22:16:33 +08:00
										 |  |  |       await tester.assertRowCountInGridPage(3); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await tester.pumpAndSettle(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } |