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

48 lines
1.3 KiB
JavaScript
Raw Normal View History

// Test: Cleaning a chat message
2018-11-23 20:55:16 +08:00
const Page = require('../core/page');
const e = require('./elements');
const util = require('./util');
2021-08-21 04:33:57 +08:00
const { checkElementLengthEqualTo } = require('../core/util');
const { ELEMENT_WAIT_TIME } = require('../core/constants');
class Clear extends Page {
constructor() {
super('chat-clear');
}
async test(testName) {
try {
await util.openChat(this);
await this.screenshot(`${testName}`, `01-before-chat-message-send-[${this.meetingId}]`);
// sending a message
await this.type(e.chatBox, e.message);
await this.click(e.sendButton, true);
await this.screenshot(`${testName}`, `02-after-chat-message-send-[${this.meetingId}]`);
2021-08-21 04:33:57 +08:00
const chat0 = await this.page.evaluate(checkElementLengthEqualTo, e.chatClearMessageText, 0);
// clear
await this.click(e.chatOptions, true);
await this.screenshot(`${testName}`, `03-chat-options-clicked-[${this.meetingId}]`);
await this.click(e.chatClear, true);
await this.screenshot(`${testName}`, `04-chat-cleared-[${this.meetingId}]`);
const chatResp = await this.waitForSelector(e.chatClearMessageText, ELEMENT_WAIT_TIME).then(() => true);
return chat0 && chatResp;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
}
module.exports = exports = Clear;