[FIX] E2EE password hiding automatically (#2972)
* [FIX] E2EE password hiding automatically * add e2e test * fixed hiding banner * move e2e tests to 01-e2eencryption * remove console.log * Fix tests Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
632751898c
commit
704e071275
|
@ -69,7 +69,8 @@ const handleEncryptionInit = function* handleEncryptionInit() {
|
||||||
storedPublicKey = EJSON.parse(storedPublicKey);
|
storedPublicKey = EJSON.parse(storedPublicKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedPublicKey && storedPrivateKey) {
|
|
||||||
|
if (storedPublicKey && storedPrivateKey && !storedRandomPassword) {
|
||||||
// Persist these keys
|
// Persist these keys
|
||||||
yield Encryption.persistKeys(server, storedPublicKey, storedPrivateKey);
|
yield Encryption.persistKeys(server, storedPublicKey, storedPrivateKey);
|
||||||
yield put(encryptionSet(true));
|
yield put(encryptionSet(true));
|
||||||
|
|
16
e2e/data.js
16
e2e/data.js
|
@ -1,9 +1,9 @@
|
||||||
const random = require('./helpers/random');
|
const random = require('./helpers/random');
|
||||||
const value = random(20);
|
const value = random(20);
|
||||||
const data = {
|
const data = {
|
||||||
server: 'https://mobile.rocket.chat',
|
server: 'http://localhost:3000',
|
||||||
adminUser: 'e2e_admin',
|
adminUser: 'admin',
|
||||||
adminPassword: 'p7mFh4yLwCRXSnMvG',
|
adminPassword: 'password',
|
||||||
alternateServer: 'https://stable.rocket.chat',
|
alternateServer: 'https://stable.rocket.chat',
|
||||||
users: {
|
users: {
|
||||||
regular: {
|
regular: {
|
||||||
|
@ -47,6 +47,16 @@ const data = {
|
||||||
password: `password${ value }`,
|
password: `password${ value }`,
|
||||||
email: `mobile+registering${ value }@rocket.chat`
|
email: `mobile+registering${ value }@rocket.chat`
|
||||||
},
|
},
|
||||||
|
registeringUser2: {
|
||||||
|
username: `newusertwo${ value }`,
|
||||||
|
password: `passwordtwo${ value }`,
|
||||||
|
email: `mobile+registeringtwo${ value }@rocket.chat`
|
||||||
|
},
|
||||||
|
registeringUser3: {
|
||||||
|
username: `newuserthree${ value }`,
|
||||||
|
password: `passwordthree${ value }`,
|
||||||
|
email: `mobile+registeringthree${ value }@rocket.chat`
|
||||||
|
},
|
||||||
random: value
|
random: value
|
||||||
}
|
}
|
||||||
module.exports = data;
|
module.exports = data;
|
||||||
|
|
|
@ -47,6 +47,16 @@ const data = {
|
||||||
password: `password${ value }`,
|
password: `password${ value }`,
|
||||||
email: `mobile+registering${ value }@rocket.chat`
|
email: `mobile+registering${ value }@rocket.chat`
|
||||||
},
|
},
|
||||||
|
registeringUser2: {
|
||||||
|
username: `newusertwo${ value }`,
|
||||||
|
password: `passwordtwo${ value }`,
|
||||||
|
email: `mobile+registeringtwo${ value }@rocket.chat`
|
||||||
|
},
|
||||||
|
registeringUser3: {
|
||||||
|
username: `newuserthree${ value }`,
|
||||||
|
password: `passwordthree${ value }`,
|
||||||
|
email: `mobile+registeringthree${ value }@rocket.chat`
|
||||||
|
},
|
||||||
random: value
|
random: value
|
||||||
}
|
}
|
||||||
module.exports = data;
|
module.exports = data;
|
||||||
|
|
|
@ -47,6 +47,16 @@ const data = {
|
||||||
password: `password${ value }`,
|
password: `password${ value }`,
|
||||||
email: `mobile+registering${ value }@rocket.chat`
|
email: `mobile+registering${ value }@rocket.chat`
|
||||||
},
|
},
|
||||||
|
registeringUser2: {
|
||||||
|
username: `newusertwo${ value }`,
|
||||||
|
password: `passwordtwo${ value }`,
|
||||||
|
email: `mobile+registeringtwo${ value }@rocket.chat`
|
||||||
|
},
|
||||||
|
registeringUser3: {
|
||||||
|
username: `newuserthree${ value }`,
|
||||||
|
password: `passwordthree${ value }`,
|
||||||
|
email: `mobile+registeringthree${ value }@rocket.chat`
|
||||||
|
},
|
||||||
random: value
|
random: value
|
||||||
}
|
}
|
||||||
module.exports = data;
|
module.exports = data;
|
||||||
|
|
|
@ -8,6 +8,18 @@ const data = require('../../data');
|
||||||
const testuser = data.users.regular
|
const testuser = data.users.regular
|
||||||
const otheruser = data.users.alternate
|
const otheruser = data.users.alternate
|
||||||
|
|
||||||
|
const checkServer = async(server) => {
|
||||||
|
const label = `Connected to ${ server }`;
|
||||||
|
await element(by.id('rooms-list-view-sidebar')).tap();
|
||||||
|
await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000);
|
||||||
|
await waitFor(element(by.label(label))).toBeVisible().withTimeout(60000);
|
||||||
|
await element(by.id('sidebar-close-drawer')).tap();
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkBanner = async() => {
|
||||||
|
await waitFor(element(by.id('listheader-encryption').withDescendant(by.label('Save Your Encryption Password')))).toBeVisible().withTimeout(10000);
|
||||||
|
}
|
||||||
|
|
||||||
async function navigateToRoom(roomName) {
|
async function navigateToRoom(roomName) {
|
||||||
await searchRoom(`${ roomName }`);
|
await searchRoom(`${ roomName }`);
|
||||||
await waitFor(element(by.id(`rooms-list-view-item-${ roomName }`))).toExist().withTimeout(60000);
|
await waitFor(element(by.id(`rooms-list-view-item-${ roomName }`))).toExist().withTimeout(60000);
|
||||||
|
@ -43,7 +55,7 @@ describe('E2E Encryption', () => {
|
||||||
describe('Banner', async() => {
|
describe('Banner', async() => {
|
||||||
describe('Render', async () => {
|
describe('Render', async () => {
|
||||||
it('should have encryption badge', async () => {
|
it('should have encryption badge', async () => {
|
||||||
await waitFor(element(by.id('listheader-encryption').withDescendant(by.label('Save Your Encryption Password')))).toBeVisible().withTimeout(10000);
|
await checkBanner();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -195,4 +207,54 @@ describe('E2E Encryption', () => {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Persist Banner', () => {
|
||||||
|
it('check save banner', async() => {
|
||||||
|
await checkServer(data.server);
|
||||||
|
await checkBanner();
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add server and create new user', async() => {
|
||||||
|
await sleep(5000);
|
||||||
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
||||||
|
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
|
||||||
|
await element(by.id('rooms-list-header-server-add')).tap();
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
|
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
|
||||||
|
await element(by.id('new-server-view-input')).replaceText(data.alternateServer);
|
||||||
|
await element(by.id('new-server-view-button')).tap();
|
||||||
|
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
|
||||||
|
await element(by.id('workspace-view-register')).tap();
|
||||||
|
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
|
||||||
|
|
||||||
|
// Register new user
|
||||||
|
await element(by.id('register-view-name')).replaceText(data.registeringUser.username);
|
||||||
|
await element(by.id('register-view-username')).replaceText(data.registeringUser.username);
|
||||||
|
await element(by.id('register-view-email')).replaceText(data.registeringUser.email);
|
||||||
|
await element(by.id('register-view-password')).replaceText(data.registeringUser.password);
|
||||||
|
await element(by.id('register-view-submit')).tap();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
||||||
|
|
||||||
|
await checkServer(data.alternateServer);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change back', async() => {
|
||||||
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
||||||
|
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
|
||||||
|
await element(by.id(`rooms-list-header-server-${ data.server }`)).tap();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
||||||
|
await checkServer(data.server);
|
||||||
|
await checkBanner();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reopen the app and have banner', async() => {
|
||||||
|
await device.launchApp({
|
||||||
|
permissions: { notifications: 'YES' },
|
||||||
|
newInstance: true
|
||||||
|
});
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
||||||
|
await checkBanner();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
|
@ -39,10 +39,10 @@ describe('Change server', () => {
|
||||||
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
|
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
|
||||||
|
|
||||||
// Register new user
|
// Register new user
|
||||||
await element(by.id('register-view-name')).replaceText(data.registeringUser.username);
|
await element(by.id('register-view-name')).replaceText(data.registeringUser2.username);
|
||||||
await element(by.id('register-view-username')).replaceText(data.registeringUser.username);
|
await element(by.id('register-view-username')).replaceText(data.registeringUser2.username);
|
||||||
await element(by.id('register-view-email')).replaceText(data.registeringUser.email);
|
await element(by.id('register-view-email')).replaceText(data.registeringUser2.email);
|
||||||
await element(by.id('register-view-password')).replaceText(data.registeringUser.password);
|
await element(by.id('register-view-password')).replaceText(data.registeringUser2.password);
|
||||||
await element(by.id('register-view-submit')).tap();
|
await element(by.id('register-view-submit')).tap();
|
||||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ describe('Delete server', () => {
|
||||||
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
|
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
|
||||||
|
|
||||||
// Register new user
|
// Register new user
|
||||||
await element(by.id('register-view-name')).replaceText(data.registeringUser.username);
|
await element(by.id('register-view-name')).replaceText(data.registeringUser3.username);
|
||||||
await element(by.id('register-view-username')).replaceText(data.registeringUser.username);
|
await element(by.id('register-view-username')).replaceText(data.registeringUser3.username);
|
||||||
await element(by.id('register-view-email')).replaceText(data.registeringUser.email);
|
await element(by.id('register-view-email')).replaceText(data.registeringUser3.email);
|
||||||
await element(by.id('register-view-password')).replaceText(data.registeringUser.password);
|
await element(by.id('register-view-password')).replaceText(data.registeringUser3.password);
|
||||||
await element(by.id('register-view-submit')).tap();
|
await element(by.id('register-view-submit')).tap();
|
||||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue