pull/1077/head
Vincent 5 years ago
parent e6fdf95dcb
commit 958a4c8594

@ -16,7 +16,6 @@ const RegistrationPage = require('./page-objects/registration.page');
const ConversationPage = require('./page-objects/conversation.page');
const SettingsPage = require('./page-objects/settings.page');
chai.should();
chai.use(chaiAsPromised);
chai.config.includeStack = true;
@ -44,7 +43,6 @@ module.exports = {
'05f8662b6e83da5a31007cc3ded44c601f191e07999acb6db2314a896048d9036c',
TEST_DISPLAY_NAME3: 'integration_tester_3',
/* ************** OPEN GROUPS ****************** */
VALID_GROUP_URL: 'https://chat.getsession.org',
VALID_GROUP_URL2: 'https://chat-dev.lokinet.org',
@ -71,7 +69,7 @@ module.exports = {
// could put a branch here to use one of those
// if we know what platforms are good and which ones are broken
if (process.platform === 'darwin'){
if (process.platform === 'darwin') {
await app.client.execute(
(slctr, val) => {
// eslint-disable-next-line no-undef
@ -100,7 +98,6 @@ module.exports = {
// Linux & Windows don't require wrapper
await app.client.element(selector).setValue(value);
}
},
async startApp(environment = 'test-integration-session') {
@ -329,8 +326,8 @@ module.exports = {
async addFriendToNewClosedGroup(app, app2) {
await app.client
.element(ConversationPage.closedGroupNameTextarea)
.setValue(this.VALID_CLOSED_GROUP_NAME1);
.element(ConversationPage.closedGroupNameTextarea)
.setValue(this.VALID_CLOSED_GROUP_NAME1);
await app.client
.element(ConversationPage.closedGroupNameTextarea)
.getValue()
@ -364,10 +361,10 @@ module.exports = {
.element(ConversationPage.headerTitleMembers(2))
.isVisible();
// validate overlay is closed
// validate overlay is closed
await app.client
.isExisting(ConversationPage.leftPaneOverlay)
.should.eventually.be.equal(false);
.isExisting(ConversationPage.leftPaneOverlay)
.should.eventually.be.equal(false);
// move back to the conversation section
await app.client
@ -406,7 +403,9 @@ module.exports = {
// app needs to be logged in as user1 and app2 needs to be logged out
// start the pairing dialog for the first app
await app1.client.element(SettingsPage.settingsButtonSection).click();
await app1.client.element(SettingsPage.settingsRowWithText('Devices')).click();
await app1.client
.element(SettingsPage.settingsRowWithText('Devices'))
.click();
await app1.client.isVisible(ConversationPage.noPairedDeviceMessage);
// we should not find the linkDeviceButtonDisabled button (as DISABLED)
@ -470,7 +469,9 @@ module.exports = {
.should.eventually.be.true;
await app1.client.element(ConversationPage.settingsButtonSection).click();
await app1.client.element(ConversationPage.settingsRowWithText('Devices')).click();
await app1.client
.element(ConversationPage.settingsRowWithText('Devices'))
.click();
await app1.client.isExisting(ConversationPage.linkDeviceButtonDisabled)
.should.eventually.be.true;
// click the unlink button
@ -506,10 +507,10 @@ module.exports = {
}
},
async sendMessage(app, messageText, fileLocation = undefined){
async sendMessage(app, messageText, fileLocation = undefined) {
await app.client
.element(ConversationPage.sendMessageTextarea)
.setValue(messageText);
.element(ConversationPage.sendMessageTextarea)
.setValue(messageText);
await app.client
.element(ConversationPage.sendMessageTextarea)
.getValue()

@ -6,7 +6,6 @@
const { before } = require('mocha');
const common = require('./common');
require('./registration_test');
require('./open_group_test');
require('./add_friends_test');
@ -15,7 +14,6 @@ require('./closed_group_test');
require('./message_functions_test');
require('./settings_test');
before(async () => {
// start the app once before all tests to get the platform-dependent
// path of user data and store it to common.USER_DATA_ROOT_FOLDER

@ -51,7 +51,7 @@ describe('Message Functions', function() {
5000
);
});
it('can delete message', async () => {
const messageText = 'delete_me';
common.sendMessage(app, messageText);
@ -64,9 +64,11 @@ describe('Message Functions', function() {
ConversationPage.existingReceivedMessageText(messageText),
7000
);
// delete message in context menu
await app.client.element(ConversationPage.messageCtxMenu(messageText)).click();
await app.client
.element(ConversationPage.messageCtxMenu(messageText))
.click();
await app.client.element(ConversationPage.deleteMessageCtxButton).click();
// delete messaage from modal
@ -75,11 +77,10 @@ describe('Message Functions', function() {
3000
);
await app.client.element(ConversationPage.deleteMessageModalButton).click();
// verify the message is actually deleted
await app.client.isExisting(
ConversationPage.existingSendMessageText(messageText)
).should.eventually.be.false;
});
});

@ -4,7 +4,6 @@ const { afterEach, beforeEach, describe, it } = require('mocha');
const common = require('./common');
describe('Message Syncing', function() {
let app;
let app2;
@ -21,7 +20,7 @@ describe('Message Syncing', function() {
displayName: common.TEST_DISPLAY_NAME1,
stubSnode: true,
};
const app2Props = {
mnemonic: common.TEST_MNEMONIC2,
displayName: common.TEST_DISPLAY_NAME2,
@ -55,5 +54,4 @@ describe('Message Syncing', function() {
await common.timeout(1000);
await common.triggerUnlinkApp2FromApp(app, app2);
});
});
});

@ -22,6 +22,6 @@ module.exports = {
module.exports.objWithClassAndText('span', classname, text),
toastWithText: text =>
module.exports.divWithClassAndText('session-toast-wrapper', text),
toastCloseButton: '//div[contains(@class, "session-toast-wrapper")]//div[contains(@class, "toast-close")]/div',
toastCloseButton:
'//div[contains(@class, "session-toast-wrapper")]//div[contains(@class, "toast-close")]/div',
};

@ -31,10 +31,13 @@ module.exports = {
attachmentInput: '//*[contains(@class, "choose-file")]/input[@type="file"]',
attachmentButton: '//*[contains(@class, "choose-file")]/button',
messageCtxMenu: message => `//div[contains(@class, 'message-wrapper')]//span[contains(string(), '${message}')]/parent::div/parent::div/parent::div/parent::div//div[contains(@class, 'module-message__buttons__menu')]`,
messageCtxMenu: message =>
`//div[contains(@class, 'message-wrapper')]//span[contains(string(), '${message}')]/parent::div/parent::div/parent::div/parent::div//div[contains(@class, 'module-message__buttons__menu')]`,
deleteMessageCtxButton: '//*[contains(@class, "react-contextmenu--visible")]/div[contains(string(), "Delete")]',
deleteMessageModalButton: '//*[contains(@class, "session-modal")]//div[contains(string(), "Delete") and contains(@class, "session-button")]',
deleteMessageCtxButton:
'//*[contains(@class, "react-contextmenu--visible")]/div[contains(string(), "Delete")]',
deleteMessageModalButton:
'//*[contains(@class, "session-modal")]//div[contains(string(), "Delete") and contains(@class, "session-button")]',
// channels
globeButtonSection:
@ -95,7 +98,6 @@ module.exports = {
acceptedFriendRequestMessage:
'//*[contains(@class, "module-friend-request__title")][contains(string(), "Friend request accepted")]',
descriptionDeleteAccount: commonPage.spanWithClassAndText(
'session-confirm-main-message',
'Are you sure you want to delete your account?'

@ -7,11 +7,14 @@ module.exports = {
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}')]`,
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' : ''}']`,
passwordSetModalInput: _confirm =>
`//input[@id = 'password-modal-input${_confirm ? '-confirm' : ''}']`,
};

@ -10,7 +10,9 @@ 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 password = Math.random()
.toString(36)
.substr(2, 8);
const passwordInputID = 'password-modal-input';
describe('Settings', function() {
@ -41,20 +43,23 @@ describe('Settings', function() {
const menuBarVisible = await app.browserWindow.isMenuBarVisible();
await app.client.element(SettingsPage.settingsButtonSection).click();
await app.client.element(SettingsPage.settingToggleWithText('Hide Menu Bar')).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();
it('can set password', async () => {
await app.client
.element(SettingsPage.settingsRowWithText('Privacy'))
.click();
await app.client.element(
SettingsPage.settingButtonWithText('Set Password')
).click();
await app.client
.element(SettingsPage.settingButtonWithText('Set Password'))
.click();
await common.setValueWrapper(
app,
@ -76,11 +81,9 @@ describe('Settings', function() {
);
await common.closeToast(app);
});
it('can remove password', async () => {
// Enter password to unlock settings
await common.setValueWrapper(
app,
@ -91,9 +94,9 @@ describe('Settings', function() {
await app.client.keys('Enter');
// Remove password
await app.client.element(
SettingsPage.settingButtonWithText('Remove Password')
).click();
await app.client
.element(SettingsPage.settingButtonWithText('Remove Password'))
.click();
await common.setValueWrapper(
app,

@ -149,7 +149,6 @@ a {
left: 0;
cursor: pointer;
z-index: -100;
}
}

@ -141,18 +141,26 @@ export class SessionPasswordModal extends React.Component<Props, State> {
private async setPassword(onSuccess?: any) {
// Only initial input required for PasswordAction.Remove
if (!this.passwordInput.current
|| (!this.passwordInputConfirm.current && this.props.action !== PasswordAction.Remove)) {
return;
if (
!this.passwordInput.current ||
(!this.passwordInputConfirm.current &&
this.props.action !== PasswordAction.Remove)
) {
return;
}
// Trim leading / trailing whitespace for UX
const enteredPassword = String(this.passwordInput.current.value).trim();
const enteredPasswordConfirm = this.passwordInputConfirm.current && String(
this.passwordInputConfirm.current.value
).trim() || '';
const enteredPasswordConfirm =
(this.passwordInputConfirm.current &&
String(this.passwordInputConfirm.current.value).trim()) ||
'';
if (enteredPassword.length === 0 || (enteredPasswordConfirm.length === 0 && this.props.action !== PasswordAction.Remove)) {
if (
enteredPassword.length === 0 ||
(enteredPasswordConfirm.length === 0 &&
this.props.action !== PasswordAction.Remove)
) {
return;
}

Loading…
Cancel
Save