Failing test for unmuting microphone

This commit is contained in:
Conrad Irwin 2024-01-08 22:23:34 -07:00
parent 844d161c40
commit 8669b08161
3 changed files with 45 additions and 13 deletions

View file

@ -3,7 +3,6 @@ use call::ActiveCall;
use editor::Editor;
use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext};
use rpc::proto;
use workspace::Workspace;
#[gpui::test]
async fn test_channel_guests(
@ -44,6 +43,8 @@ async fn test_channel_guests(
let active_call_b = cx_b.read(ActiveCall::global);
let project_b =
active_call_b.read_with(cx_b, |call, _| call.location().unwrap().upgrade().unwrap());
let room_b = active_call_b.update(cx_b, |call, _| call.room().unwrap().clone());
assert_eq!(
project_b.read_with(cx_b, |project, _| project.remote_id()),
Some(project_id),
@ -55,7 +56,8 @@ async fn test_channel_guests(
project.create_entry((worktree_id, "b.txt"), false, cx)
})
.await
.is_err())
.is_err());
assert!(room_b.read_with(cx_b, |room, _| !room.is_sharing_mic()));
}
#[gpui::test]
@ -64,7 +66,6 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
let client_a = server.create_client(cx_a, "user_a").await;
let client_b = server.create_client(cx_b, "user_b").await;
let active_call_a = cx_a.read(ActiveCall::global);
let active_call_b = cx_b.read(ActiveCall::global);
let channel_id = server
.make_public_channel("the-channel", &client_a, cx_a)
@ -76,7 +77,7 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
.unwrap();
// Client A shares a project in the channel
let project_id = active_call_a
active_call_a
.update(cx_a, |call, cx| call.share_project(project_a.clone(), cx))
.await
.unwrap();
@ -88,14 +89,29 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
.unwrap();
cx_a.run_until_parked();
let project_b =
active_call_b.read_with(cx_b, |call, _| call.location().unwrap().upgrade().unwrap());
// client B opens 1.txt
let (workspace, cx_b) = client_b.active_workspace(cx_b);
// client B opens 1.txt as a guest
let (workspace_b, cx_b) = client_b.active_workspace(cx_b);
let room_b = cx_b
.read(ActiveCall::global)
.update(cx_b, |call, _| call.room().unwrap().clone());
cx_b.simulate_keystrokes("cmd-p 1 enter");
let editor_b = cx_b.update(|cx| workspace.read(cx).active_item_as::<Editor>(cx).unwrap());
let (project_b, editor_b) = workspace_b.update(cx_b, |workspace, cx| {
(
workspace.project().clone(),
workspace.active_item_as::<Editor>(cx).unwrap(),
)
});
assert!(project_b.read_with(cx_b, |project, _| project.is_read_only()));
assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
assert!(dbg!(
room_b
.update(cx_b, |room, cx| room.share_microphone(cx))
.await
)
.is_err());
// B is promoted
active_call_a
.update(cx_a, |call, cx| {
call.room().unwrap().update(cx, |room, cx| {
@ -108,9 +124,13 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
})
.await
.unwrap();
cx_a.run_until_parked();
// project and buffers are now editable
assert!(project_b.read_with(cx_b, |project, _| !project.is_read_only()));
assert!(!editor_b.update(cx_b, |e, cx| e.read_only(cx)));
assert!(editor_b.update(cx_b, |editor, cx| !editor.read_only(cx)));
room_b
.update(cx_b, |room, cx| room.share_microphone(cx))
.await
.unwrap()
}