2021-11-18 04:07:14 +08:00
|
|
|
const e = require('../core/elements');
|
2021-11-03 00:45:52 +08:00
|
|
|
|
|
|
|
async function setStatus(page, status) {
|
2022-03-02 04:11:45 +08:00
|
|
|
await page.waitAndClick(e.currentUser);
|
2021-12-04 05:44:55 +08:00
|
|
|
await page.waitAndClick(e.setStatus);
|
|
|
|
await page.waitAndClick(status);
|
2021-11-03 00:45:52 +08:00
|
|
|
}
|
|
|
|
|
2022-01-29 03:52:22 +08:00
|
|
|
async function openLockViewers(test) {
|
|
|
|
await test.waitAndClick(e.manageUsers);
|
|
|
|
await test.waitAndClick(e.lockViewersButton);
|
|
|
|
}
|
|
|
|
|
2022-02-04 04:10:26 +08:00
|
|
|
async function setGuestPolicyOption(test, option) {
|
|
|
|
await test.waitAndClick(e.manageUsers);
|
|
|
|
await test.waitAndClick(e.guestPolicyLabel);
|
|
|
|
await test.waitAndClick(option);
|
|
|
|
}
|
|
|
|
|
2022-02-08 02:01:47 +08:00
|
|
|
async function checkAvatarIcon(test, checkModIcon = true) {
|
2022-03-02 04:11:45 +08:00
|
|
|
await test.hasElement(`${e.currentUser} ${checkModIcon ? e.moderatorAvatar : e.viewerAvatar}`);
|
2022-02-08 02:01:47 +08:00
|
|
|
}
|
|
|
|
|
2022-03-02 04:11:45 +08:00
|
|
|
async function checkIsPresenter(test) {
|
|
|
|
return test.page.evaluate(([currentAvatarSelector, userAvatarSelector]) => {
|
|
|
|
return document.querySelectorAll(`${currentAvatarSelector} ${userAvatarSelector}`)[0].hasAttribute('data-test-presenter')
|
|
|
|
}, [e.currentUser, e.userAvatar])
|
2022-02-08 02:45:42 +08:00
|
|
|
}
|
|
|
|
|
2022-12-08 02:53:56 +08:00
|
|
|
async function checkMutedUsers(test) {
|
|
|
|
await test.wasRemoved(e.muteMicButton);
|
|
|
|
await test.hasElement(e.unmuteMicButton);
|
|
|
|
}
|
|
|
|
|
2023-07-03 21:01:05 +08:00
|
|
|
async function drawArrow(test) {
|
|
|
|
const modWbLocator = test.getLocator(e.whiteboard);
|
|
|
|
const wbBox = await modWbLocator.boundingBox();
|
|
|
|
|
|
|
|
await test.waitAndClick(e.wbArrowShape);
|
|
|
|
|
|
|
|
await test.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
|
|
|
|
await test.page.mouse.down();
|
|
|
|
await test.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
|
|
|
|
await test.page.mouse.up();
|
|
|
|
}
|
|
|
|
|
2023-10-26 04:29:52 +08:00
|
|
|
async function timeInSeconds(locator) {
|
|
|
|
const text = await locator.innerText();
|
|
|
|
const [hours, minutes, seconds] = text.split(':').map(Number);
|
|
|
|
const timeInSeconds = hours * 3600 + minutes * 60 + seconds;
|
|
|
|
return timeInSeconds;
|
|
|
|
}
|
|
|
|
|
2021-12-04 01:01:36 +08:00
|
|
|
exports.setStatus = setStatus;
|
2022-01-29 03:52:22 +08:00
|
|
|
exports.openLockViewers = openLockViewers;
|
2022-02-04 04:10:26 +08:00
|
|
|
exports.setGuestPolicyOption = setGuestPolicyOption;
|
2022-02-08 02:01:47 +08:00
|
|
|
exports.checkAvatarIcon = checkAvatarIcon;
|
2022-03-02 04:11:45 +08:00
|
|
|
exports.checkIsPresenter = checkIsPresenter;
|
2023-04-04 04:21:24 +08:00
|
|
|
exports.checkMutedUsers = checkMutedUsers;
|
2023-07-03 21:01:05 +08:00
|
|
|
exports.drawArrow = drawArrow;
|
2023-10-26 04:29:52 +08:00
|
|
|
exports.timeInSeconds = timeInSeconds;
|