Adds test for data deletion
This commit is contained in:
@@ -35,9 +35,10 @@ class SymptomView extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
this.values = this.props.values
|
||||||
const shouldShowDelete = this.checkIfHasValuesToDelete()
|
const shouldShowDelete = this.checkIfHasValuesToDelete()
|
||||||
if (shouldShowDelete !== this.state.shouldShowDelete) {
|
if (shouldShowDelete !== this.state.shouldShowDelete) {
|
||||||
this.setState({ shouldShowDelete: this.checkIfHasValuesToDelete() })
|
this.setState({ shouldShowDelete })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default function DeleteIcon({ handleDelete }) {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={handleDelete}
|
onPress={handleDelete}
|
||||||
style={styles.headerDeleteButton}
|
style={styles.headerDeleteButton}
|
||||||
|
testID="deleteIcon"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
name="delete"
|
name="delete"
|
||||||
|
|||||||
@@ -108,6 +108,19 @@ describe('Symptom Data Input', () => {
|
|||||||
console.log(
|
console.log(
|
||||||
'This test a bit flaky. console.log apparently helps to fix it.'
|
'This test a bit flaky. console.log apparently helps to fix it.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await goBack()
|
||||||
|
await expect(element(by.text(expectedSymptomSummary))).toExist()
|
||||||
|
|
||||||
|
// Testing here additionally the deletion of data
|
||||||
|
await navigateToSymptomView(symptom)
|
||||||
|
await element(by.id('deleteIcon')).tap()
|
||||||
|
await element(by.text('YES, I AM SURE')).tap()
|
||||||
|
await expect(element(by.text(expectedSymptomSummary))).toNotExist()
|
||||||
|
|
||||||
|
await navigateToSymptomView(symptom)
|
||||||
|
await enterTemperature()
|
||||||
|
|
||||||
break
|
break
|
||||||
case 'note':
|
case 'note':
|
||||||
await enterNote()
|
await enterNote()
|
||||||
@@ -127,4 +140,5 @@ describe('Symptom Data Input', () => {
|
|||||||
await expect(element(by.text(expectedSymptomSummary))).toExist()
|
await expect(element(by.text(expectedSymptomSummary))).toExist()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user