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

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-11-23 20:55:16 +08:00
const Page = require('../core/page');
const e = require('../core/elements');
2021-10-01 02:36:31 +08:00
const p = require('../core/params');
const util = require('./util');
class Copy extends Page {
constructor() {
2021-09-23 03:22:47 +08:00
super();
}
async test(testName) {
try {
await util.openChat(this);
await this.screenshot(`${testName}`, `01-before-sending-chat-message-[${this.meetingId}]`);
// sending a message
await this.type(e.chatBox, e.message);
await this.waitAndClick(e.sendButton);
await this.screenshot(`${testName}`, `02-chat-message-sent-[${this.meetingId}]`);
await this.waitAndClick(e.chatOptions);
await this.screenshot(`${testName}`, `03-chat-options-clicked-[${this.meetingId}]`);
await this.waitForSelector(e.chatUserMessageText);
await this.waitAndClick(e.chatCopy);
// enable access to browser context clipboard
const context = await this.browser.defaultBrowserContext();
await context.overridePermissions(process.env.BBB_SERVER_URL, ['clipboard-read']);
2021-10-01 02:45:59 +08:00
const copiedText = await this.page.evaluate(async () => navigator.clipboard.readText());
return copiedText.includes(`${p.fullName}: ${e.message}`);
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
}
module.exports = exports = Copy;