bigbluebutton-Github/bigbluebutton-tests/puppeteer/chat/send.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-11-23 20:55:16 +08:00
const Page = require('../core/page');
const e = require('../core/elements');
const util = require('./util');
2021-08-21 04:33:57 +08:00
const { checkElementLengthEqualTo } = require('../core/util');
class Send extends Page {
constructor() {
2021-09-23 03:22:47 +08:00
super();
}
async test(testName) {
try {
await util.openChat(this);
// 0 messages
const chat0 = await this.page.evaluate(checkElementLengthEqualTo, e.chatUserMessageText, 0);
await this.screenshot(`${testName}`, `01-before-chat-message-send-[${this.meetingId}]`);
// send a message
await this.type(e.chatBox, e.message);
await this.screenshot(`${testName}`, `02-typing-chat-message-[${this.meetingId}]`);
await this.waitAndClick(e.sendButton);
await this.screenshot(`${testName}`, `03-after-chat-message-send-[${this.meetingId}]`);
await this.waitForSelector(e.chatUserMessageText);
// 1 message
const chat1 = await this.page.evaluate(checkElementLengthEqualTo, e.chatUserMessageText, 1);
return chat0 === chat1;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
}
module.exports = exports = Send;