bigbluebutton-Github/bigbluebutton-tests/playwright/chat/util.js
Anton Barboza de Sá d30b806b47
test: Fix no-flaky tests and properly set the execution mode (#19436)
* test: fix shortcuts, add flaky flag for test requiring graphql data, fix slide change for tldraw v2

* test: properly set the execution mode

* test: use isMultiUser parameter inside options obj

* test: fix banner color test

* test: increase breakout test timeouts for user joining room

* test: redo the change in the hide presentation on join test

* test: change hide presentation steps and add flaky flag on it
2024-01-19 13:42:01 -03:00

42 lines
1.2 KiB
JavaScript

const { expect } = require('@playwright/test');
const e = require('../core/elements');
const { getSettings } = require('../core/settings');
async function openPublicChat(testPage) {
const { chatEnabled } = getSettings();
if(!chatEnabled) {
return testPage.wasRemoved(e.chatButton);
}
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');
}
}
async function openPrivateChat(testPage) {
const { chatEnabled } = getSettings();
await testPage.waitAndClick(e.userListItem);
if(!chatEnabled) {
return await testPage.wasRemoved(e.startPrivateChat);
}
await testPage.waitAndClick(e.startPrivateChat);
}
async function checkLastMessageSent(testPage, expectedMessage) {
const lastMessageSent = await testPage.getLocator(e.chatUserMessageText).last();
await expect(lastMessageSent).toHaveText(expectedMessage);
}
exports.openPublicChat = openPublicChat;
exports.openPrivateChat = openPrivateChat;
exports.checkLastMessageSent = checkLastMessageSent;