2019-06-11 14:01:40 +00:00
|
|
|
const {
|
|
|
|
device, expect, element, by, waitFor
|
|
|
|
} = require('detox');
|
2021-04-01 12:58:20 +00:00
|
|
|
const { navigateToLogin, login, tapBack } = require('../../helpers/app');
|
2020-07-22 16:32:21 +00:00
|
|
|
|
|
|
|
const data = require('../../data');
|
|
|
|
|
|
|
|
const testuser = data.users.regular
|
2019-06-11 14:01:40 +00:00
|
|
|
|
|
|
|
describe('Settings screen', () => {
|
|
|
|
before(async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
await navigateToLogin();
|
|
|
|
await login(testuser.username, testuser.password);
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
2019-06-11 14:01:40 +00:00
|
|
|
await element(by.id('rooms-list-view-sidebar')).tap();
|
|
|
|
await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000);
|
|
|
|
await waitFor(element(by.id('sidebar-settings'))).toBeVisible().withTimeout(2000);
|
|
|
|
await element(by.id('sidebar-settings')).tap();
|
|
|
|
await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Render', async() => {
|
|
|
|
it('should have settings view', async() => {
|
|
|
|
await expect(element(by.id('settings-view'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have language', async() => {
|
|
|
|
await expect(element(by.id('settings-view-language'))).toExist();
|
|
|
|
});
|
|
|
|
|
2020-10-30 18:31:04 +00:00
|
|
|
it('should have review app', async() => {
|
|
|
|
await expect(element(by.id('settings-view-review-app'))).toExist();
|
2019-06-11 14:01:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have share app', async() => {
|
|
|
|
await expect(element(by.id('settings-view-share-app'))).toExist();
|
|
|
|
});
|
|
|
|
|
2020-10-30 18:31:04 +00:00
|
|
|
it('should have default browser', async() => {
|
|
|
|
await expect(element(by.id('settings-view-default-browser'))).toExist();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have theme', async() => {
|
|
|
|
await expect(element(by.id('settings-view-theme'))).toExist();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have security and privacy', async() => {
|
|
|
|
await expect(element(by.id('settings-view-security-privacy'))).toExist();
|
|
|
|
});
|
|
|
|
|
2019-06-11 14:01:40 +00:00
|
|
|
it('should have licence', async() => {
|
|
|
|
await expect(element(by.id('settings-view-license'))).toExist();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have version no', async() => {
|
|
|
|
await expect(element(by.id('settings-view-version'))).toExist();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have server version', async() => {
|
|
|
|
await expect(element(by.id('settings-view-server-version'))).toExist();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-04-01 12:58:20 +00:00
|
|
|
describe('Usage', async() => {
|
2019-06-11 14:01:40 +00:00
|
|
|
it('should navigate to language view', async() => {
|
|
|
|
await element(by.id('settings-view-language')).tap();
|
|
|
|
await waitFor(element(by.id('language-view'))).toBeVisible().withTimeout(60000);
|
|
|
|
await expect(element(by.id('language-view-zh-CN'))).toExist();
|
|
|
|
await expect(element(by.id('language-view-de'))).toExist();
|
|
|
|
await expect(element(by.id('language-view-en'))).toExist();
|
|
|
|
await expect(element(by.id('language-view-fr'))).toExist();
|
|
|
|
await expect(element(by.id('language-view-pt-BR'))).toExist();
|
|
|
|
await expect(element(by.id('language-view-pt-PT'))).toExist();
|
|
|
|
await expect(element(by.id('language-view-ru'))).toExist();
|
2021-04-01 12:58:20 +00:00
|
|
|
await tapBack();
|
2019-06-11 14:01:40 +00:00
|
|
|
});
|
2021-04-01 12:58:20 +00:00
|
|
|
|
|
|
|
it('should tap clear cache and navigate to roomslistview', async() => {
|
|
|
|
await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000);
|
|
|
|
await element(by.id('settings-view-clear-cache')).tap();
|
|
|
|
await waitFor(element(by.text('This will clear all your offline data.'))).toExist().withTimeout(2000);
|
|
|
|
await element(by.label('Clear').and(by.type('_UIAlertControllerActionView'))).tap();
|
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000);
|
|
|
|
// Database was cleared, so the room shouldn't be there anymore while it's fetched again from the server
|
|
|
|
await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toNotExist().withTimeout(10000);
|
|
|
|
await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(10000);
|
|
|
|
})
|
2019-06-11 14:01:40 +00:00
|
|
|
});
|
|
|
|
});
|