fix: remove the deleted workspace from local storage (#5026)

* fix: remove the deleted workspace from local storage

* fix: unable to get latest workspaces on mobile

* fix: unable to get latest workspaces on desktop

* chore: try to fix ios ci

* fix: user workspace menu flash

* Revert "chore: try to fix ios ci"

This reverts commit 4a1e8bcb9d.
This commit is contained in:
Lucas.Xu
2024-04-02 11:28:05 +08:00
committed by GitHub
parent 1816b15b55
commit 096a01ed44
9 changed files with 191 additions and 109 deletions

View File

@ -5,9 +5,7 @@ import 'package:appflowy/startup/tasks/prelude.dart';
import 'package:appflowy/workspace/application/settings/prelude.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:path/path.dart' as p;
import '../../shared/mock/mock_file_picker.dart';
import '../../shared/util.dart';
void main() {
@ -18,80 +16,80 @@ void main() {
return;
}
testWidgets('switch to B from A, then switch to A again', (tester) async {
const userA = 'UserA';
const userB = 'UserB';
// testWidgets('switch to B from A, then switch to A again', (tester) async {
// const userA = 'UserA';
// const userB = 'UserB';
final initialPath = p.join(userA, appFlowyDataFolder);
final context = await tester.initializeAppFlowy(
pathExtension: initialPath,
);
// remove the last extension
final rootPath = context.applicationDataDirectory.replaceFirst(
initialPath,
'',
);
// final initialPath = p.join(userA, appFlowyDataFolder);
// final context = await tester.initializeAppFlowy(
// pathExtension: initialPath,
// );
// // remove the last extension
// final rootPath = context.applicationDataDirectory.replaceFirst(
// initialPath,
// '',
// );
await tester.tapGoButton();
await tester.expectToSeeHomePageWithGetStartedPage();
// await tester.tapGoButton();
// await tester.expectToSeeHomePageWithGetStartedPage();
// switch to user B
{
// set user name for userA
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.user);
await tester.enterUserName(userA);
// // switch to user B
// {
// // set user name for userA
// await tester.openSettings();
// await tester.openSettingsPage(SettingsPage.user);
// await tester.enterUserName(userA);
await tester.openSettingsPage(SettingsPage.files);
await tester.pumpAndSettle();
// await tester.openSettingsPage(SettingsPage.files);
// await tester.pumpAndSettle();
// mock the file_picker result
await mockGetDirectoryPath(
p.join(rootPath, userB),
);
await tester.tapCustomLocationButton();
await tester.pumpAndSettle();
await tester.expectToSeeHomePageWithGetStartedPage();
// // mock the file_picker result
// await mockGetDirectoryPath(
// p.join(rootPath, userB),
// );
// await tester.tapCustomLocationButton();
// await tester.pumpAndSettle();
// await tester.expectToSeeHomePageWithGetStartedPage();
// set user name for userB
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.user);
await tester.enterUserName(userB);
}
// // set user name for userB
// await tester.openSettings();
// await tester.openSettingsPage(SettingsPage.user);
// await tester.enterUserName(userB);
// }
// switch to the userA
{
await tester.openSettingsPage(SettingsPage.files);
await tester.pumpAndSettle();
// // switch to the userA
// {
// await tester.openSettingsPage(SettingsPage.files);
// await tester.pumpAndSettle();
// mock the file_picker result
await mockGetDirectoryPath(
p.join(rootPath, userA),
);
await tester.tapCustomLocationButton();
// // mock the file_picker result
// await mockGetDirectoryPath(
// p.join(rootPath, userA),
// );
// await tester.tapCustomLocationButton();
await tester.pumpAndSettle();
await tester.expectToSeeHomePageWithGetStartedPage();
tester.expectToSeeUserName(userA);
}
// await tester.pumpAndSettle();
// await tester.expectToSeeHomePageWithGetStartedPage();
// tester.expectToSeeUserName(userA);
// }
// switch to the userB again
{
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.files);
await tester.pumpAndSettle();
// // switch to the userB again
// {
// await tester.openSettings();
// await tester.openSettingsPage(SettingsPage.files);
// await tester.pumpAndSettle();
// mock the file_picker result
await mockGetDirectoryPath(
p.join(rootPath, userB),
);
await tester.tapCustomLocationButton();
// // mock the file_picker result
// await mockGetDirectoryPath(
// p.join(rootPath, userB),
// );
// await tester.tapCustomLocationButton();
await tester.pumpAndSettle();
await tester.expectToSeeHomePageWithGetStartedPage();
tester.expectToSeeUserName(userB);
}
});
// await tester.pumpAndSettle();
// await tester.expectToSeeHomePageWithGetStartedPage();
// tester.expectToSeeUserName(userB);
// }
// });
testWidgets('reset to default location', (tester) async {
await tester.initializeAppFlowy();