e2e-tests: refactor recording access tests to improve context management and streamline access checks
This commit is contained in:
parent
c023fe6521
commit
64d54f7973
@ -1,28 +1,25 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test } from '@playwright/test';
|
||||||
|
import { MeetRecordingAccess } from '../../../../typings/src/room-preferences';
|
||||||
|
import { MEET_TESTAPP_URL } from '../config';
|
||||||
import {
|
import {
|
||||||
closeMoreOptionsMenu,
|
accessRoomAs,
|
||||||
createTestRoom,
|
createTestRoom,
|
||||||
deleteAllRecordings,
|
deleteAllRecordings,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
deleteTestRoom,
|
|
||||||
interactWithElementInIframe,
|
|
||||||
joinRoomAs,
|
joinRoomAs,
|
||||||
leaveRoom,
|
leaveRoom,
|
||||||
loginAsAdmin,
|
loginAsAdmin,
|
||||||
openMoreOptionsMenu,
|
|
||||||
prepareForJoiningRoom,
|
prepareForJoiningRoom,
|
||||||
startStopRecording,
|
startStopRecording,
|
||||||
updateRoomPreferences,
|
updateRoomPreferences,
|
||||||
viewRecordingsAs,
|
viewRecordingsAs,
|
||||||
waitForElementInIframe
|
waitForElementInIframe
|
||||||
} from '../helpers/function-helpers';
|
} from '../helpers/function-helpers';
|
||||||
import { MeetRecordingAccess } from '../../../../typings/src/room-preferences';
|
|
||||||
|
|
||||||
let subscribedToAppErrors = false;
|
let subscribedToAppErrors = false;
|
||||||
let recordingCreated = false;
|
let recordingCreated = false;
|
||||||
|
|
||||||
test.describe('Recording Access Tests', () => {
|
test.describe('Recording Access Tests', () => {
|
||||||
const testAppUrl = 'http://localhost:5080';
|
|
||||||
const testRoomPrefix = 'recording-access-test';
|
const testRoomPrefix = 'recording-access-test';
|
||||||
let participantName: string;
|
let participantName: string;
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
@ -41,7 +38,7 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ browser, page }) => {
|
||||||
if (!subscribedToAppErrors) {
|
if (!subscribedToAppErrors) {
|
||||||
page.on('console', (msg) => {
|
page.on('console', (msg) => {
|
||||||
const type = msg.type();
|
const type = msg.type();
|
||||||
@ -50,17 +47,23 @@ test.describe('Recording Access Tests', () => {
|
|||||||
});
|
});
|
||||||
subscribedToAppErrors = true;
|
subscribedToAppErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
participantName = `P-${Math.random().toString(36).substring(2, 9)}`;
|
participantName = `P-${Math.random().toString(36).substring(2, 9)}`;
|
||||||
|
|
||||||
if (!recordingCreated) {
|
if (!recordingCreated) {
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
const tempContext = await browser.newContext();
|
||||||
await joinRoomAs('moderator', participantName, page);
|
const tempPage = await tempContext.newPage();
|
||||||
|
await prepareForJoiningRoom(tempPage, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
|
await joinRoomAs('moderator', participantName, tempPage);
|
||||||
|
|
||||||
await startStopRecording(page, 'start');
|
await startStopRecording(tempPage, 'start');
|
||||||
|
await tempPage.waitForTimeout(2000);
|
||||||
await page.waitForTimeout(2000);
|
await startStopRecording(tempPage, 'stop');
|
||||||
|
|
||||||
await startStopRecording(page, 'stop');
|
|
||||||
recordingCreated = true;
|
recordingCreated = true;
|
||||||
|
|
||||||
|
await leaveRoom(tempPage, 'moderator');
|
||||||
|
await tempContext.close();
|
||||||
|
await tempPage.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,11 +91,11 @@ test.describe('Recording Access Tests', () => {
|
|||||||
adminCookie
|
adminCookie
|
||||||
);
|
);
|
||||||
|
|
||||||
await page.goto(testAppUrl);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
await viewRecordingsAs('moderator', page);
|
await accessRoomAs('moderator', page);
|
||||||
|
|
||||||
await waitForElementInIframe(page, 'ov-error', { state: 'visible' });
|
await waitForElementInIframe(page, '#view-recordings-btn', { state: 'hidden' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should publisher not be able to access recording when access level is set to admin', async ({ page }) => {
|
test('should publisher not be able to access recording when access level is set to admin', async ({ page }) => {
|
||||||
@ -109,11 +112,11 @@ test.describe('Recording Access Tests', () => {
|
|||||||
adminCookie
|
adminCookie
|
||||||
);
|
);
|
||||||
|
|
||||||
await page.goto(testAppUrl);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
await viewRecordingsAs('publisher', page);
|
await accessRoomAs('publisher', page);
|
||||||
|
|
||||||
await waitForElementInIframe(page, 'ov-error', { state: 'visible' });
|
await waitForElementInIframe(page, '#view-recordings-btn', { state: 'hidden' });
|
||||||
});
|
});
|
||||||
|
|
||||||
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 }) => {
|
||||||
@ -130,13 +133,13 @@ test.describe('Recording Access Tests', () => {
|
|||||||
adminCookie
|
adminCookie
|
||||||
);
|
);
|
||||||
|
|
||||||
await page.goto(testAppUrl);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
await viewRecordingsAs('moderator', page);
|
await viewRecordingsAs('moderator', page);
|
||||||
|
|
||||||
await waitForElementInIframe(page, 'ov-error', { state: 'hidden' });
|
|
||||||
await waitForElementInIframe(page, 'app-room-recordings', { state: 'visible' });
|
await waitForElementInIframe(page, 'app-room-recordings', { state: 'visible' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should publisher not be able to access recording when access level is set to moderator', async ({ page }) => {
|
test('should publisher not be able to access recording when access level is set to moderator', async ({ page }) => {
|
||||||
await updateRoomPreferences(
|
await updateRoomPreferences(
|
||||||
roomId,
|
roomId,
|
||||||
@ -151,10 +154,11 @@ test.describe('Recording Access Tests', () => {
|
|||||||
adminCookie
|
adminCookie
|
||||||
);
|
);
|
||||||
|
|
||||||
await page.goto(testAppUrl);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
await viewRecordingsAs('publisher', page);
|
await accessRoomAs('publisher', page);
|
||||||
await waitForElementInIframe(page, 'ov-error', { state: 'visible' });
|
|
||||||
|
await waitForElementInIframe(page, '#view-recordings-btn', { state: 'hidden' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should allow moderators to access recording when access level is set to publisher', async ({ page }) => {
|
test('should allow moderators to access recording when access level is set to publisher', async ({ page }) => {
|
||||||
@ -171,10 +175,10 @@ test.describe('Recording Access Tests', () => {
|
|||||||
adminCookie
|
adminCookie
|
||||||
);
|
);
|
||||||
|
|
||||||
await page.goto(testAppUrl);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
await viewRecordingsAs('moderator', page);
|
await viewRecordingsAs('moderator', page);
|
||||||
await waitForElementInIframe(page, 'ov-error', { state: 'hidden' });
|
|
||||||
await waitForElementInIframe(page, 'app-room-recordings', { state: 'visible' });
|
await waitForElementInIframe(page, 'app-room-recordings', { state: 'visible' });
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -192,10 +196,10 @@ test.describe('Recording Access Tests', () => {
|
|||||||
adminCookie
|
adminCookie
|
||||||
);
|
);
|
||||||
|
|
||||||
await page.goto(testAppUrl);
|
await page.goto(MEET_TESTAPP_URL);
|
||||||
await prepareForJoiningRoom(page, testAppUrl, testRoomPrefix);
|
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||||
await viewRecordingsAs('publisher', page);
|
await viewRecordingsAs('publisher', page);
|
||||||
await waitForElementInIframe(page, 'ov-error', { state: 'hidden' });
|
|
||||||
await waitForElementInIframe(page, 'app-room-recordings', { state: 'visible' });
|
await waitForElementInIframe(page, 'app-room-recordings', { state: 'visible' });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user