2018-11-23 00:19:29 +08:00
|
|
|
// Test: Cleaning a chat message
|
|
|
|
|
2020-01-29 03:25:27 +08:00
|
|
|
const clipboardy = require('clipboardy');
|
2018-11-23 20:55:16 +08:00
|
|
|
const Page = require('../core/page');
|
2018-11-23 00:19:29 +08:00
|
|
|
const e = require('./elements');
|
|
|
|
const util = require('./util');
|
|
|
|
|
|
|
|
class Copy extends Page {
|
2018-11-23 03:15:52 +08:00
|
|
|
constructor() {
|
|
|
|
super('chat-copy');
|
|
|
|
}
|
|
|
|
|
2020-08-14 10:41:14 +08:00
|
|
|
async test(testName) {
|
2018-11-23 00:19:29 +08:00
|
|
|
await util.openChat(this);
|
2020-08-14 10:41:14 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.screenshot(`${testName}`, `01-before-sending-chat-message-[${this.meetingId}]`);
|
2020-08-14 10:41:14 +08:00
|
|
|
}
|
2020-01-29 03:25:27 +08:00
|
|
|
// sending a message
|
|
|
|
await this.type(e.chatBox, e.message);
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.click(e.sendButton, true);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.screenshot(`${testName}`, `02-chat-message-sent-[${this.meetingId}]`);
|
2020-08-05 02:53:34 +08:00
|
|
|
}
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.click(e.chatOptions, true);
|
2020-08-14 10:41:14 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.screenshot(`${testName}`, `03-chat-options-clicked-[${this.meetingId}]`);
|
2020-08-14 10:41:14 +08:00
|
|
|
}
|
2020-01-29 03:25:27 +08:00
|
|
|
await this.click(e.chatCopy, true);
|
2018-11-23 00:19:29 +08:00
|
|
|
|
2020-08-14 10:41:14 +08:00
|
|
|
// enable access to browser context clipboard
|
|
|
|
const context = await this.browser.defaultBrowserContext();
|
|
|
|
await context.overridePermissions(process.env.BBB_SERVER_URL, ['clipboard-read']);
|
|
|
|
const copiedText = await this.page.evaluate(async () => await navigator.clipboard.readText());
|
|
|
|
return copiedText.includes(`User1 : ${e.message}`);
|
2018-11-23 00:19:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Copy;
|