diff --git a/components/header/back-button.js b/components/header/back-button.js index db5e3e1..be82802 100644 --- a/components/header/back-button.js +++ b/components/header/back-button.js @@ -13,9 +13,9 @@ export default function BackButtonHeader(props) { style={styles.accentCircle} left={props.middle - styles.accentCircle.width / 2} /> - + - + {props.title} diff --git a/components/header/cycle-day.js b/components/header/cycle-day.js index 0cb3252..33abfb1 100644 --- a/components/header/cycle-day.js +++ b/components/header/cycle-day.js @@ -14,7 +14,7 @@ export default function CycleDayHeader({ date, ...props }) { /> - + {formatDate(date)} {props.cycleDayNumber && diff --git a/components/header/navigation-arrow.js b/components/header/navigation-arrow.js index b574142..336e2f6 100644 --- a/components/header/navigation-arrow.js +++ b/components/header/navigation-arrow.js @@ -25,6 +25,7 @@ export default function NavigationArrow(props) { - + {props.title} - + {formatDate(props.date)} diff --git a/components/menu.js b/components/menu.js index 26a752d..3664e15 100644 --- a/components/menu.js +++ b/components/menu.js @@ -54,7 +54,10 @@ const MenuItem = ({ icon, labelKey, active, onPress }) => { onPress={onPress} > - + {menuTitlesLowerCase[labelKey]} diff --git a/e2e/firstTest.spec.js b/e2e/firstTest.spec.js deleted file mode 100644 index 364417f..0000000 --- a/e2e/firstTest.spec.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('Example', () => { - beforeEach(async () => { - await device.reloadReactNative(); - }); - 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 expect( - element(by.id('pageTitle').and(by.text('home'))) - ).toBeVisible(); - }); -}); diff --git a/e2e/homeNavigation.spec.js b/e2e/homeNavigation.spec.js new file mode 100644 index 0000000..4d7d1b0 --- /dev/null +++ b/e2e/homeNavigation.spec.js @@ -0,0 +1,62 @@ +const isOnPage = async (page, parentPage) => { + await expect( + element(by.id('pageTitle').and(by.text(page))) + ).toBeVisible(); + await expect( + element( + by.id('activeMenuItem').and(by.text(parentPage ? parentPage : page)) + ) + ).toBeVisible(); +} + +describe('Home Navigation', () => { + beforeEach(async () => { + 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 + // it('should exit the app when license agreement declined', async () => { + // await expect(element(by.id('licensePage'))).toBeVisible(); + // await element(by.id('licenseOkCance')).tap(); + // }); + + 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(); + }); + + it('should navigate to today bleeding symptom', async () => { + await element(by.text('track your period')).tap(); + await expect( + element(by.id('symptomViewTitleName').and(by.text('bleeding'))) + ).toBeVisible(); + await expect( + element(by.id('symptomViewTitleDate').and(by.text('today'))) + ).toBeVisible(); + }); + + it('should navigate to chart to check your fertility', async () => { + 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(); + }); +});