|
@@ -228,5 +228,69 @@ void main() {
|
|
|
final sidebarLabel = LocaleKeys.newPageText.tr();
|
|
|
expect(find.text(sidebarLabel), findsOneWidget);
|
|
|
});
|
|
|
+
|
|
|
+ testWidgets('/grid shortcut creates a new grid', (tester) async {
|
|
|
+ const folderName = 'appflowy';
|
|
|
+ await TestFolder.cleanTestLocation(folderName);
|
|
|
+ await TestFolder.setTestLocation(folderName);
|
|
|
+
|
|
|
+ await tester.initializeAppFlowy();
|
|
|
+
|
|
|
+ // tap open button
|
|
|
+ await mockGetDirectoryPath(folderName);
|
|
|
+ await tester.tapOpenFolderButton();
|
|
|
+
|
|
|
+ await tester.wait(1000);
|
|
|
+ await tester.expectToSeeWelcomePage();
|
|
|
+
|
|
|
+ final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
+
|
|
|
+ // Necessary for being able to enterText when not in debug mode
|
|
|
+ binding.testTextInput.register();
|
|
|
+
|
|
|
+ // Needs tab to obtain focus for the app flowy editor.
|
|
|
+ // by default the tap appears at the center of the widget.
|
|
|
+ final Finder editor = find.byType(AppFlowyEditor);
|
|
|
+ await tester.tap(editor);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+
|
|
|
+ // tester.sendText() cannot be used since the editor
|
|
|
+ // does not contain any EditableText widgets.
|
|
|
+ // to interact with the app during an integration test,
|
|
|
+ // simulate physical keyboard events.
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.enter);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.enter);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.slash);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.keyG);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.keyR);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.keyI);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.keyD);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+
|
|
|
+ // Checks whether the options in the selection menu
|
|
|
+ // for /grid exist.
|
|
|
+ expect(find.byType(SelectionMenuItemWidget), findsAtLeastNWidgets(2));
|
|
|
+
|
|
|
+ // Finalizes the slash command that creates the board.
|
|
|
+ await simulateKeyDownEvent(LogicalKeyboardKey.enter);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+
|
|
|
+ // Checks whether new board is referenced and properly on the page.
|
|
|
+ expect(find.byType(BuiltInPageWidget), findsOneWidget);
|
|
|
+
|
|
|
+ // Checks whether the new board is in the side bar.
|
|
|
+ final sidebarLabel = LocaleKeys.newPageText.tr();
|
|
|
+ expect(find.text(sidebarLabel), findsOneWidget);
|
|
|
+ });
|
|
|
});
|
|
|
}
|