mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: add a loading indicator when creating, deleting, or switching workspaces. (#5067)
This commit is contained in:
@ -4,6 +4,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:appflowy/env/cloud_env.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart';
|
||||
import 'package:appflowy/shared/feature_flags.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
import 'package:appflowy/user/application/auth/af_cloud_mock_auth_service.dart';
|
||||
@ -51,33 +52,23 @@ void main() {
|
||||
await tester.expectToSeeHomePageWithGetStartedPage();
|
||||
|
||||
const name = 'AppFlowy.IO';
|
||||
// the workspace will be opened after created
|
||||
await tester.createCollaborativeWorkspace(name);
|
||||
|
||||
// see the success message
|
||||
var success = find.text(LocaleKeys.workspace_createSuccess.tr());
|
||||
expect(success, findsOneWidget);
|
||||
await tester.pumpUntilNotFound(success);
|
||||
final loading = find.byType(Loading);
|
||||
await tester.pumpUntilNotFound(loading);
|
||||
|
||||
// check the create result
|
||||
Finder success;
|
||||
|
||||
// delete the newly created workspace
|
||||
await tester.openCollaborativeWorkspaceMenu();
|
||||
var items = find.byType(WorkspaceMenuItem);
|
||||
final Finder items = find.byType(WorkspaceMenuItem);
|
||||
expect(items, findsNWidgets(2));
|
||||
expect(
|
||||
tester.widget<WorkspaceMenuItem>(items.last).workspace.name,
|
||||
name,
|
||||
);
|
||||
|
||||
// open the newly created workspace
|
||||
await tester.tapButton(items.last, milliseconds: 1000);
|
||||
success = find.text(LocaleKeys.workspace_openSuccess.tr());
|
||||
await tester.pumpUntilFound(success);
|
||||
expect(success, findsOneWidget);
|
||||
await tester.pumpUntilNotFound(success);
|
||||
|
||||
await tester.closeCollaborativeWorkspaceMenu();
|
||||
|
||||
// delete the newly created workspace
|
||||
await tester.openCollaborativeWorkspaceMenu();
|
||||
final secondWorkspace = find.byType(WorkspaceMenuItem).last;
|
||||
await tester.hoverOnWidget(
|
||||
secondWorkspace,
|
||||
@ -97,20 +88,11 @@ void main() {
|
||||
await tester.tapButton(find.text(LocaleKeys.button_ok.tr()));
|
||||
// delete success
|
||||
success = find.text(LocaleKeys.workspace_createSuccess.tr());
|
||||
await tester.pumpUntilFound(success);
|
||||
expect(success, findsOneWidget);
|
||||
await tester.pumpUntilNotFound(success);
|
||||
},
|
||||
);
|
||||
|
||||
// check the result
|
||||
await tester.openCollaborativeWorkspaceMenu();
|
||||
items = find.byType(WorkspaceMenuItem);
|
||||
expect(items, findsOneWidget);
|
||||
expect(
|
||||
tester.widget<WorkspaceMenuItem>(items.last).workspace.name != name,
|
||||
true,
|
||||
);
|
||||
await tester.closeCollaborativeWorkspaceMenu();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -180,7 +180,11 @@ extension AppFlowyTestBase on WidgetTester {
|
||||
buttons: buttons,
|
||||
warnIfMissed: warnIfMissed,
|
||||
);
|
||||
await pumpAndSettle(Duration(milliseconds: milliseconds));
|
||||
await pumpAndSettle(
|
||||
Duration(milliseconds: milliseconds),
|
||||
EnginePhase.sendSemanticsUpdate,
|
||||
const Duration(seconds: 5),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> tapButtonWithName(
|
||||
|
@ -528,7 +528,7 @@ extension CommonOperations on WidgetTester {
|
||||
final workspace = find.byType(SidebarWorkspace);
|
||||
expect(workspace, findsOneWidget);
|
||||
// click it
|
||||
await tapButton(workspace);
|
||||
await tapButton(workspace, milliseconds: 2000);
|
||||
}
|
||||
|
||||
Future<void> closeCollaborativeWorkspaceMenu() async {
|
||||
@ -560,7 +560,6 @@ extension CommonOperations on WidgetTester {
|
||||
|
||||
// input the workspace name
|
||||
await enterText(find.byType(TextField), name);
|
||||
await pumpAndSettle();
|
||||
|
||||
await tapButtonWithName(LocaleKeys.button_ok.tr());
|
||||
}
|
||||
|
Reference in New Issue
Block a user