bigbluebutton-Github/bigbluebutton-tests/playwright/chat/util.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-04-27 20:36:19 +08:00
const { default: test, expect } = require('@playwright/test');
2021-11-18 04:07:14 +08:00
const e = require('../core/elements');
2022-03-29 21:53:07 +08:00
const { getSettings } = require('../core/settings');
async function openPublicChat(testPage) {
2022-03-29 21:53:07 +08:00
const { chatEnabled } = getSettings();
test.fail(!chatEnabled, 'Chat is disabled');
await testPage.waitForSelector(e.chatBox);
await testPage.waitForSelector(e.chatMessages);
try {
await testPage.waitForSelector(e.chatWelcomeMessageText);
} catch {
await testPage.waitAndClick(e.chatMessages);
await testPage.down('Home');
await testPage.waitForSelector(e.chatWelcomeMessageText);
await testPage.down('End');
}
2022-03-29 21:53:07 +08:00
}
async function openPrivateChat(testPage) {
const { chatEnabled } = getSettings();
test.fail(!chatEnabled, 'Chat is disabled');
await testPage.waitAndClick(e.userListItem);
await testPage.waitAndClick(e.startPrivateChat);
}
2023-04-27 20:36:19 +08:00
async function checkLastMessageSent(testPage, expectedMessage) {
const lastMessageSent = await testPage.getLocator(e.chatUserMessageText).last();
await expect(lastMessageSent).toHaveText(expectedMessage);
}
exports.openPublicChat = openPublicChat;
2022-03-29 21:53:07 +08:00
exports.openPrivateChat = openPrivateChat;
2023-04-27 20:36:19 +08:00
exports.checkLastMessageSent = checkLastMessageSent;