emoji copy test

This commit is contained in:
Gabriel Porfirio 2022-09-16 11:22:05 -03:00
parent 554f3d11da
commit 3ff6a52269
2 changed files with 14 additions and 2 deletions

View File

@ -54,8 +54,7 @@ class Chat extends Page {
await this.waitForSelector(e.chatUserMessageText);
await this.waitAndClick(e.chatCopy);
// enable access to browser context clipboard
await context.grantPermissions(['clipboard-write', 'clipboard-read'], { origin: process.env.BBB_URL });
const copiedText = await this.page.evaluate(async () => navigator.clipboard.readText());
const copiedText = await this.getCopiedText(context);
const check = copiedText.includes(`${p.fullName}: ${e.message}`);
expect(check).toBeTruthy();
}
@ -134,6 +133,10 @@ class Chat extends Page {
await this.waitForSelector(e.chatUserMessageText);
await this.waitAndClick(e.chatCopy);
const copiedText = await this.getCopiedText(context);
const check = copiedText.includes(`${p.fullName}: ${e.emojiSent}`);
expect(check).toBeTruthy();
}
async emojiSaveChat(testInfo) {
@ -182,6 +185,10 @@ class Chat extends Page {
await this.waitForSelector(e.chatUserMessageText);
await this.waitAndClick(e.chatCopy);
const copiedText = await this.getCopiedText(context);
const check = copiedText.includes(`${p.fullName}: ${e.autoConvertEmojiMessage}`);
expect(check).toBeTruthy();
}
async autoConvertEmojiSaveChat(testInfo) {

View File

@ -107,6 +107,11 @@ class Page {
return locator.count();
}
async getCopiedText(context) {
await context.grantPermissions(['clipboard-write', 'clipboard-read'], { origin: process.env.BBB_URL});
return this.page.evaluate(async () => navigator.clipboard.readText());
}
async closeAudioModal() {
await this.waitForSelector(e.audioModal, ELEMENT_WAIT_LONGER_TIME);
await this.waitAndClick(e.closeModal);