2022-09-12 14:51:33 +00:00
|
|
|
import { expect } from 'detox';
|
2021-12-02 13:19:15 +00:00
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
import { navigateToLogin, login, platformTypes, TTextMatcher } from '../../helpers/app';
|
|
|
|
import data from '../../data';
|
2020-07-22 16:32:21 +00:00
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
const testuser = data.users.regular;
|
2019-06-11 14:01:40 +00:00
|
|
|
|
|
|
|
describe('Settings screen', () => {
|
2022-09-12 14:51:33 +00:00
|
|
|
let alertButtonType: string;
|
|
|
|
let textMatcher: TTextMatcher;
|
2021-09-13 20:41:05 +00:00
|
|
|
before(async () => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2021-12-02 13:19:15 +00:00
|
|
|
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
|
2020-07-22 16:32:21 +00:00
|
|
|
await navigateToLogin();
|
|
|
|
await login(testuser.username, testuser.password);
|
2021-09-13 20:41:05 +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();
|
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);
|
2019-06-11 14:01:40 +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);
|
2019-06-11 14:01:40 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have settings view', async () => {
|
2019-06-11 14:01:40 +00:00
|
|
|
await expect(element(by.id('settings-view'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have language', async () => {
|
2019-06-11 14:01:40 +00:00
|
|
|
await expect(element(by.id('settings-view-language'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have review app', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.id('settings-view-review-app'))).toExist();
|
2019-06-11 14:01:40 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have share app', async () => {
|
2019-06-11 14:01:40 +00:00
|
|
|
await expect(element(by.id('settings-view-share-app'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have default browser', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.id('settings-view-default-browser'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have theme', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.id('settings-view-theme'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have security and privacy', async () => {
|
2020-10-30 18:31:04 +00:00
|
|
|
await expect(element(by.id('settings-view-security-privacy'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have licence', async () => {
|
2019-06-11 14:01:40 +00:00
|
|
|
await expect(element(by.id('settings-view-license'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have version no', async () => {
|
2019-06-11 14:01:40 +00:00
|
|
|
await expect(element(by.id('settings-view-version'))).toExist();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have server version', async () => {
|
2019-06-11 14:01:40 +00:00
|
|
|
await expect(element(by.id('settings-view-server-version'))).toExist();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should tap clear cache and navigate to roomslistview', async () => {
|
|
|
|
await waitFor(element(by.id('settings-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2021-04-01 12:58:20 +00:00
|
|
|
await element(by.id('settings-view-clear-cache')).tap();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('This will clear all your offline data.')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Clear').and(by.type(alertButtonType))).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await waitFor(element(by.id(`rooms-list-view-item-${data.groups.private.name}`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2019-06-11 14:01:40 +00:00
|
|
|
});
|
|
|
|
});
|