2023-03-07 12:28:51 +00:00
|
|
|
import { device, waitFor, element, by, expect } from 'detox';
|
2022-09-12 14:51:33 +00:00
|
|
|
|
|
|
|
import { navigateToLogin, login, sleep } from '../../helpers/app';
|
2023-03-07 12:28:51 +00:00
|
|
|
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
|
2020-03-30 20:19:01 +00:00
|
|
|
|
|
|
|
describe('Status screen', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
let user: ITestUser;
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
user = await createRandomUser();
|
2020-07-22 16:32:21 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2020-07-22 16:32:21 +00:00
|
|
|
|
2020-03-30 20:19:01 +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);
|
2022-05-31 16:50:10 +00:00
|
|
|
await waitFor(element(by.id('sidebar-custom-status-online')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-03-30 20:19:01 +00:00
|
|
|
|
2022-05-31 16:50:10 +00:00
|
|
|
await element(by.id('sidebar-custom-status-online')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('status-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-03-30 20:19:01 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have status input', async () => {
|
2020-05-20 16:33:40 +00:00
|
|
|
await expect(element(by.id('status-view-input'))).toBeVisible();
|
|
|
|
await expect(element(by.id('status-view-online'))).toExist();
|
2020-03-30 20:19:01 +00:00
|
|
|
await expect(element(by.id('status-view-busy'))).toExist();
|
|
|
|
await expect(element(by.id('status-view-away'))).toExist();
|
|
|
|
await expect(element(by.id('status-view-offline'))).toExist();
|
2020-07-22 16:32:21 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should change status', async () => {
|
2020-05-20 16:33:40 +00:00
|
|
|
await element(by.id('status-view-busy')).tap();
|
2022-05-31 16:50:10 +00:00
|
|
|
await element(by.id('status-view-submit')).tap();
|
|
|
|
await sleep(3000); // Wait until the loading hide
|
|
|
|
await waitFor(element(by.id('rooms-list-view-sidebar')))
|
|
|
|
.toBeVisible()
|
2021-09-13 20:41:05 +00:00
|
|
|
.withTimeout(2000);
|
2022-05-31 16:50:10 +00:00
|
|
|
await waitFor(element(by.id('sidebar-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await waitFor(element(by.id('sidebar-custom-status-busy')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('sidebar-custom-status-busy')).tap();
|
2020-07-22 16:32:21 +00:00
|
|
|
});
|
2020-03-30 20:19:01 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should change status text', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('status-view-input')).replaceText('status-text-new');
|
2020-03-30 20:19:01 +00:00
|
|
|
await element(by.id('status-view-submit')).tap();
|
2022-05-31 16:50:10 +00:00
|
|
|
await sleep(3000); // Wait until the loading hide
|
|
|
|
await waitFor(element(by.label('status-text-new')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
2022-05-31 16:50:10 +00:00
|
|
|
.withTimeout(5000);
|
2020-07-22 16:32:21 +00:00
|
|
|
});
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|