2023-03-07 12:28:51 +00:00
|
|
|
import { device, waitFor, element, by, expect } from 'detox';
|
2021-12-02 13:19:15 +00:00
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
import {
|
|
|
|
navigateToLogin,
|
|
|
|
login,
|
|
|
|
sleep,
|
|
|
|
tapBack,
|
|
|
|
searchRoom,
|
|
|
|
logout,
|
|
|
|
platformTypes,
|
2023-03-07 12:28:51 +00:00
|
|
|
TTextMatcher,
|
|
|
|
tapAndWaitFor,
|
|
|
|
expectValidRegisterOrRetry,
|
2023-03-23 22:47:05 +00:00
|
|
|
mockMessage,
|
|
|
|
tryTapping
|
2022-09-12 14:51:33 +00:00
|
|
|
} from '../../helpers/app';
|
|
|
|
import data from '../../data';
|
2023-03-07 12:28:51 +00:00
|
|
|
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
|
|
|
|
import random from '../../helpers/random';
|
2020-10-30 18:31:04 +00:00
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
const checkServer = async (server: string) => {
|
2021-09-13 20:41:05 +00:00
|
|
|
const label = `Connected to ${server}`;
|
2023-03-07 12:28:51 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view-sidebar')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('rooms-list-view-sidebar')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('sidebar-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await waitFor(element(by.label(label)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('sidebar-close-drawer')).tap();
|
2021-07-02 17:39:39 +00:00
|
|
|
};
|
2021-04-01 19:27:46 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
const checkBanner = async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
// TODO: Assert 'Save Your Encryption Password'
|
|
|
|
await waitFor(element(by.id('listheader-encryption')))
|
|
|
|
.toExist()
|
2021-09-13 20:41:05 +00:00
|
|
|
.withTimeout(10000);
|
2021-07-02 17:39:39 +00:00
|
|
|
};
|
2021-04-01 19:27:46 +00:00
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
async function navigateToRoom(roomName: string) {
|
2021-09-13 20:41:05 +00:00
|
|
|
await searchRoom(`${roomName}`);
|
|
|
|
await element(by.id(`rooms-list-view-item-${roomName}`)).tap();
|
|
|
|
await waitFor(element(by.id('room-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2020-10-30 18:31:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async function waitForToast() {
|
|
|
|
await sleep(300);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function navigateSecurityPrivacy() {
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('rooms-list-view-sidebar')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('sidebar-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await waitFor(element(by.id('sidebar-settings')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('sidebar-settings')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('settings-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('settings-view-security-privacy')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('security-privacy-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
describe('E2E Encryption', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
const room = `encrypted${random()}`;
|
|
|
|
let user: ITestUser;
|
|
|
|
let otherUser: ITestUser;
|
|
|
|
let mockedMessageText: string;
|
2020-10-30 18:31:04 +00:00
|
|
|
const newPassword = 'abc';
|
2023-03-07 12:28:51 +00:00
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
let alertButtonType: string;
|
|
|
|
let textMatcher: TTextMatcher;
|
2020-10-30 18:31:04 +00:00
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
beforeAll(async () => {
|
|
|
|
user = await createRandomUser();
|
|
|
|
otherUser = await createRandomUser();
|
2020-10-30 18:31:04 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2022-09-12 14:51:33 +00:00
|
|
|
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
|
2020-10-30 18:31:04 +00:00
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Banner', () => {
|
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have encryption badge', async () => {
|
2021-04-01 19:27:46 +00:00
|
|
|
await checkBanner();
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should tap encryption badge and open save password modal', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('listheader-encryption')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('e2e-save-password-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should tap "How it works" and navigate', async () => {
|
2023-05-08 13:45:46 +00:00
|
|
|
await element(by.id('e2e-save-password-view-how-it-works')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('e2e-how-it-works-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should tap "Save my password" and close modal', async () => {
|
2023-05-08 13:45:46 +00:00
|
|
|
await element(by.id('e2e-save-password-view-saved-password')).tap();
|
2023-03-07 12:28:51 +00:00
|
|
|
await sleep(300); // wait for animation
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should create encrypted room', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('rooms-list-view-create-channel')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('new-message-view')))
|
2023-03-07 12:28:51 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await waitFor(element(by.id('new-message-view-create-channel')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('new-message-view-create-channel')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('select-users-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id('select-users-view-search')).replaceText(otherUser.username);
|
|
|
|
await waitFor(element(by.id(`select-users-view-item-${otherUser.username}`)))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id(`select-users-view-item-${otherUser.username}`)).tap();
|
|
|
|
await waitFor(element(by.id(`selected-user-${otherUser.username}`)))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('selected-users-view-submit')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('create-channel-view')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('create-channel-name')).replaceText(room);
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id('create-channel-name')).tapReturnKey();
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('create-channel-encrypted')).longPress();
|
|
|
|
await element(by.id('create-channel-submit')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('room-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await waitFor(element(by.id(`room-view-title-${room}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should send message and be able to read it', async () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
mockedMessageText = await mockMessage('message');
|
2023-03-23 22:47:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should quote a message and be able to read both', async () => {
|
|
|
|
const mockedMessageTextToQuote = await mockMessage('message to be quote');
|
|
|
|
const quotedMessage = `${mockedMessageTextToQuote}d`;
|
|
|
|
await tryTapping(element(by[textMatcher](mockedMessageTextToQuote)).atIndex(0), 2000, true);
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Quote')).atIndex(0).tap();
|
|
|
|
await element(by.id('messagebox-input')).replaceText(quotedMessage);
|
|
|
|
await waitFor(element(by.id('messagebox-send-message')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('messagebox-send-message')).tap();
|
|
|
|
await waitFor(element(by[textMatcher](quotedMessage)).atIndex(0))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(3000);
|
|
|
|
await waitFor(
|
|
|
|
element(
|
|
|
|
by.id(`reply-${user.name}-${mockedMessageTextToQuote}`).withDescendant(by[textMatcher](mockedMessageTextToQuote))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(3000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
|
|
|
});
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2020-10-30 18:31:04 +00:00
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Security and Privacy', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should navigate to security privacy', async () => {
|
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('rooms-list-view-sidebar')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('sidebar-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await waitFor(element(by.id('sidebar-settings')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('sidebar-settings')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('settings-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('settings-view-security-privacy')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('security-privacy-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('render', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.id('security-privacy-view-e2e-encryption'))).toExist();
|
|
|
|
await expect(element(by.id('security-privacy-view-screen-lock'))).toExist();
|
|
|
|
await expect(element(by.id('security-privacy-view-analytics-events'))).toExist();
|
|
|
|
await expect(element(by.id('security-privacy-view-crash-report'))).toExist();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('E2E Encryption Security', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should navigate to e2e encryption security', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('security-privacy-view-e2e-encryption')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('e2e-encryption-security-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have items', async () => {
|
|
|
|
await waitFor(element(by.id('e2e-encryption-security-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.id('e2e-encryption-security-view-password'))).toExist();
|
2023-05-08 13:45:46 +00:00
|
|
|
await expect(element(by.id('e2e-encryption-security-view-change-password'))).toExist();
|
|
|
|
await expect(element(by.id('e2e-encryption-security-view-reset-key'))).toExist();
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2020-10-30 18:31:04 +00:00
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Change password', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should change password', async () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id('e2e-encryption-security-view-password')).replaceText(newPassword);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('e2e-encryption-security-view-change-password')).tap();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('Are you sure?')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await expect(element(by[textMatcher]("Make sure you've saved it carefully somewhere else."))).toExist();
|
|
|
|
await element(by[textMatcher]('Yes, change it')).atIndex(0).tap();
|
2020-10-30 18:31:04 +00:00
|
|
|
await waitForToast();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should navigate to the room and messages should remain decrypted', async () => {
|
|
|
|
await waitFor(element(by.id('e2e-encryption-security-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('security-privacy-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('settings-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('settings-view-drawer')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('sidebar-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('sidebar-chats')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await navigateToRoom(room);
|
2023-03-07 12:28:51 +00:00
|
|
|
await waitFor(element(by[textMatcher](mockedMessageText)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should logout, login and messages should be encrypted', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await logout();
|
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2020-10-30 18:31:04 +00:00
|
|
|
await navigateToRoom(room);
|
2023-03-07 12:28:51 +00:00
|
|
|
await waitFor(element(by[textMatcher](mockedMessageText)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.not.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.label('Encrypted message')).atIndex(0)).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should enter new e2e password and messages should be decrypted', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
// TODO: assert 'Enter Your E2E Password'
|
|
|
|
await waitFor(element(by.id('listheader-encryption')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await tapAndWaitFor(element(by.id('listheader-encryption')), element(by.id('e2e-enter-your-password-view')), 2000);
|
|
|
|
await element(by.id('e2e-enter-your-password-view-password')).replaceText(newPassword);
|
2020-10-30 18:31:04 +00:00
|
|
|
await element(by.id('e2e-enter-your-password-view-confirm')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('listheader-encryption')))
|
|
|
|
.not.toExist()
|
|
|
|
.withTimeout(10000);
|
2020-10-30 18:31:04 +00:00
|
|
|
await navigateToRoom(room);
|
2023-03-07 12:28:51 +00:00
|
|
|
await waitFor(element(by[textMatcher](mockedMessageText)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Reset E2E key', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
beforeAll(async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
});
|
|
|
|
it('should reset e2e key', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await navigateSecurityPrivacy();
|
|
|
|
await element(by.id('security-privacy-view-e2e-encryption')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('e2e-encryption-security-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2023-05-08 13:45:46 +00:00
|
|
|
await element(by.id('e2e-encryption-security-view-reset-key')).tap();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('Are you sure?')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await expect(element(by[textMatcher]("You're going to be logged out."))).toExist();
|
|
|
|
await element(by[textMatcher]('Yes, reset it').and(by.type(alertButtonType))).tap();
|
2021-07-02 17:39:39 +00:00
|
|
|
await sleep(2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
// FIXME: The app isn't showing this alert anymore
|
|
|
|
// await waitFor(element(by[textMatcher]("You've been logged out by the server. Please log in again.")))
|
|
|
|
// .toExist()
|
|
|
|
// .withTimeout(20000);
|
|
|
|
// await element(by[textMatcher]('OK').and(by.type(alertButtonType))).tap();
|
|
|
|
// await waitFor(element(by.id('workspace-view')))
|
|
|
|
// .toBeVisible()
|
|
|
|
// .withTimeout(10000);
|
|
|
|
// await element(by.id('workspace-view-login')).tap();
|
|
|
|
await navigateToLogin();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('login-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2021-12-02 13:19:15 +00:00
|
|
|
// TODO: assert 'Save Your Encryption Password'
|
|
|
|
await waitFor(element(by.id('listheader-encryption')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
2022-09-12 14:51:33 +00:00
|
|
|
.withTimeout(5000);
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2020-10-30 18:31:04 +00:00
|
|
|
});
|
|
|
|
});
|
2021-04-01 19:27:46 +00:00
|
|
|
|
|
|
|
describe('Persist Banner', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('check save banner', async () => {
|
2021-04-01 19:27:46 +00:00
|
|
|
await checkServer(data.server);
|
|
|
|
await checkBanner();
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should add server and create new user', async () => {
|
2021-04-01 19:27:46 +00:00
|
|
|
await sleep(5000);
|
|
|
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('rooms-list-header-server-add')).tap();
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-04-01 19:27:46 +00:00
|
|
|
// TODO: refactor
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('new-server-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id('new-server-view-input')).replaceText(`${data.alternateServer}`);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('new-server-view-input')).tapReturnKey();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('workspace-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('workspace-view-register')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('register-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-04-01 19:27:46 +00:00
|
|
|
// Register new user
|
2023-03-07 12:28:51 +00:00
|
|
|
const randomUser = data.randomUser();
|
|
|
|
await element(by.id('register-view-name')).replaceText(randomUser.username);
|
|
|
|
await element(by.id('register-view-username')).replaceText(randomUser.username);
|
|
|
|
await element(by.id('register-view-email')).replaceText(randomUser.email);
|
|
|
|
await element(by.id('register-view-password')).replaceText(randomUser.password);
|
|
|
|
await element(by.id('register-view-password')).tapReturnKey();
|
|
|
|
await expectValidRegisterOrRetry(device.getPlatform());
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-04-01 19:27:46 +00:00
|
|
|
await checkServer(data.alternateServer);
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should change back', async () => {
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
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);
|
2021-04-01 19:27:46 +00:00
|
|
|
await checkServer(data.server);
|
|
|
|
await checkBanner();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should reopen the app and have banner', async () => {
|
2021-04-01 19:27:46 +00:00
|
|
|
await device.launchApp({
|
|
|
|
permissions: { notifications: 'YES' },
|
|
|
|
newInstance: true
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2021-04-01 19:27:46 +00:00
|
|
|
await checkBanner();
|
|
|
|
});
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|