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');
|
|
|
|
}
|
|
|
|
|
2018-11-23 00:19:29 +08:00
|
|
|
async test() {
|
|
|
|
await util.openChat(this);
|
|
|
|
|
2020-01-29 03:25:27 +08:00
|
|
|
// sending a message
|
|
|
|
await this.type(e.chatBox, e.message);
|
|
|
|
await this.click(e.sendButton);
|
2018-11-23 03:15:52 +08:00
|
|
|
await this.screenshot(true);
|
2018-11-23 00:19:29 +08:00
|
|
|
|
2020-01-29 03:25:27 +08:00
|
|
|
await this.click(e.chatOptions);
|
|
|
|
await this.click(e.chatCopy, true);
|
2018-11-23 00:19:29 +08:00
|
|
|
|
2020-01-29 03:25:27 +08:00
|
|
|
const copiedChat = clipboardy.readSync();
|
|
|
|
expect(copiedChat).toEqual(expect.stringContaining(`User1 : ${e.message}`));
|
2018-11-23 00:19:29 +08:00
|
|
|
|
2020-01-29 03:25:27 +08:00
|
|
|
return true;
|
2018-11-23 00:19:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Copy;
|