Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: perform actions on UIPickerView #605

Merged
merged 21 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions detox/test/e2e/s-datePicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('DatePicker', () => {
beforeEach(async () => {
await device.reloadReactNative();
});

beforeEach(async () => {
await element(by.text('DatePicker')).tap();
});

it('datePicker and dateLabel should be visible', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary.

await expect(element(by.type('UIPickerView'))).toBeVisible();
await expect(element(by.id('timeLabel'))).toBeVisible();
});

it('datePicker should be scroll and change time', async () => {
await element(by.type('UIPickerView')).setColumnToValue(1,"6");
await element(by.type('UIPickerView')).setColumnToValue(2,"34");
await expect(element(by.id("timeLabel"))).toHaveText('choosenTime is 6:34');
});

});

60 changes: 2 additions & 58 deletions detox/test/ios/example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -328,34 +328,6 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
D58447AF204E9C6000248543 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EBF21BDC1FC498900052F4D5;
remoteInfo = jsinspector;
};
D58447B1204E9C6000248543 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5;
remoteInfo = "jsinspector-tvOS";
};
D58447B3204E9C6000248543 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
remoteInfo = privatedata;
};
D58447B5204E9C6000248543 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
remoteInfo = "privatedata-tvOS";
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -1060,34 +1032,6 @@
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
D58447B0204E9C6000248543 /* libjsinspector.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjsinspector.a;
remoteRef = D58447AF204E9C6000248543 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
D58447B2204E9C6000248543 /* libjsinspector-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjsinspector-tvOS.a";
remoteRef = D58447B1204E9C6000248543 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
D58447B4204E9C6000248543 /* libprivatedata.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libprivatedata.a;
remoteRef = D58447B3204E9C6000248543 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
D58447B6204E9C6000248543 /* libprivatedata-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libprivatedata-tvOS.a";
remoteRef = D58447B5204E9C6000248543 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down Expand Up @@ -1193,7 +1137,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = S3GLW74Y8N;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why these changes are going in?
Please revert it. The entire project,pbxproj file changes seem to me like something that should not have been committed.

INFOPLIST_FILE = example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1210,7 +1154,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = S3GLW74Y8N;
INFOPLIST_FILE = example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
28 changes: 27 additions & 1 deletion detox/test/src/Screens/DatePickerScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,37 @@ export default class DatePickerScreen extends Component {

constructor(props) {
super(props);
this.state = {
chosenDate: new Date()
}
this._setDate = this._setDate.bind(this);
}

_setDate(newDate) {
this.setState({
chosenDate :newDate
})
}

getTime() {
minutes = this.state.chosenDate.getMinutes()
hour = this.state.chosenDate.getHours()
if( hour > 12 ) {
hour = hour - 12;
}
return `${hour}:${minutes}`
}

render() {
return (
<View style={{flex: 1, paddingTop: 20, justifyContent: 'center', alignItems: 'center'}}>
<Text style = {styles.dateText} testID='timeLabel'>
{"choosenTime is " + this.getTime()}
</Text>
<DatePickerIOS
style = {styles.datePicker}
date = {new Date()}
date = {this.state.chosenDate}
onDateChange={this._setDate}
/>
</View>
);
Expand All @@ -29,5 +52,8 @@ const styles = StyleSheet.create({
width:'100%',
height:200,
backgroundColor:'green',
},
dateText: {
textAlign: 'center',
}
});
2 changes: 1 addition & 1 deletion detox/test/src/Screens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export {
NetworkScreen,
AnimationsScreen,
LocationScreen,
ShakeScreen
ShakeScreen,
DatePickerScreen
};