Skip to content

Commit

Permalink
Merge pull request #16465 from gabriellpr/rm-user
Browse files Browse the repository at this point in the history
test: Remove user
  • Loading branch information
antobinary committed Jan 23, 2023
2 parents 9564436 + cbcc4ca commit 58187c6
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 3 deletions.
Expand Up @@ -524,12 +524,14 @@ class UserListItem extends PureComponent {
checkboxMessageId="app.userlist.menu.removeConfirmation.desc"
confirmParam={user.userId}
onConfirm={removeUser}
confirmButtonDataTest="removeUserConfirmation"
/>,
));

this.handleClose();
},
icon: 'circle_close',
dataTest: 'removeUser'
},
{
allowed: allowedToEjectCameras
Expand Down
5 changes: 5 additions & 0 deletions bigbluebutton-tests/playwright/core/elements.js
Expand Up @@ -335,6 +335,11 @@ exports.takePresenter = 'li[data-test="takePresenter"]';
exports.muteAll = 'li[data-test="muteAll"]';
exports.muteAllExceptPresenter = 'li[data-test="muteAllExceptPresenter"]';
exports.error403removedLabel = 'You have been removed from the meeting';
exports.removeUser = 'li[data-test="removeUser"]';
exports.removeUserConfirmationBtn = 'button[data-test="removeUserConfirmation"]';
exports.confirmationCheckbox = 'input[id="confirmationCheckbox"]';
exports.userBannedMessage = 'div[id="app"] >> div >> div:nth-child(2)';
exports.meetingEndedModalTitle = 'h1[data-test="meetingEndedModalTitle"]';

// Lock Viewers
exports.lockViewersButton = 'li[data-test="lockViewersButton"]';
Expand Down
1 change: 0 additions & 1 deletion bigbluebutton-tests/playwright/core/page.js
Expand Up @@ -314,7 +314,6 @@ class Page {
await expect(locator).toHaveValue(value);
}


async backgroundColorTest(selector, color) {
await expect(await this.page.$eval(selector, e => getComputedStyle(e).backgroundColor)).toBe(color);
}
Expand Down
58 changes: 56 additions & 2 deletions bigbluebutton-tests/playwright/user/multiusers.js
Expand Up @@ -40,12 +40,11 @@ class MultiUsers {
fullName,
meetingId: (useModMeetingId) ? this.modPage.meetingId : undefined,
};

const page = await context.newPage();
this.modPage2 = new Page(this.browser, page);
await this.modPage2.init(true, shouldCloseAudioModal, options);
}

async initUserPage(shouldCloseAudioModal = true, context = this.context, { fullName = 'Attendee', useModMeetingId = true, ...restOptions } = {}) {
const options = {
...restOptions,
Expand Down Expand Up @@ -287,6 +286,61 @@ class MultiUsers {
await this.modPage.hasText(e.liveCaptions, e.message);
await this.modPage2.hasText(e.liveCaptions, e.message);
}

async removeUser() {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.removeUser);
await this.modPage.waitAndClick(e.removeUserConfirmationBtn);
await this.modPage.wasRemoved(e.userListItem);

//Will be modified when the issue is fixed and accept just one of both screens
//https://github.com/bigbluebutton/bigbluebutton/issues/16463
try {
await this.modPage2.hasElement(e.errorScreenMessage);
} catch (err) {
await this.modPage2.hasElement(e.meetingEndedModalTitle);
}
}

async removeUserAndPreventRejoining(context) {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.removeUser);
await this.modPage.waitAndClick(e.confirmationCheckbox);
await this.modPage.waitAndClick(e.removeUserConfirmationBtn);
await this.modPage.wasRemoved(e.userListItem);

//Will be modified when the issue is fixed and accept just one of both screens
//https://github.com/bigbluebutton/bigbluebutton/issues/16463
try {
await this.modPage2.hasElement(e.errorScreenMessage);
} catch (err) {
await this.modPage2.hasElement(e.meetingEndedModalTitle);
}

await this.initModPage2(false, context, {meetingId: this.modPage.meetingId, customParameter: 'userID=Moderator2'})
await this.modPage2.hasText(e.userBannedMessage, /banned/);
}

async writeClosedCaptions() {
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage2.waitForSelector(e.whiteboard);

await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.writeClosedCaptions);
await this.modPage.waitAndClick(e.startWritingClosedCaptions);

await this.modPage.waitAndClick(e.startViewingClosedCaptionsBtn);
await this.modPage2.waitAndClick(e.startViewingClosedCaptionsBtn);

await this.modPage.waitAndClick(e.startViewingClosedCaptions);
await this.modPage2.waitAndClick(e.startViewingClosedCaptions);

const notesLocator = getNotesLocator(this.modPage);
await notesLocator.type(e.message);

await this.modPage.hasText(e.liveCaptions, e.message);
await this.modPage2.hasText(e.liveCaptions, e.message);
}
}

exports.MultiUsers = MultiUsers;
14 changes: 14 additions & 0 deletions bigbluebutton-tests/playwright/user/user.spec.js
Expand Up @@ -71,6 +71,20 @@ test.describe.parallel('User', () => {
await multiusers.initModPage2();
await multiusers.giveAndRemoveWhiteboardAccess();
});

test('Remove user', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
await multiusers.initModPage2(true);
await multiusers.removeUser();
});

test('Remove user and prevent rejoining', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
await multiusers.initModPage2(true, context, { customParameter: 'userID=Moderator2'});
await multiusers.removeUserAndPreventRejoining(context);
});
});

test.describe.parallel('Manage', () => {
Expand Down

0 comments on commit 58187c6

Please sign in to comment.