2020-03-30 20:19:01 +00:00
|
|
|
const {
|
|
|
|
expect, element, by, waitFor
|
|
|
|
} = require('detox');
|
2020-07-22 16:32:21 +00:00
|
|
|
const { navigateToLogin, login, sleep } = require('../../helpers/app');
|
|
|
|
|
|
|
|
const data = require('../../data');
|
|
|
|
const testuser = data.users.regular
|
2020-03-30 20:19:01 +00:00
|
|
|
|
|
|
|
async function waitForToast() {
|
2020-09-11 14:31:38 +00:00
|
|
|
await sleep(300);
|
2020-03-30 20:19:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
describe('Status screen', () => {
|
2020-07-22 16:32:21 +00:00
|
|
|
before(async () => {
|
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
await navigateToLogin();
|
|
|
|
await login(testuser.username, testuser.password);
|
|
|
|
|
2020-03-30 20:19:01 +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-custom-status'))).toBeVisible().withTimeout(2000);
|
|
|
|
|
|
|
|
await element(by.id('sidebar-custom-status')).tap();
|
|
|
|
await waitFor(element(by.id('status-view'))).toBeVisible().withTimeout(2000);
|
|
|
|
});
|
|
|
|
|
2020-07-22 16:32:21 +00:00
|
|
|
describe('Render', async () => {
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', async () => {
|
|
|
|
it('should change status', async () => {
|
2020-05-20 16:33:40 +00:00
|
|
|
await element(by.id('status-view-busy')).tap();
|
2020-10-30 13:59:44 +00:00
|
|
|
await waitFor(element(by.id('status-view-current-busy'))).toExist().withTimeout(2000);
|
2020-07-22 16:32:21 +00:00
|
|
|
});
|
2020-03-30 20:19:01 +00:00
|
|
|
|
2020-07-22 16:32:21 +00:00
|
|
|
it('should change status text', async () => {
|
2020-03-30 20:19:01 +00:00
|
|
|
await element(by.id('status-view-input')).replaceText('status-text-new');
|
|
|
|
await element(by.id('status-view-submit')).tap();
|
|
|
|
await waitForToast();
|
2020-05-20 16:33:40 +00:00
|
|
|
await waitFor(element(by.label('status-text-new').withAncestor(by.id('sidebar-custom-status')))).toBeVisible().withTimeout(2000);
|
2020-07-22 16:32:21 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|