mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[Fix] Integration test flakes. (#2635)
* feat: add tearDown and tearDownAll to reset workspaces * fix: register tearDown and tearDownAll in empty_document_test * feat: register tearDown and tearDownAll in board_test * feat: register tearDown and tearDownAll in open_ai
This commit is contained in:
parent
7ca028942c
commit
5a7339b092
@ -34,6 +34,8 @@ void main() {
|
||||
group('board', () {
|
||||
setUpAll(() async => await service.setUpAll());
|
||||
setUp(() async => await service.setUp());
|
||||
tearDown(() async => await service.tearDown());
|
||||
tearDownAll(() async => await service.tearDownAll());
|
||||
|
||||
testWidgets(
|
||||
'integration test unzips the proper workspace and loads it correctly.',
|
||||
|
@ -30,6 +30,8 @@ void main() {
|
||||
group('Tests on a workspace with only an empty document', () {
|
||||
setUpAll(() async => await service.setUpAll());
|
||||
setUp(() async => await service.setUp());
|
||||
tearDown(() async => await service.tearDown());
|
||||
tearDownAll(() async => await service.tearDownAll());
|
||||
|
||||
testWidgets('/board shortcut creates a new board and view of the board',
|
||||
(tester) async {
|
||||
@ -69,6 +71,7 @@ void main() {
|
||||
],
|
||||
tester: tester,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Checks whether new board is referenced and properly on the page.
|
||||
expect(find.byType(BuiltInPageWidget), findsOneWidget);
|
||||
@ -113,7 +116,12 @@ void main() {
|
||||
expect(find.byType(SelectionMenuItemWidget), findsAtLeastNWidgets(2));
|
||||
|
||||
// Finalizes the slash command that creates the board.
|
||||
await simulateKeyDownEvent(LogicalKeyboardKey.enter);
|
||||
await FlowyTestKeyboard.simulateKeyDownEvent(
|
||||
[
|
||||
LogicalKeyboardKey.enter,
|
||||
],
|
||||
tester: tester,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Checks whether new board is referenced and properly on the page.
|
||||
|
@ -16,6 +16,8 @@ void main() {
|
||||
group('integration tests for open-ai smart menu', () {
|
||||
setUpAll(() async => await service.setUpAll());
|
||||
setUp(() async => await service.setUp());
|
||||
tearDown(() async => await service.tearDown());
|
||||
tearDownAll(() async => await service.tearDownAll());
|
||||
|
||||
testWidgets('testing selection on open-ai smart menu replace', (tester) async {
|
||||
final appFlowyEditor = await setUpOpenAITesting(tester);
|
||||
|
@ -39,6 +39,13 @@ enum TestWorkspace {
|
||||
return root;
|
||||
}
|
||||
|
||||
Future<void> clean() async {
|
||||
final Directory workspaceRoot = await root;
|
||||
if (await workspaceRoot.exists()) {
|
||||
workspaceRoot.delete(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
String get _asset => 'assets/test/workspaces/$_name.zip';
|
||||
}
|
||||
|
||||
@ -67,4 +74,12 @@ class TestWorkspaceService {
|
||||
await TestWorkspace._parent.then((value) => value.path),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> tearDown() async {
|
||||
await workspace.clean();
|
||||
}
|
||||
|
||||
Future<void> tearDownAll() async {
|
||||
await SharedPreferences.getInstance().then((value) => value.remove(kSettingsLocationDefaultLocation));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user