identify element
1.新建Home.js
import React, { Component } from 'react';
import { StyleSheet, View, TextInput } from 'react-native';
export default class Home extends Component {
render() {
return (
<View style={styles.wrapper}>
<TextInput
testID={'username'}
style={{backgroundColor: 'gray', marginBottom: 35}}
placeholder={'Enter User Name'} />
<TextInput
testID={'password'}
style={{backgroundColor: 'gray'}}
placeholder={'Enter Password'} />
</View>
)
}
}
const styles = StyleSheet.create({
wrapper: {
flex:1,
justifyContent: 'center'
},
})2.撰寫test case


參考
Last updated