mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
attachment sending test complete
This commit is contained in:
parent
819d0c10e1
commit
d3c934e119
|
@ -27,79 +27,8 @@ describe('Closed groups', function() {
|
|||
await app.client.element(ConversationPage.globeButtonSection).click();
|
||||
await app.client.element(ConversationPage.createClosedGroupButton).click();
|
||||
|
||||
// fill the groupname
|
||||
await app.client
|
||||
.element(ConversationPage.closedGroupNameTextarea)
|
||||
.setValue(common.VALID_CLOSED_GROUP_NAME1);
|
||||
await app.client
|
||||
.element(ConversationPage.closedGroupNameTextarea)
|
||||
.getValue()
|
||||
.should.eventually.equal(common.VALID_CLOSED_GROUP_NAME1);
|
||||
|
||||
await app.client
|
||||
.element(ConversationPage.createClosedGroupMemberItem)
|
||||
.isVisible();
|
||||
|
||||
// select the first friend as a member of the groups being created
|
||||
await app.client
|
||||
.element(ConversationPage.createClosedGroupMemberItem)
|
||||
.click();
|
||||
await app.client
|
||||
.element(ConversationPage.createClosedGroupMemberItemSelected)
|
||||
.isVisible();
|
||||
|
||||
// trigger the creation of the group
|
||||
await app.client
|
||||
.element(ConversationPage.validateCreationClosedGroupButton)
|
||||
.click();
|
||||
|
||||
await app.client.waitForExist(
|
||||
ConversationPage.sessionToastGroupCreatedSuccess,
|
||||
1000
|
||||
);
|
||||
await app.client.isExisting(
|
||||
ConversationPage.headerTitleGroupName(common.VALID_CLOSED_GROUP_NAME1)
|
||||
);
|
||||
await app.client
|
||||
.element(ConversationPage.headerTitleMembers(2))
|
||||
.isVisible();
|
||||
|
||||
// validate overlay is closed
|
||||
await app.client
|
||||
.isExisting(ConversationPage.leftPaneOverlay)
|
||||
.should.eventually.be.equal(false);
|
||||
|
||||
// move back to the conversation section
|
||||
await app.client
|
||||
.element(ConversationPage.conversationButtonSection)
|
||||
.click();
|
||||
|
||||
// validate open chat has been added
|
||||
await app.client.isExisting(
|
||||
ConversationPage.rowOpenGroupConversationName(
|
||||
common.VALID_CLOSED_GROUP_NAME1
|
||||
)
|
||||
);
|
||||
|
||||
// next check app2 has been invited and has the group in its conversations
|
||||
await app2.client.waitForExist(
|
||||
ConversationPage.rowOpenGroupConversationName(
|
||||
common.VALID_CLOSED_GROUP_NAME1
|
||||
),
|
||||
6000
|
||||
);
|
||||
// open the closed group conversation on app2
|
||||
await app2.client
|
||||
.element(ConversationPage.conversationButtonSection)
|
||||
.click();
|
||||
await common.timeout(500);
|
||||
await app2.client
|
||||
.element(
|
||||
ConversationPage.rowOpenGroupConversationName(
|
||||
common.VALID_CLOSED_GROUP_NAME1
|
||||
)
|
||||
)
|
||||
.click();
|
||||
// create group and add new friend
|
||||
await common.addFriendToNewClosedGroup(app, app2);
|
||||
|
||||
// send a message from app and validate it is received on app2
|
||||
const textMessage = common.generateSendMessageText();
|
||||
|
|
|
@ -269,6 +269,81 @@ module.exports = {
|
|||
return [app1, app2];
|
||||
},
|
||||
|
||||
async addFriendToNewClosedGroup(app, app2) {
|
||||
await app.client
|
||||
.element(ConversationPage.closedGroupNameTextarea)
|
||||
.setValue(this.VALID_CLOSED_GROUP_NAME1);
|
||||
await app.client
|
||||
.element(ConversationPage.closedGroupNameTextarea)
|
||||
.getValue()
|
||||
.should.eventually.equal(this.VALID_CLOSED_GROUP_NAME1);
|
||||
|
||||
await app.client
|
||||
.element(ConversationPage.createClosedGroupMemberItem)
|
||||
.isVisible();
|
||||
|
||||
// select the first friend as a member of the groups being created
|
||||
await app.client
|
||||
.element(ConversationPage.createClosedGroupMemberItem)
|
||||
.click();
|
||||
await app.client
|
||||
.element(ConversationPage.createClosedGroupMemberItemSelected)
|
||||
.isVisible();
|
||||
|
||||
// trigger the creation of the group
|
||||
await app.client
|
||||
.element(ConversationPage.validateCreationClosedGroupButton)
|
||||
.click();
|
||||
|
||||
await app.client.waitForExist(
|
||||
ConversationPage.sessionToastGroupCreatedSuccess,
|
||||
1000
|
||||
);
|
||||
await app.client.isExisting(
|
||||
ConversationPage.headerTitleGroupName(this.VALID_CLOSED_GROUP_NAME1)
|
||||
);
|
||||
await app.client
|
||||
.element(ConversationPage.headerTitleMembers(2))
|
||||
.isVisible();
|
||||
|
||||
// validate overlay is closed
|
||||
await app.client
|
||||
.isExisting(ConversationPage.leftPaneOverlay)
|
||||
.should.eventually.be.equal(false);
|
||||
|
||||
// move back to the conversation section
|
||||
await app.client
|
||||
.element(ConversationPage.conversationButtonSection)
|
||||
.click();
|
||||
|
||||
// validate open chat has been added
|
||||
await app.client.isExisting(
|
||||
ConversationPage.rowOpenGroupConversationName(
|
||||
this.VALID_CLOSED_GROUP_NAME1
|
||||
)
|
||||
);
|
||||
|
||||
// next check app2 has been invited and has the group in its conversations
|
||||
await app2.client.waitForExist(
|
||||
ConversationPage.rowOpenGroupConversationName(
|
||||
this.VALID_CLOSED_GROUP_NAME1
|
||||
),
|
||||
6000
|
||||
);
|
||||
// open the closed group conversation on app2
|
||||
await app2.client
|
||||
.element(ConversationPage.conversationButtonSection)
|
||||
.click();
|
||||
await this.timeout(500);
|
||||
await app2.client
|
||||
.element(
|
||||
ConversationPage.rowOpenGroupConversationName(
|
||||
this.VALID_CLOSED_GROUP_NAME1
|
||||
)
|
||||
)
|
||||
.click();
|
||||
},
|
||||
|
||||
async linkApp2ToApp(app1, app2) {
|
||||
// app needs to be logged in as user1 and app2 needs to be logged out
|
||||
// start the pairing dialog for the first app
|
||||
|
@ -367,6 +442,27 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
async sendMessage(app, messageText, fileLocation = undefined){
|
||||
await app.client
|
||||
.element(ConversationPage.sendMessageTextarea)
|
||||
.setValue(messageText);
|
||||
await app.client
|
||||
.element(ConversationPage.sendMessageTextarea)
|
||||
.getValue()
|
||||
.should.eventually.equal(messageText);
|
||||
|
||||
// attach a file
|
||||
if (fileLocation) {
|
||||
await app.client
|
||||
.element(ConversationPage.attachmentInput)
|
||||
.setValue(fileLocation);
|
||||
}
|
||||
|
||||
// send message
|
||||
await app.client.element(ConversationPage.sendMessageTextarea).click();
|
||||
await app.client.keys('Enter');
|
||||
},
|
||||
|
||||
generateSendMessageText: () =>
|
||||
`Test message from integration tests ${Date.now()}`,
|
||||
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
const { before } = require('mocha');
|
||||
const common = require('./common');
|
||||
|
||||
require('./registration_test');
|
||||
require('./open_group_test');
|
||||
require('./add_friends_test');
|
||||
// require('./registration_test');
|
||||
// require('./open_group_test');
|
||||
// require('./add_friends_test');
|
||||
// require('./link_device_test');
|
||||
// require('./closed_group_test');
|
||||
|
||||
|
||||
require('./message_sync_test');
|
||||
require('./message_functions_test');
|
||||
|
||||
|
||||
before(async () => {
|
||||
|
|
|
@ -3,46 +3,70 @@
|
|||
/* eslint-disable func-names */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const common = require('./common');
|
||||
const { afterEach, beforeEach, describe, it } = require('mocha');
|
||||
const path = require('path');
|
||||
|
||||
describe('Link Device', function() {
|
||||
const { after, before, describe, it } = require('mocha');
|
||||
const ConversationPage = require('./page-objects/conversation.page');
|
||||
|
||||
describe('Message Functions', function() {
|
||||
let app;
|
||||
let app2;
|
||||
this.timeout(60000);
|
||||
this.slow(15000);
|
||||
|
||||
beforeEach(async () => {
|
||||
before(async () => {
|
||||
await common.killallElectron();
|
||||
await common.stopStubSnodeServer();
|
||||
|
||||
const app1Props = {
|
||||
mnemonic: common.TEST_MNEMONIC1,
|
||||
displayName: common.TEST_DISPLAY_NAME1,
|
||||
stubSnode: true,
|
||||
};
|
||||
|
||||
const app2Props = {
|
||||
stubSnode: true,
|
||||
};
|
||||
|
||||
[app, app2] = await Promise.all([
|
||||
common.startAndStub(app1Props),
|
||||
common.startAndStubN(app2Props, 2),
|
||||
]);
|
||||
[app, app2] = await common.startAppsAsFriends();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await common.killallElectron();
|
||||
await common.stopStubSnodeServer();
|
||||
after(async () => {
|
||||
// await common.stopApp(app);
|
||||
// await common.killallElectron();
|
||||
// await common.stopStubSnodeServer();
|
||||
});
|
||||
|
||||
it('link two desktop devices', async () => {
|
||||
await common.linkApp2ToApp(app, app2);
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('unlink two devices', async () => {
|
||||
await common.linkApp2ToApp(app, app2);
|
||||
await common.timeout(1000);
|
||||
await common.triggerUnlinkApp2FromApp(app, app2);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,11 +9,11 @@ module.exports = {
|
|||
'Send your first message'
|
||||
),
|
||||
existingSendMessageText: textMessage =>
|
||||
`//*[contains(@class, "module-message__text--outgoing")and .//span[contains(@class, "text-selectable")][contains(string(), '${textMessage}')]]`,
|
||||
`//*[contains(@class, "module-message__text--outgoing") and .//span[contains(@class, "text-selectable")][contains(string(), '${textMessage}')]]`,
|
||||
existingFriendRequestText: textMessage =>
|
||||
`//*[contains(@class, "module-message-friend-request__container")and .//span[contains(@class, "text-selectable")][contains(string(), '${textMessage}')]]`,
|
||||
existingReceivedMessageText: textMessage =>
|
||||
`//*[contains(@class, "module-message__text--incoming")and .//span[contains(@class, "text-selectable")][contains(string(), '${textMessage}')]]`,
|
||||
`//*[contains(@class, "module-message__text--incoming") and .//span[contains(@class, "text-selectable")][contains(string(), '${textMessage}')]]`,
|
||||
|
||||
// conversations
|
||||
conversationButtonSection:
|
||||
|
@ -28,6 +28,9 @@ module.exports = {
|
|||
`${number} members`
|
||||
),
|
||||
|
||||
attachmentInput: '//*[contains(@class, "choose-file")]/input[@type="file"]',
|
||||
attachmentButton: '//*[contains(@class, "choose-file")]/button',
|
||||
|
||||
// channels
|
||||
globeButtonSection:
|
||||
'//*[contains(@class,"session-icon-button") and .//*[contains(@class, "globe")]]',
|
||||
|
@ -77,7 +80,7 @@ module.exports = {
|
|||
oneNotificationFriendRequestLeft:
|
||||
'//*[contains(@class,"session-icon-button") and .//*[contains(@class, "users")] and .//*[contains(@class, "notification-count") and contains(string(), "1")] ]',
|
||||
oneNotificationFriendRequestTop:
|
||||
'//*[contains(@class,"contact-notification-count-bubble") and contains(string(), "1")]',
|
||||
'//*[contains(@class,"module-left-pane__header")] //*[contains(@class, "notification-count") and contains(string(), "1")]',
|
||||
friendRequestFromUser: (displayName, pubkey) =>
|
||||
`//*[contains(@class,"module-left-pane__list-popup") and .//*[contains(@class, "module-conversation__user") and .//*[contains(string(), "${displayName}")] and .//*[contains(string(), "(...${pubkey.substring(
|
||||
60
|
||||
|
|
BIN
integration_test/test_attachment
Normal file
BIN
integration_test/test_attachment
Normal file
Binary file not shown.
|
@ -140,15 +140,16 @@ a {
|
|||
}
|
||||
|
||||
input[type='file'] {
|
||||
display: none;
|
||||
// Must be displayed in order to programmatically
|
||||
// insert file paths)
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
z-index: -100;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue