Adding more tests
This commit is contained in:
@@ -278,6 +278,7 @@ class SymptomBox extends Component {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={this.props.onPress}
|
onPress={this.props.onPress}
|
||||||
disabled={this.props.disabled}
|
disabled={this.props.disabled}
|
||||||
|
testID={this.props.iconName}
|
||||||
>
|
>
|
||||||
<View style={[styles.symptomBox, boxActive, disabledStyle]}>
|
<View style={[styles.symptomBox, boxActive, disabledStyle]}>
|
||||||
<DripIcon name={this.props.iconName} size={50} color={hasData ? 'white' : 'black'}/>
|
<DripIcon name={this.props.iconName} size={50} color={hasData ? 'white' : 'black'}/>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export default function InfoSymptom(props) {
|
|||||||
return (
|
return (
|
||||||
<View style={styles.infoPopUpWrapper}>
|
<View style={styles.infoPopUpWrapper}>
|
||||||
<View style={styles.dimmed}></View>
|
<View style={styles.dimmed}></View>
|
||||||
<View style={styles.infoPopUp}>
|
<View style={styles.infoPopUp} testID="symptomInfoPopup">
|
||||||
<TouchableOpacity onPress={props.close} style={styles.infoSymptomClose}>
|
<TouchableOpacity onPress={props.close} style={styles.infoSymptomClose}>
|
||||||
<Icon name='close' {...iconStyles.infoPopUpClose}/>
|
<Icon name='close' {...iconStyles.infoPopUpClose}/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ export default class SymptomView extends Component {
|
|||||||
this.setState({showInfo: true})
|
this.setState({showInfo: true})
|
||||||
}}
|
}}
|
||||||
style={styles.infoButtonSymptomView}
|
style={styles.infoButtonSymptomView}
|
||||||
|
testID="symptomInfoButton"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
name="info-with-circle"
|
name="info-with-circle"
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"globals": {
|
||||||
|
"expect": true,
|
||||||
|
"element": true,
|
||||||
|
"by": true,
|
||||||
|
"device": true,
|
||||||
|
}
|
||||||
|
}
|
||||||
+102
-32
@@ -1,18 +1,18 @@
|
|||||||
const isOnPage = async (page, parentPage) => {
|
const isOnPage = async (page, parentPage) => {
|
||||||
await expect(
|
await expect(
|
||||||
element(by.id('pageTitle').and(by.text(page)))
|
element(by.id('pageTitle').and(by.text(page)))
|
||||||
).toBeVisible();
|
).toBeVisible()
|
||||||
await expect(
|
await expect(
|
||||||
element(
|
element(
|
||||||
by.id('activeMenuItem').and(by.text(parentPage ? parentPage : page))
|
by.id('activeMenuItem').and(by.text(parentPage ? parentPage : page))
|
||||||
)
|
)
|
||||||
).toBeVisible();
|
).toBeVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Home Navigation', () => {
|
describe('Home Navigation', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await device.reloadReactNative();
|
await device.reloadReactNative()
|
||||||
});
|
})
|
||||||
|
|
||||||
// TODO: clarify how to test that exiting from the app happened
|
// 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
|
// 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 () => {
|
it('should navigate to home on accepting the license agreement', async () => {
|
||||||
await expect(element(by.id('licensePage'))).toBeVisible();
|
await expect(element(by.id('licensePage'))).toBeVisible()
|
||||||
await element(by.id('licenseOkButton')).tap();
|
await element(by.id('licenseOkButton')).tap()
|
||||||
await isOnPage('home');
|
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 () => {
|
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(
|
await expect(
|
||||||
element(by.id('symptomViewTitleName').and(by.text('bleeding')))
|
element(by.id('symptomViewTitleName').and(by.text('bleeding')))
|
||||||
).toBeVisible();
|
).toBeVisible()
|
||||||
await expect(
|
await expect(
|
||||||
element(by.id('symptomViewTitleDate').and(by.text('today')))
|
element(by.id('symptomViewTitleDate').and(by.text('today')))
|
||||||
).toBeVisible();
|
).toBeVisible()
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should navigate to chart to check your fertility', async () => {
|
it('should navigate to chart to check your fertility', async () => {
|
||||||
await element(by.text('check your fertility')).tap();
|
await element(by.text('check your fertility')).tap()
|
||||||
await isOnPage('chart');
|
await isOnPage('chart')
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should navigate to settings, its sub pages and back', async () => {
|
it('should navigate to settings, its sub pages and back', async () => {
|
||||||
await element(by.id('menuItemSettings')).tap();
|
await element(by.id('menuItemSettings')).tap()
|
||||||
await isOnPage('settings');
|
await isOnPage('settings')
|
||||||
await element(by.text('reminders')).tap();
|
await element(by.text('reminders')).tap()
|
||||||
await isOnPage('reminders', 'settings');
|
await isOnPage('reminders', 'settings')
|
||||||
await element(by.id('backButton')).tap();
|
await element(by.id('backButton')).tap()
|
||||||
await element(by.text('nfp settings')).tap();
|
await element(by.text('nfp settings')).tap()
|
||||||
await isOnPage('nfp settings', 'settings');
|
await isOnPage('nfp settings', 'settings')
|
||||||
await device.pressBack();
|
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
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
@@ -97,12 +97,6 @@
|
|||||||
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
|
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
|
||||||
"type": "android.emulator",
|
"type": "android.emulator",
|
||||||
"name": "Nexus_5X_API_28"
|
"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"
|
"test-runner": "mocha"
|
||||||
|
|||||||
Reference in New Issue
Block a user