/* eslint-disable prefer-destructuring */ /* eslint-disable more/no-then */ /* eslint-disable func-names */ /* eslint-disable import/no-extraneous-dependencies */ const path = require('path'); const { after, before, describe, it } = require('mocha'); const common = require('./common'); const ConversationPage = require('./page-objects/conversation.page'); describe('Message Functions', function() { let app; let app2; this.timeout(60000); this.slow(15000); before(async () => { await common.killallElectron(); await common.stopStubSnodeServer(); [app, app2] = await common.startAppsAsFriends(); }); after(async () => { // await common.stopApp(app); // await common.killallElectron(); // await common.stopStubSnodeServer(); }); it('can send attachment', async () => { await app.client.element(ConversationPage.globeButtonSection).click(); await app.client.element(ConversationPage.createClosedGroupButton).click(); // create group and add new friend await common.addFriendToNewClosedGroup(app, app2); // send attachment from app1 to closed group const fileLocation = path.join(__dirname, '/test_attachment'); const messageText = 'test_attachment'; common.sendMessage(app, messageText, fileLocation); // validate attachment sent await app.client.waitForExist( ConversationPage.existingSendMessageText(messageText), 3000 ); // validate attachment recieved await app2.client.waitForExist( ConversationPage.existingReceivedMessageText(messageText), 5000 ); }); it('can delete message', async () => { const messageText = 'delete me'; common.sendMessage(app, messageText); await app.client.waitForExist( ConversationPage.existingSendMessageText(messageText), 3000 ); await app2.client.waitForExist( ConversationPage.existingReceivedMessageText(messageText), 5000 ); }); });