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 { TTextMatcher, platformTypes } from '../../helpers/app';
|
|
|
|
import data from '../../data';
|
2020-05-20 16:33:40 +00:00
|
|
|
|
|
|
|
describe('Onboarding', () => {
|
2022-09-12 14:51:33 +00:00
|
|
|
let alertButtonType: string;
|
|
|
|
let textMatcher: TTextMatcher;
|
2023-03-07 12:28:51 +00:00
|
|
|
beforeAll(async () => {
|
2020-07-15 16:28:34 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2021-12-02 13:19:15 +00:00
|
|
|
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
|
2021-09-23 14:17:53 +00:00
|
|
|
await waitFor(element(by.id('new-server-view')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(20000);
|
2020-05-20 16:33:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have onboarding screen', async () => {
|
2021-09-23 14:17:53 +00:00
|
|
|
await expect(element(by.id('new-server-view'))).toBeVisible();
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2020-05-20 16:33:40 +00:00
|
|
|
|
2023-05-10 20:22:18 +00:00
|
|
|
// it('should have "Join our open workspace"', async () => {
|
|
|
|
// await expect(element(by.id('new-server-view-open'))).toBeVisible();
|
|
|
|
// });
|
2020-05-20 16:33:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should enter an invalid server and get error', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('new-server-view-input')).replaceText('invalidtest');
|
|
|
|
await element(by.id('new-server-view-input')).tapReturnKey();
|
|
|
|
await waitFor(element(by[textMatcher]('Oops!')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by[textMatcher]('OK').and(by.type(alertButtonType))).tap();
|
2020-05-20 16:33:40 +00:00
|
|
|
});
|
|
|
|
|
2023-05-10 20:22:18 +00:00
|
|
|
// it('should tap on "Join our open workspace" and navigate', async () => {
|
|
|
|
// await element(by.id('new-server-view-open')).tap();
|
|
|
|
// await waitFor(element(by.id('workspace-view')))
|
|
|
|
// .toBeVisible()
|
|
|
|
// .withTimeout(60000);
|
|
|
|
// });
|
2020-05-20 16:33:40 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should enter a valid server without login services and navigate to login', async () => {
|
2020-05-20 16:33:40 +00:00
|
|
|
await device.launchApp({ newInstance: true });
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('new-server-view')))
|
|
|
|
.toBeVisible()
|
2021-09-23 14:17:53 +00:00
|
|
|
.withTimeout(5000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('new-server-view-input')).replaceText(data.server);
|
|
|
|
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);
|
2020-05-20 16:33:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|