Adding more tests

This commit is contained in:
Sofiya Tepikin
2019-07-31 12:56:47 +02:00
parent 48778c1959
commit 917bd8f7c4
6 changed files with 113 additions and 39 deletions
+8
View File
@@ -0,0 +1,8 @@
{
"globals": {
"expect": true,
"element": true,
"by": true,
"device": true,
}
}
+102 -32
View File
@@ -1,18 +1,18 @@
const isOnPage = async (page, parentPage) => {
await expect(
element(by.id('pageTitle').and(by.text(page)))
).toBeVisible();
).toBeVisible()
await expect(
element(
by.id('activeMenuItem').and(by.text(parentPage ? parentPage : page))
)
).toBeVisible();
).toBeVisible()
}
describe('Home Navigation', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
await device.reloadReactNative()
})
// TODO: clarify how to test that exiting from the app happened
// https://stackoverflow.com/questions/57133730/how-to-test-an-exit-app-scenario-using-detox
@@ -22,41 +22,111 @@ describe('Home Navigation', () => {
// });
it('should navigate to home on accepting the license agreement', async () => {
await expect(element(by.id('licensePage'))).toBeVisible();
await element(by.id('licenseOkButton')).tap();
await isOnPage('home');
});
it('should navigate to today cycle day page', async () => {
await element(by.text('add data for today')).tap();
await expect(
element(by.id('cycleDayTitleDate').and(by.text('today')))
).toBeVisible();
});
await expect(element(by.id('licensePage'))).toBeVisible()
await element(by.id('licenseOkButton')).tap()
await isOnPage('home')
})
it('should navigate to today bleeding symptom', async () => {
await element(by.text('track your period')).tap();
await element(by.text('track your period')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('bleeding')))
).toBeVisible();
).toBeVisible()
await expect(
element(by.id('symptomViewTitleDate').and(by.text('today')))
).toBeVisible();
});
).toBeVisible()
})
it('should navigate to chart to check your fertility', async () => {
await element(by.text('check your fertility')).tap();
await isOnPage('chart');
});
await element(by.text('check your fertility')).tap()
await isOnPage('chart')
})
it('should navigate to settings, its sub pages and back', async () => {
await element(by.id('menuItemSettings')).tap();
await isOnPage('settings');
await element(by.text('reminders')).tap();
await isOnPage('reminders', 'settings');
await element(by.id('backButton')).tap();
await element(by.text('nfp settings')).tap();
await isOnPage('nfp settings', 'settings');
await device.pressBack();
});
});
await element(by.id('menuItemSettings')).tap()
await isOnPage('settings')
await element(by.text('reminders')).tap()
await isOnPage('reminders', 'settings')
await element(by.id('backButton')).tap()
await element(by.text('nfp settings')).tap()
await isOnPage('nfp settings', 'settings')
await device.pressBack()
})
it('should navigate to today cycle day page and all its symptoms', async () => {
await element(by.text('add data for today')).tap()
await expect(
element(by.id('cycleDayTitleDate').and(by.text('today')))
).toBeVisible()
await element(by.id('drip-icon-bleeding')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('bleeding')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-temperature')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('temperature')))
).toBeVisible()
// first back press removes the focus from the field and the input keyboard
await device.pressBack()
// second back press goes back to the cycle day view
await device.pressBack()
await element(by.id('drip-icon-mucus')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('cervical mucus')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-cervix')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('cervix')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-desire')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('desire')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-sex')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('sex')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-pain')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('pain')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-mood')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('mood')))
).toBeVisible()
await device.pressBack()
await element(by.id('drip-icon-note')).tap()
await expect(
element(by.id('symptomViewTitleName').and(by.text('note')))
).toBeVisible()
await element(by.id('symptomInfoButton')).tap()
await expect(element(by.id('symptomInfoPopup'))).toBeVisible()
// first back press removes the focus from the field and the input keyboard
await device.pressBack()
// second back press goes back to the cycle day view
await device.pressBack()
await expect(
element(by.id('cycleDayTitleDate').and(by.text('today')))
).toBeVisible()
// waiting for a feedback on what should happen on pressing back
})
})