Add e2e tests, bug fixes for testIDs (#22537)

Summary:
This PR adds e2e tests for the Picker and DatePicker components.

While writing these tests, I also found and fixed two bugs where we wern't passing the `testID` down to the native components, so detox couldn't look them up. This confirms what was mentioned by rotemmiz [here](https://github.com/wix/Detox/issues/798#issuecomment-401412276)
Pull Request resolved: https://github.com/facebook/react-native/pull/22537

Reviewed By: cpojer

Differential Revision: D13371307

Pulled By: rickhanlonii

fbshipit-source-id: a4dfcdb5913645bceca0c7353328eeb9ad0f6558
This commit is contained in:
Rick Hanlon
2018-12-07 14:52:06 -08:00
committed by Facebook Github Bot
parent cf0dd8ba78
commit 9fdbf6029e
6 changed files with 107 additions and 2 deletions

View File

@@ -148,6 +148,7 @@ class DatePickerIOS extends React.Component<Props> {
return (
<View style={props.style}>
<RCTDatePickerIOS
testID={props.testID}
ref={picker => {
this._picker = picker;
}}

View File

@@ -47,6 +47,7 @@ type RCTPickerIOSType = Class<
onStartShouldSetResponder: () => boolean,
selectedIndex: number,
style?: ?TextStyleProp,
testID?: ?string,
|}>,
>,
>;
@@ -114,6 +115,7 @@ class PickerIOS extends React.Component<Props, State> {
ref={picker => {
this._picker = picker;
}}
testID={this.props.testID}
style={[styles.pickerIOS, this.props.itemStyle]}
items={this.state.items}
selectedIndex={this.state.selectedIndex}