2022-09-12 14:51:33 +00:00
|
|
|
import { expect } from 'detox';
|
|
|
|
|
|
|
|
import data from '../../data';
|
|
|
|
import { navigateToLogin, platformTypes, TTextMatcher } from '../../helpers/app';
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
describe('Forgot password 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 () => {
|
2021-06-11 18:23:43 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2021-12-02 13:19:15 +00:00
|
|
|
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
|
2020-05-20 16:33:40 +00:00
|
|
|
await navigateToLogin();
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('login-view-forgot-password')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('forgot-password-view')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have forgot password screen', async () => {
|
2020-05-20 16:33:40 +00:00
|
|
|
await expect(element(by.id('forgot-password-view'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2019-05-28 13:03:08 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have email input', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await expect(element(by.id('forgot-password-view-email'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have submit button', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await expect(element(by.id('forgot-password-view-submit'))).toBeVisible();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should reset password and navigate to login', async () => {
|
2020-07-15 16:28:34 +00:00
|
|
|
await element(by.id('forgot-password-view-email')).replaceText(data.users.existing.email);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('forgot-password-view-submit')).tap();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('OK')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('OK').and(by.type(alertButtonType))).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('login-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|