e2e-test: remove admin authentication from tests and update room config function
This commit is contained in:
parent
0cab67eb65
commit
f7a53403eb
@ -1,6 +1,4 @@
|
|||||||
export const RUN_MODE = process.env['RUN_MODE'] || 'development';
|
export const RUN_MODE = process.env['RUN_MODE'] || 'development';
|
||||||
export const MEET_API_URL = process.env['MEET_API_URL'] || 'http://localhost:6080';
|
export const MEET_API_URL = process.env['MEET_API_URL'] || 'http://localhost:6080';
|
||||||
export const MEET_API_KEY = process.env['MEET_API_KEY'] || 'meet-api-key';
|
export const MEET_API_KEY = process.env['MEET_API_KEY'] || 'meet-api-key';
|
||||||
export const MEET_ADMIN_USER = process.env['MEET_ADMIN_USER'] || 'admin';
|
|
||||||
export const MEET_ADMIN_PASSWORD = process.env['MEET_ADMIN_PASSWORD'] || 'admin';
|
|
||||||
export const MEET_TESTAPP_URL = process.env['MEET_TESTAPP_URL'] || 'http://localhost:5080';
|
export const MEET_TESTAPP_URL = process.env['MEET_TESTAPP_URL'] || 'http://localhost:5080';
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import {
|
|||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
joinRoomAs,
|
joinRoomAs,
|
||||||
leaveRoom,
|
leaveRoom,
|
||||||
loginAsAdmin,
|
|
||||||
prepareForJoiningRoom,
|
prepareForJoiningRoom,
|
||||||
startStopRecording,
|
startStopRecording,
|
||||||
updateRoomConfig,
|
updateRoomConfig,
|
||||||
@ -22,12 +21,8 @@ let recordingCreated = false;
|
|||||||
test.describe('Recording Access Tests', () => {
|
test.describe('Recording Access Tests', () => {
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
let participantName: string;
|
let participantName: string;
|
||||||
let adminCookie: string;
|
|
||||||
|
|
||||||
test.beforeAll(async () => {
|
test.beforeAll(async () => {
|
||||||
// Login as admin to get authentication cookie
|
|
||||||
adminCookie = await loginAsAdmin();
|
|
||||||
|
|
||||||
// Create a test room before all tests
|
// Create a test room before all tests
|
||||||
roomId = await createTestRoom('test-room');
|
roomId = await createTestRoom('test-room');
|
||||||
});
|
});
|
||||||
@ -72,18 +67,14 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should moderator not be able to access recording when access level is set to admin', async ({ page }) => {
|
test('should moderator not be able to access recording when access level is set to admin', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -93,18 +84,14 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should speaker not be able to access recording when access level is set to admin', async ({ page }) => {
|
test('should speaker not be able to access recording when access level is set to admin', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -114,18 +101,14 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should allow moderator to access recording when access level is set to moderator', async ({ page }) => {
|
test('should allow moderator to access recording when access level is set to moderator', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -135,18 +118,14 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should speaker not be able to access recording when access level is set to moderator', async ({ page }) => {
|
test('should speaker not be able to access recording when access level is set to moderator', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -156,18 +135,14 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should allow moderator to access recording when access level is set to speaker', async ({ page }) => {
|
test('should allow moderator to access recording when access level is set to speaker', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -177,18 +152,14 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should allow speaker to access recording when access level is set to speaker', async ({ page }) => {
|
test('should allow speaker to access recording when access level is set to speaker', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
isVirtualBackgroundApplied,
|
isVirtualBackgroundApplied,
|
||||||
joinRoomAs,
|
joinRoomAs,
|
||||||
leaveRoom,
|
leaveRoom,
|
||||||
loginAsAdmin,
|
|
||||||
openMoreOptionsMenu,
|
openMoreOptionsMenu,
|
||||||
prepareForJoiningRoom,
|
prepareForJoiningRoom,
|
||||||
updateRoomConfig,
|
updateRoomConfig,
|
||||||
@ -24,16 +23,12 @@ let subscribedToAppErrors = false;
|
|||||||
test.describe('UI Feature Config Tests', () => {
|
test.describe('UI Feature Config Tests', () => {
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
let participantName: string;
|
let participantName: string;
|
||||||
let adminCookie: string;
|
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// SETUP & TEARDOWN
|
// SETUP & TEARDOWN
|
||||||
// ==========================================
|
// ==========================================
|
||||||
|
|
||||||
test.beforeAll(async () => {
|
test.beforeAll(async () => {
|
||||||
// Login as admin to get authentication cookie
|
|
||||||
adminCookie = await loginAsAdmin();
|
|
||||||
|
|
||||||
// Create a test room before all tests
|
// Create a test room before all tests
|
||||||
roomId = await createTestRoom('test-room');
|
roomId = await createTestRoom('test-room');
|
||||||
});
|
});
|
||||||
@ -73,18 +68,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should show chat button when chat is enabled', async ({ page }) => {
|
test('should show chat button when chat is enabled', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -97,18 +88,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
|
|
||||||
test('should hide chat button when chat is disabled', async ({ page }) => {
|
test('should hide chat button when chat is disabled', async ({ page }) => {
|
||||||
// Disable chat via API
|
// Disable chat via API
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: false },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: false },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -126,18 +113,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
|
|
||||||
test.describe('Recording Feature', () => {
|
test.describe('Recording Feature', () => {
|
||||||
test('should show recording button for moderators', async ({ page }) => {
|
test('should show recording button for moderators', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -160,18 +143,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should not show recording button for speaker', async ({ page }) => {
|
test('should not show recording button for speaker', async ({ page }) => {
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -185,18 +164,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
|
|
||||||
test('should not show recording button for moderators when recording is disabled', async ({ page }) => {
|
test('should not show recording button for moderators when recording is disabled', async ({ page }) => {
|
||||||
// Disable recording via API
|
// Disable recording via API
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: false,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: false,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -226,18 +201,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
});
|
});
|
||||||
test('should show virtual background button when enabled', async ({ page }) => {
|
test('should show virtual background button when enabled', async ({ page }) => {
|
||||||
// Ensure virtual backgrounds are enabled
|
// Ensure virtual backgrounds are enabled
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -255,18 +226,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
|
|
||||||
test('should hide virtual background button when disabled', async ({ page }) => {
|
test('should hide virtual background button when disabled', async ({ page }) => {
|
||||||
// Disable virtual backgrounds via API
|
// Disable virtual backgrounds via API
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: false }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: false }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -284,18 +251,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
page
|
page
|
||||||
}) => {
|
}) => {
|
||||||
// Ensure virtual backgrounds are enabled
|
// Ensure virtual backgrounds are enabled
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: true }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: true }
|
||||||
);
|
});
|
||||||
|
|
||||||
await page.goto(MEET_TESTAPP_URL);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, roomId);
|
||||||
@ -305,18 +268,14 @@ test.describe('UI Feature Config Tests', () => {
|
|||||||
await waitForVirtualBackgroundToApply(page);
|
await waitForVirtualBackgroundToApply(page);
|
||||||
|
|
||||||
// Now disable virtual backgrounds
|
// Now disable virtual backgrounds
|
||||||
await updateRoomConfig(
|
await updateRoomConfig(roomId, {
|
||||||
roomId,
|
chat: { enabled: true },
|
||||||
{
|
recording: {
|
||||||
chat: { enabled: true },
|
enabled: true,
|
||||||
recording: {
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
||||||
enabled: true,
|
|
||||||
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER
|
|
||||||
},
|
|
||||||
virtualBackground: { enabled: false }
|
|
||||||
},
|
},
|
||||||
adminCookie
|
virtualBackground: { enabled: false }
|
||||||
);
|
});
|
||||||
|
|
||||||
await leaveRoom(page);
|
await leaveRoom(page);
|
||||||
await page.reload();
|
await page.reload();
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { expect, FrameLocator, Locator, Page } from '@playwright/test';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { PNG } from 'pngjs';
|
import { PNG } from 'pngjs';
|
||||||
import { MeetRecordingAccess, MeetRoomConfig } from '../../../../typings/src/room-config';
|
import { MeetRecordingAccess, MeetRoomConfig } from '../../../../typings/src/room-config';
|
||||||
import { MEET_ADMIN_PASSWORD, MEET_ADMIN_USER, MEET_API_KEY, MEET_API_URL, MEET_TESTAPP_URL } from '../config';
|
import { MEET_API_KEY, MEET_API_URL, MEET_TESTAPP_URL } from '../config';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a FrameLocator for an iframe inside a Shadow DOM
|
* Gets a FrameLocator for an iframe inside a Shadow DOM
|
||||||
@ -124,12 +124,12 @@ export const createTestRoom = async (roomName: string, config: MeetRoomConfig =
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to update room config via REST API
|
// Helper function to update room config via REST API
|
||||||
export const updateRoomConfig = async (roomId: string, config: any, adminCookie: string) => {
|
export const updateRoomConfig = async (roomId: string, config: any) => {
|
||||||
const response = await fetch(`${MEET_API_URL}/api/v1/rooms/${roomId}/config`, {
|
const response = await fetch(`${MEET_API_URL}/api/v1/rooms/${roomId}/config`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Cookie: adminCookie
|
'x-api-key': MEET_API_KEY
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ config })
|
body: JSON.stringify({ config })
|
||||||
});
|
});
|
||||||
@ -141,38 +141,6 @@ export const updateRoomConfig = async (roomId: string, config: any, adminCookie:
|
|||||||
return response.json();
|
return response.json();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to login and get admin cookie
|
|
||||||
export const loginAsAdmin = async (): Promise<string> => {
|
|
||||||
const response = await fetch(`${MEET_API_URL}/internal-api/v1/auth/login`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
username: MEET_ADMIN_USER,
|
|
||||||
password: MEET_ADMIN_PASSWORD
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok || response.status !== 200) {
|
|
||||||
console.error('Login failed:', await response.text());
|
|
||||||
throw new Error(`Failed to login: ${response.status}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cookies = response.headers.get('set-cookie') || '';
|
|
||||||
if (!cookies) {
|
|
||||||
throw new Error('No cookies received from login');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract the access token cookie
|
|
||||||
const accessTokenCookie = cookies.split(';').find((cookie) => cookie.trim().startsWith('OvMeetAccessToken='));
|
|
||||||
if (!accessTokenCookie) {
|
|
||||||
throw new Error('Access token cookie not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
return accessTokenCookie.trim();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper function to delete a room
|
// Helper function to delete a room
|
||||||
export const deleteTestRoom = async (roomId: string) => {
|
export const deleteTestRoom = async (roomId: string) => {
|
||||||
await fetch(`${MEET_API_URL}/api/v1/rooms/${roomId}`, {
|
await fetch(`${MEET_API_URL}/api/v1/rooms/${roomId}`, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user