aa57d4528b
* first steps * few messages added * added more messages to the failed tests * layouts,notifications * more messages to help * adding messages to the upload other presentations format * messages for upload multiple presentation test * added most of the expect messages * updates for merging * fixed broken tests
42 lines
1.5 KiB
JavaScript
42 lines
1.5 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, 'public chat should not be desplayed');
|
|
}
|
|
|
|
await testPage.hasElement(e.chatBox, 'should display the chat box for messaging');
|
|
await testPage.hasElement(e.chatMessages, 'should display the chat messages');
|
|
try {
|
|
await testPage.hasElement(e.chatWelcomeMessageText, 'should display the chat welcome message');
|
|
} catch {
|
|
await testPage.waitAndClick(e.chatMessages);
|
|
await testPage.down('Home');
|
|
await testPage.hasElement(e.chatWelcomeMessageText, 'should display the chat welcome message');
|
|
await testPage.down('End');
|
|
}
|
|
}
|
|
|
|
async function openPrivateChat(testPage) {
|
|
const { chatEnabled } = getSettings();
|
|
|
|
await testPage.waitAndClick(e.userListItem);
|
|
if(!chatEnabled) {
|
|
return await testPage.wasRemoved(e.startPrivateChat, 'should not display the private chat');
|
|
}
|
|
await testPage.waitAndClick(e.startPrivateChat);
|
|
}
|
|
|
|
async function checkLastMessageSent(testPage, expectedMessage) {
|
|
const lastMessageSent = await testPage.getLocator(e.chatUserMessageText).last();
|
|
await expect(lastMessageSent, 'should display the last message sent on the chat').toHaveText(expectedMessage);
|
|
}
|
|
|
|
exports.openPublicChat = openPublicChat;
|
|
exports.openPrivateChat = openPrivateChat;
|
|
exports.checkLastMessageSent = checkLastMessageSent;
|