vn-verdnaturachat/e2e/tests/onboarding/03-forgotpassword.spec.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-05-23 13:39:18 +00:00
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('../../data');
const { navigateToLogin } = require('../../helpers/app');
2018-05-23 13:39:18 +00:00
describe('Forgot password screen', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToLogin();
2018-05-23 13:39:18 +00:00
await element(by.id('login-view-forgot-password')).tap();
await waitFor(element(by.id('forgot-password-view'))).toExist().withTimeout(2000);
2018-05-23 13:39:18 +00:00
});
describe('Render', async() => {
it('should have forgot password screen', async() => {
await expect(element(by.id('forgot-password-view'))).toExist();
2018-05-23 13:39:18 +00:00
});
2018-05-23 13:39:18 +00:00
it('should have email input', async() => {
await expect(element(by.id('forgot-password-view-email'))).toBeVisible();
});
it('should have submit button', async() => {
await expect(element(by.id('forgot-password-view-submit'))).toBeVisible();
});
});
describe('Usage', async() => {
it('should reset password and navigate to login', async() => {
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();
await waitFor(element(by.text('OK'))).toExist().withTimeout(10000);
await element(by.text('OK')).tap();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(60000);
});
});
});