diff --git a/components/cycle-day/cycle-day-overview.js b/components/cycle-day/cycle-day-overview.js index 0ab4526..407aac2 100644 --- a/components/cycle-day/cycle-day-overview.js +++ b/components/cycle-day/cycle-day-overview.js @@ -278,6 +278,7 @@ class SymptomBox extends Component { diff --git a/components/cycle-day/symptoms/info-symptom.js b/components/cycle-day/symptoms/info-symptom.js index e21c7ad..887b229 100644 --- a/components/cycle-day/symptoms/info-symptom.js +++ b/components/cycle-day/symptoms/info-symptom.js @@ -9,7 +9,7 @@ export default function InfoSymptom(props) { return ( - + diff --git a/components/cycle-day/symptoms/symptom-view.js b/components/cycle-day/symptoms/symptom-view.js index 28ddf4b..d78b995 100644 --- a/components/cycle-day/symptoms/symptom-view.js +++ b/components/cycle-day/symptoms/symptom-view.js @@ -78,6 +78,7 @@ export default class SymptomView extends Component { this.setState({showInfo: true}) }} style={styles.infoButtonSymptomView} + testID="symptomInfoButton" > { 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 + + }) +}) diff --git a/package.json b/package.json index f2dcc74..2194d0c 100644 --- a/package.json +++ b/package.json @@ -97,12 +97,6 @@ "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", "type": "android.emulator", "name": "Nexus_5X_API_28" - }, - "android.emu.release": { - "binaryPath": "android/app/build/outputs/apk/release/app-release.apk", - "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..", - "type": "android.emulator", - "name": "Nexus_5X_API_26" } }, "test-runner": "mocha"