-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: close other tabs before switching workspace (#6830)
* fix: close other tabs before swtching workspace * test: close other tabs before switching workspace * chore: update release note * test: close other tabs before switching workspace
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import 'package:appflowy/env/cloud_env.dart'; | ||
import 'package:appflowy/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart'; | ||
import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart'; | ||
import 'package:appflowy/workspace/presentation/home/tabs/flowy_tab.dart'; | ||
import 'package:appflowy/workspace/presentation/home/tabs/tabs_manager.dart'; | ||
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import '../../../shared/constants.dart'; | ||
import '../../../shared/util.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
group('Tabs', () { | ||
testWidgets('close other tabs before opening a new workspace', | ||
(tester) async { | ||
await tester.initializeAppFlowy( | ||
cloudType: AuthenticatorType.appflowyCloudSelfHost, | ||
); | ||
await tester.tapGoogleLoginInButton(); | ||
await tester.expectToSeeHomePageWithGetStartedPage(); | ||
|
||
const name = 'AppFlowy.IO'; | ||
// the workspace will be opened after created | ||
await tester.createCollaborativeWorkspace(name); | ||
|
||
final loading = find.byType(Loading); | ||
await tester.pumpUntilNotFound(loading); | ||
|
||
// create new tabs in the workspace | ||
expect(find.byType(FlowyTab), findsNothing); | ||
|
||
const documentOneName = 'document one'; | ||
const documentTwoName = 'document two'; | ||
await tester.createNewPageInSpace( | ||
spaceName: Constants.generalSpaceName, | ||
layout: ViewLayoutPB.Document, | ||
pageName: documentOneName, | ||
); | ||
await tester.createNewPageInSpace( | ||
spaceName: Constants.generalSpaceName, | ||
layout: ViewLayoutPB.Document, | ||
pageName: documentTwoName, | ||
); | ||
|
||
/// Open second menu item in a new tab | ||
await tester.openAppInNewTab(documentOneName, ViewLayoutPB.Document); | ||
|
||
/// Open third menu item in a new tab | ||
await tester.openAppInNewTab(documentTwoName, ViewLayoutPB.Document); | ||
|
||
expect( | ||
find.descendant( | ||
of: find.byType(TabsManager), | ||
matching: find.byType(FlowyTab), | ||
), | ||
findsNWidgets(2), | ||
); | ||
|
||
// switch to the another workspace | ||
final Finder items = find.byType(WorkspaceMenuItem); | ||
await tester.openCollaborativeWorkspaceMenu(); | ||
await tester.pumpUntilFound(items); | ||
expect(items, findsNWidgets(2)); | ||
|
||
// open the first workspace | ||
await tester.tap(items.first); | ||
await tester.pumpUntilNotFound(loading); | ||
|
||
expect(find.byType(FlowyTab), findsNothing); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters