Skip to content

Fuyan/fix media access test #5573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Hard mute",
"comment": "test",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Hard mute",
"comment": "Fix media access hermetic test",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Hard mute",
"comment": "test",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Hard mute",
"comment": "Fix media access hermetic test",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test.describe('Media access mic/camera forbid/permit tests', async () => {
const initialState = defaultMockCallAdapterState(participants, 'Presenter', false, undefined, true);

await page.goto(buildUrlWithMockAdapter(serverUrl, initialState, { newControlBarExperience: 'true' }));
await page.pause();
if (isTestProfileMobile(testInfo)) {
await waitForSelector(page, dataUiId(IDS.microphoneButton));
await waitForSelector(page, dataUiId(IDS.cameraButton));
Expand All @@ -40,18 +39,12 @@ test.describe('Media access mic/camera forbid/permit tests', async () => {
}, testInfo) => {
const Paul = defaultMockRemoteParticipant('Paul Blurt');
const participants = [Paul];
const initialState = defaultMockCallAdapterState(participants, 'Attendee');
if (initialState.call?.capabilitiesFeature?.capabilities) {
initialState.call.capabilitiesFeature.capabilities.unmuteMic.isPresent = false;
initialState.call.capabilitiesFeature.capabilities.unmuteMic.reason = 'MeetingRestricted';
initialState.call.capabilitiesFeature.capabilities.turnVideoOn.isPresent = false;
initialState.call.capabilitiesFeature.capabilities.turnVideoOn.reason = 'MeetingRestricted';
initialState.call.state = 'Connected';
const initialState = defaultMockCallAdapterState(participants, 'Attendee', false, undefined, undefined, true);
if (initialState.call) {
initialState.call.isMuted = true;
}

await page.goto(buildUrlWithMockAdapter(serverUrl, initialState, { newControlBarExperience: 'true' }));
await page.pause();
if (isTestProfileMobile(testInfo)) {
await waitForSelector(page, dataUiId(IDS.microphoneButton));
await waitForSelector(page, dataUiId(IDS.cameraButton));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
import type { CallKind, DominantSpeakersInfo, ParticipantRole } from '@azure/communication-calling';
import type { ParticipantCapabilities } from '@azure/communication-calling';
import { CallState, CapabilitiesFeatureState } from '@internal/calling-stateful-client';
import { v4 as uuidv4 } from 'uuid';

const SERVER_URL = 'http://localhost';
const APP_DIR = path.join(__dirname, '../../../app/call');
Expand Down Expand Up @@ -56,7 +57,8 @@ export function defaultMockCallAdapterState(
role?: ParticipantRole,
isRoomsCall?: boolean,
callEndReasonSubCode?: number,
isReactionCapability?: boolean
isReactionCapability?: boolean,
isAttendeeHardmuted?: boolean
): MockCallAdapterState {
const remoteParticipants: Record<string, MockRemoteParticipantState> = {};
participants?.forEach((p) => {
Expand All @@ -72,7 +74,7 @@ export function defaultMockCallAdapterState(
isLocalPreviewMicrophoneEnabled: true,
page: callEndReasonSubCode ? 'leftCall' : 'call',
call: {
id: 'call1',
id: `callId-${uuidv4()}`,

kind: 'Call' as CallKind,
callerInfo: { displayName: 'caller', identifier: { kind: 'communicationUser', communicationUserId: '1' } },
Expand Down Expand Up @@ -116,7 +118,7 @@ export function defaultMockCallAdapterState(
maxRemoteVideoStreams: 4
},

capabilitiesFeature: getCapabilitiesFromRole(role, isReactionCapability)
capabilitiesFeature: getCapabilitiesFromRole(role, isReactionCapability, isAttendeeHardmuted)
},
endedCall: callEndReasonSubCode
? {
Expand Down Expand Up @@ -318,7 +320,8 @@ export const stubLocalCameraName = async (page: Page): Promise<void> => {

const getCapabilitiesFromRole = (
role?: ParticipantRole,
isReactionCapability?: boolean
isReactionCapability?: boolean,
isAttendeeHardmuted?: boolean
): CapabilitiesFeatureState | undefined => {
if (isReactionCapability) {
return {
Expand All @@ -327,6 +330,13 @@ const getCapabilitiesFromRole = (
};
}

if (isAttendeeHardmuted) {
return {
capabilities: attendeeCapabilitiesInTeamsCallHardmuted,
latestCapabilitiesChangeInfo: { oldValue: {}, newValue: {}, reason: 'RoleChanged' }
};
}

switch (role) {
case 'Attendee':
return {
Expand Down Expand Up @@ -556,6 +566,58 @@ const presenterCapabilitiesInTeamsCall: ParticipantCapabilities = {
}
};

const attendeeCapabilitiesInTeamsCallHardmuted: ParticipantCapabilities = {
unmuteMic: { isPresent: false, reason: 'MeetingRestricted' },
turnVideoOn: { isPresent: false, reason: 'MeetingRestricted' },
addCommunicationUser: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
addPhoneNumber: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
addTeamsUser: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
blurBackground: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
hangUpForEveryOne: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
manageLobby: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
pstnDialOut: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
raiseHand: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
removeParticipant: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
removeParticipantsSpotlight: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
shareScreen: { isPresent: false, reason: 'RoleRestricted' },
spotlightParticipant: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
startLiveCallingCaptions: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
startLiveMeetingCaptions: {
isPresent: false,
reason: 'CapabilityNotApplicableForTheCallType'
},
muteOthers: {
isPresent: false,
reason: 'CapabilityNotApplicableForTheCallType'
},
useReactions: {
isPresent: true,
reason: 'Capable'
},
viewAttendeeNames: {
isPresent: true,
reason: 'Capable'
},
setCaptionLanguage: {
isPresent: false,
reason: 'CapabilityNotApplicableForTheCallType'
},
/* @conditional-compile-remove(calling-beta-sdk) */
startTogetherMode: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
/* @conditional-compile-remove(breakout-rooms) */
joinBreakoutRooms: { isPresent: false, reason: 'CapabilityNotApplicableForTheCallType' },
/* @conditional-compile-remove(media-access) */
forbidOthersAudio: {
isPresent: false,
reason: 'CapabilityNotApplicableForTheCallType'
},
/* @conditional-compile-remove(media-access) */
forbidOthersVideo: {
isPresent: false,
reason: 'CapabilityNotApplicableForTheCallType'
}
};

const defaultEndedCallState: CallState = {
id: 'call0',

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.