Merge pull request #1077 from vincentbavitz/integration-test-vince
Message & Settings Testspull/1113/head
commit
cdc88f3cd1
@ -0,0 +1,86 @@
|
||||
/* 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';
|
||||
|
||||
await 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';
|
||||
await common.sendMessage(app, messageText);
|
||||
|
||||
await app.client.waitForExist(
|
||||
ConversationPage.existingSendMessageText(messageText),
|
||||
6000
|
||||
);
|
||||
await app2.client.waitForExist(
|
||||
ConversationPage.existingReceivedMessageText(messageText),
|
||||
7000
|
||||
);
|
||||
|
||||
// delete message in context menu
|
||||
await app.client
|
||||
.element(ConversationPage.messageCtxMenu(messageText))
|
||||
.click();
|
||||
await app.client.element(ConversationPage.deleteMessageCtxButton).click();
|
||||
|
||||
// delete messaage from modal
|
||||
await app.client.waitForExist(
|
||||
ConversationPage.deleteMessageModalButton,
|
||||
5000
|
||||
);
|
||||
await app.client.element(ConversationPage.deleteMessageModalButton).click();
|
||||
|
||||
// verify the message is actually deleted
|
||||
await app.client.isExisting(
|
||||
ConversationPage.existingSendMessageText(messageText)
|
||||
).should.eventually.be.false;
|
||||
});
|
||||
});
|
@ -0,0 +1,49 @@
|
||||
/* eslint-disable func-names */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const { afterEach, beforeEach, describe, it } = require('mocha');
|
||||
|
||||
const common = require('./common');
|
||||
|
||||
describe('Message Syncing', function() {
|
||||
let app;
|
||||
let app2;
|
||||
this.timeout(60000);
|
||||
this.slow(15000);
|
||||
|
||||
beforeEach(async () => {
|
||||
await common.killallElectron();
|
||||
await common.stopStubSnodeServer();
|
||||
|
||||
const app1Props = {
|
||||
mnemonic: common.TEST_MNEMONIC1,
|
||||
displayName: common.TEST_DISPLAY_NAME1,
|
||||
stubSnode: true,
|
||||
};
|
||||
|
||||
const app2Props = {
|
||||
mnemonic: common.TEST_MNEMONIC2,
|
||||
displayName: common.TEST_DISPLAY_NAME2,
|
||||
stubSnode: true,
|
||||
};
|
||||
|
||||
[app, app2] = await Promise.all([
|
||||
common.startAndStub(app1Props),
|
||||
common.startAndStubN(app2Props, 2),
|
||||
]);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await common.killallElectron();
|
||||
await common.stopStubSnodeServer();
|
||||
});
|
||||
|
||||
it('message syncing between linked devices', async () => {
|
||||
await common.linkApp2ToApp(app, app2);
|
||||
});
|
||||
|
||||
it('unlink two devices', async () => {
|
||||
await common.linkApp2ToApp(app, app2);
|
||||
await common.timeout(1000);
|
||||
await common.triggerUnlinkApp2FromApp(app, app2);
|
||||
});
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
// settings view
|
||||
settingsButtonSection:
|
||||
'//*[contains(@class,"session-icon-button") and .//*[contains(@class, "gear")]]',
|
||||
settingsRowWithText: text =>
|
||||
`//*[contains(@class, "left-pane-setting-category-list-item")][contains(string(), '${text}')]`,
|
||||
|
||||
leftPaneSettingsButton: `//*[contains(@class,"session-icon-button") and .//*[contains(@class, "gear")]]`,
|
||||
|
||||
settingToggleWithText: text =>
|
||||
`//div[contains(@class, 'session-settings-item') and contains(string(), '${text}')]//*[contains(@class, 'session-toggle')]`,
|
||||
settingButtonWithText: text =>
|
||||
`//div[contains(@class, 'session-settings-item')]//*[contains(@class, 'session-button') and contains(string(), '${text}')]`,
|
||||
settingCategoryWithText: text =>
|
||||
`//div[contains(@class, 'left-pane-setting-category-list-item') and contains(string(), '${text}')]`,
|
||||
|
||||
// Confirm is a boolean. Selects confirmation input
|
||||
passwordSetModalInput: _confirm =>
|
||||
`//input[@id = 'password-modal-input${_confirm ? '-confirm' : ''}']`,
|
||||
};
|
@ -0,0 +1,120 @@
|
||||
/* eslint-disable prefer-destructuring */
|
||||
/* eslint-disable more/no-then */
|
||||
/* eslint-disable func-names */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
const { after, before, describe, it } = require('mocha');
|
||||
const common = require('./common');
|
||||
|
||||
const SettingsPage = require('./page-objects/settings.page');
|
||||
const CommonPage = require('./page-objects/common.page');
|
||||
|
||||
// Generate random password
|
||||
const password = Math.random()
|
||||
.toString(36)
|
||||
.substr(2, 8);
|
||||
const passwordInputID = 'password-modal-input';
|
||||
|
||||
describe('Settings', function() {
|
||||
let app;
|
||||
this.timeout(60000);
|
||||
this.slow(15000);
|
||||
|
||||
before(async () => {
|
||||
await common.killallElectron();
|
||||
await common.stopStubSnodeServer();
|
||||
|
||||
const appProps = {
|
||||
mnemonic: common.TEST_MNEMONIC1,
|
||||
displayName: common.TEST_DISPLAY_NAME1,
|
||||
stubSnode: true,
|
||||
};
|
||||
|
||||
app = await common.startAndStub(appProps);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await common.stopApp(app);
|
||||
await common.killallElectron();
|
||||
await common.stopStubSnodeServer();
|
||||
});
|
||||
|
||||
it('can toggle menubar', async () => {
|
||||
const menuBarVisible = await app.browserWindow.isMenuBarVisible();
|
||||
|
||||
await app.client.element(SettingsPage.settingsButtonSection).click();
|
||||
await app.client
|
||||
.element(SettingsPage.settingToggleWithText('Hide Menu Bar'))
|
||||
.click();
|
||||
|
||||
// Confirm that toggling works
|
||||
const menuBarToggled = await app.browserWindow.isMenuBarVisible();
|
||||
menuBarToggled.should.equal(!menuBarVisible);
|
||||
});
|
||||
|
||||
it('can set password', async () => {
|
||||
await app.client
|
||||
.element(SettingsPage.settingsRowWithText('Privacy'))
|
||||
.click();
|
||||
|
||||
await app.client
|
||||
.element(SettingsPage.settingButtonWithText('Set Password'))
|
||||
.click();
|
||||
|
||||
await common.setValueWrapper(
|
||||
app,
|
||||
CommonPage.inputWithId(passwordInputID),
|
||||
password
|
||||
);
|
||||
await common.setValueWrapper(
|
||||
app,
|
||||
CommonPage.inputWithId(`${passwordInputID}-confirm`),
|
||||
password
|
||||
);
|
||||
|
||||
await app.client.keys('Enter');
|
||||
|
||||
// Verify password set
|
||||
await app.client.waitForExist(
|
||||
CommonPage.toastWithText('Set Password'),
|
||||
2000
|
||||
);
|
||||
|
||||
await common.closeToast(app);
|
||||
});
|
||||
|
||||
it('can remove password', async () => {
|
||||
// Enter password to unlock settings
|
||||
await common.setValueWrapper(
|
||||
app,
|
||||
CommonPage.inputWithId('password-lock-input'),
|
||||
password
|
||||
);
|
||||
|
||||
await app.client.keys('Enter');
|
||||
|
||||
// Remove password
|
||||
await app.client
|
||||
.element(SettingsPage.settingButtonWithText('Remove Password'))
|
||||
.click();
|
||||
|
||||
await common.setValueWrapper(
|
||||
app,
|
||||
CommonPage.inputWithId(passwordInputID),
|
||||
password
|
||||
);
|
||||
|
||||
await app.client.keys('Enter');
|
||||
|
||||
// Verify password removed with toast
|
||||
await app.client.waitForExist(
|
||||
CommonPage.toastWithText('Removed Password'),
|
||||
2000
|
||||
);
|
||||
|
||||
// Verify password actully removed
|
||||
await app.client.isExisting(
|
||||
CommonPage.divWithClass('session-settings__password-lock')
|
||||
).should.eventually.be.false;
|
||||
});
|
||||
});
|
Binary file not shown.
Loading…
Reference in New Issue