mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: retain last workspace when restart app
This commit is contained in:
parent
7ca3f215a3
commit
3ef7c4990b
@ -51,41 +51,65 @@ async fn af_cloud_workspace_change_name_and_icon() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn af_cloud_create_workspace_test() {
|
async fn af_cloud_create_workspace_test() {
|
||||||
user_localhost_af_cloud().await;
|
let name = uuid::Uuid::new_v4().to_string();
|
||||||
let test = EventIntegrationTest::new().await;
|
let email;
|
||||||
let user_profile_pb = test.af_cloud_sign_up().await;
|
let second_workspace_id;
|
||||||
|
|
||||||
let workspaces = test.get_all_workspaces().await.items;
|
|
||||||
let first_workspace_id = workspaces[0].workspace_id.as_str();
|
|
||||||
assert_eq!(workspaces.len(), 1);
|
|
||||||
|
|
||||||
let created_workspace = test.create_workspace("my second workspace").await;
|
|
||||||
assert_eq!(created_workspace.name, "my second workspace");
|
|
||||||
|
|
||||||
let workspaces = get_synced_workspaces(&test, user_profile_pb.id).await;
|
|
||||||
assert_eq!(workspaces.len(), 2);
|
|
||||||
let _second_workspace = workspaces
|
|
||||||
.iter()
|
|
||||||
.find(|w| w.name == "my second workspace")
|
|
||||||
.expect("created workspace not found");
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// before opening new workspace
|
user_localhost_af_cloud().await;
|
||||||
let folder_ws = test.folder_read_current_workspace().await;
|
let test = EventIntegrationTest::new_with_name(name.clone()).await;
|
||||||
assert_eq!(&folder_ws.id, first_workspace_id);
|
let user_profile_pb = test.af_cloud_sign_up().await;
|
||||||
let views = test.folder_read_current_workspace_views().await;
|
email = user_profile_pb.email;
|
||||||
assert_eq!(views.items[0].parent_view_id.as_str(), first_workspace_id);
|
|
||||||
|
let workspaces = test.get_all_workspaces().await.items;
|
||||||
|
let first_workspace_id = workspaces[0].workspace_id.as_str();
|
||||||
|
assert_eq!(workspaces.len(), 1);
|
||||||
|
|
||||||
|
let created_workspace = test.create_workspace("my second workspace").await;
|
||||||
|
second_workspace_id = created_workspace.workspace_id.clone();
|
||||||
|
assert_eq!(created_workspace.name, "my second workspace");
|
||||||
|
|
||||||
|
let workspaces = get_synced_workspaces(&test, user_profile_pb.id).await;
|
||||||
|
assert_eq!(workspaces.len(), 2);
|
||||||
|
let _second_workspace = workspaces
|
||||||
|
.iter()
|
||||||
|
.find(|w| w.name == "my second workspace")
|
||||||
|
.expect("created workspace not found");
|
||||||
|
|
||||||
|
{
|
||||||
|
// before opening new workspace
|
||||||
|
let folder_ws = test.folder_read_current_workspace().await;
|
||||||
|
assert_eq!(&folder_ws.id, first_workspace_id);
|
||||||
|
let views = test.folder_read_current_workspace_views().await;
|
||||||
|
assert_eq!(views.items[0].parent_view_id.as_str(), first_workspace_id);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// after opening new workspace
|
||||||
|
test.open_workspace(&created_workspace.workspace_id).await;
|
||||||
|
let folder_ws = test.folder_read_current_workspace().await;
|
||||||
|
assert_eq!(folder_ws.id, created_workspace.workspace_id);
|
||||||
|
let views = test.folder_read_current_workspace_views().await;
|
||||||
|
assert_eq!(
|
||||||
|
views.items[0].parent_view_id.as_str(),
|
||||||
|
created_workspace.workspace_id
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// after opening new workspace
|
// Restart the app and read current workspace
|
||||||
test.open_workspace(&created_workspace.workspace_id).await;
|
user_localhost_af_cloud().await;
|
||||||
let folder_ws = test.folder_read_current_workspace().await;
|
let test = EventIntegrationTest::new_with_name(name).await;
|
||||||
assert_eq!(folder_ws.id, created_workspace.workspace_id);
|
test.af_cloud_sign_in_with_email(&email).await.unwrap();
|
||||||
let views = test.folder_read_current_workspace_views().await;
|
let user_profile_pb = test.get_user_profile().await.unwrap();
|
||||||
assert_eq!(
|
|
||||||
views.items[0].parent_view_id.as_str(),
|
let workspaces = get_synced_workspaces(&test, user_profile_pb.id).await;
|
||||||
created_workspace.workspace_id
|
assert_eq!(workspaces.len(), 2);
|
||||||
);
|
|
||||||
|
{
|
||||||
|
let folder_ws = test.folder_read_current_workspace().await;
|
||||||
|
assert_eq!(folder_ws.id, second_workspace_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user