From f7082947e2f25a0dad6be8b54eb18d8350319e89 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 6 Mar 2018 16:15:43 +0200 Subject: [PATCH 01/16] functionality for datePicker IOS --- detox/.vscode/settings.json | 3 +- detox/test/e2e/p-datePicker.js | 17 +++++ detox/test/e2e/r-crash-handling.js | 21 ++++++ .../ios/example.xcodeproj/project.pbxproj | 64 ++++++++++++++++++- detox/test/ios/example/Info.plist | 12 ++-- detox/test/src/Screens/DatePickerScreen.js | 34 ++++++++++ detox/test/src/Screens/index.js | 4 +- detox/test/src/app.js | 1 + 8 files changed, 146 insertions(+), 10 deletions(-) create mode 100644 detox/test/e2e/p-datePicker.js create mode 100644 detox/test/e2e/r-crash-handling.js create mode 100644 detox/test/src/Screens/DatePickerScreen.js diff --git a/detox/.vscode/settings.json b/detox/.vscode/settings.json index a92f73ffdf..187a47f79d 100644 --- a/detox/.vscode/settings.json +++ b/detox/.vscode/settings.json @@ -1,3 +1,4 @@ { - "eslint.enable": false + "eslint.enable": false, + "git.ignoreLimitWarning": true } \ No newline at end of file diff --git a/detox/test/e2e/p-datePicker.js b/detox/test/e2e/p-datePicker.js new file mode 100644 index 0000000000..d5988da7e4 --- /dev/null +++ b/detox/test/e2e/p-datePicker.js @@ -0,0 +1,17 @@ +describe('DatePicker', () => { + beforeEach(async () => { + await device.reloadReactNative(); + }); + + beforeEach(async () => { + await element(by.text('DatePicker')).tap(); + }); + + it('check and scroll datePicker', async () => { + await expect(element(by.type('UIPickerView'))).toBeVisible(); + await expect(element(by.type('UIPickerView')).setColumnToValue(1,"6")); + await expect(element(by.type('UIPickerView')).setColumnToValue(2,"34")); + }); + + }); + \ No newline at end of file diff --git a/detox/test/e2e/r-crash-handling.js b/detox/test/e2e/r-crash-handling.js new file mode 100644 index 0000000000..89a8d7be53 --- /dev/null +++ b/detox/test/e2e/r-crash-handling.js @@ -0,0 +1,21 @@ +describe(':ios: Crash Handling', () => { + + it('Should throw error upon app crash', async () => { + await device.reloadReactNative(); + let failed = false; + + try { + await element(by.text('Crash')).tap(); + await element(by.text('Crash')).tap(); + } catch (ex) { + failed = true; + } + + if (!failed) throw new Error('Test should have thrown an error, but did not'); + }); + + it('Should recover from app crash', async () => { + await device.launchApp({newInstance: false}); + await expect(element(by.text('Sanity'))).toBeVisible(); + }); +}); \ No newline at end of file diff --git a/detox/test/ios/example.xcodeproj/project.pbxproj b/detox/test/ios/example.xcodeproj/project.pbxproj index 5db232185a..328736a371 100644 --- a/detox/test/ios/example.xcodeproj/project.pbxproj +++ b/detox/test/ios/example.xcodeproj/project.pbxproj @@ -300,6 +300,34 @@ 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 */ @@ -491,10 +519,14 @@ 39A34C5D1E30ED3600BEBB59 /* libcxxreact.a */, 39A34C5F1E30ED3600BEBB59 /* libjschelpers.a */, 39A34C611E30ED3600BEBB59 /* libjschelpers.a */, + D58447B0204E9C6000248543 /* libjsinspector.a */, + D58447B2204E9C6000248543 /* libjsinspector-tvOS.a */, 4644B8651F897583003223D4 /* libthird-party.a */, 4644B8671F897583003223D4 /* libthird-party.a */, 4644B8691F897583003223D4 /* libdouble-conversion.a */, 4644B86B1F897583003223D4 /* libdouble-conversion.a */, + D58447B4204E9C6000248543 /* libprivatedata.a */, + D58447B6204E9C6000248543 /* libprivatedata-tvOS.a */, ); name = Products; sourceTree = ""; @@ -972,6 +1004,34 @@ 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 */ @@ -1085,7 +1145,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.example; PRODUCT_NAME = example; }; name = Debug; @@ -1102,7 +1162,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.example; PRODUCT_NAME = example; }; name = Release; diff --git a/detox/test/ios/example/Info.plist b/detox/test/ios/example/Info.plist index d90b018dc0..b13b3c3aac 100644 --- a/detox/test/ios/example/Info.plist +++ b/detox/test/ios/example/Info.plist @@ -40,14 +40,12 @@ NSAllowsArbitraryLoads + NSCalendarsUsageDescription + NSLocationWhenInUseUsageDescription UILaunchStoryboardName LaunchScreen - WKBackgroundModes - - remote-notification - UIRequiredDeviceCapabilities armv7 @@ -58,9 +56,11 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - NSCalendarsUsageDescription - UIViewControllerBasedStatusBarAppearance + WKBackgroundModes + + remote-notification + diff --git a/detox/test/src/Screens/DatePickerScreen.js b/detox/test/src/Screens/DatePickerScreen.js new file mode 100644 index 0000000000..bf0a947178 --- /dev/null +++ b/detox/test/src/Screens/DatePickerScreen.js @@ -0,0 +1,34 @@ +import React, { Component } from 'react'; +import { + Text, + View, + StyleSheet, + DatePickerIOS +} from 'react-native'; + +export default class DatePickerScreen extends Component { + + constructor(props) { + super(props); + } + + render() { + return ( + + + + ); + } +} + +const styles = StyleSheet.create({ + datePicker: { + width:'100%', + height:200, + backgroundColor:'green', + } +}); diff --git a/detox/test/src/Screens/index.js b/detox/test/src/Screens/index.js index decc414254..bce6d149b0 100644 --- a/detox/test/src/Screens/index.js +++ b/detox/test/src/Screens/index.js @@ -11,6 +11,7 @@ import Permissions from './Permissions'; import NetworkScreen from './NetworkScreen'; import AnimationsScreen from './AnimationsScreen'; import LocationScreen from './LocationScreen'; +import DatePickerScreen from './DatePickerScreen' export { SanityScreen, @@ -25,5 +26,6 @@ export { Permissions, NetworkScreen, AnimationsScreen, - LocationScreen + LocationScreen, + DatePickerScreen }; diff --git a/detox/test/src/app.js b/detox/test/src/app.js index 1106b3422f..f23acdfbbe 100644 --- a/detox/test/src/app.js +++ b/detox/test/src/app.js @@ -84,6 +84,7 @@ class example extends Component { {this.renderScreenButton('Network', Screens.NetworkScreen)} {this.renderScreenButton('Animations', Screens.AnimationsScreen)} {this.renderScreenButton('Location', Screens.LocationScreen)} + {this.renderScreenButton('DatePicker', Screens.DatePickerScreen)} {this.renderButton('Crash', () => {throw new Error('Simulated Crash')})} ); From 41e603426a59540b1a8b1835d31e43322933cf1b Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 6 Mar 2018 16:16:34 +0200 Subject: [PATCH 02/16] current work --- detox/test/e2e/p-crash-handling.js | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 detox/test/e2e/p-crash-handling.js diff --git a/detox/test/e2e/p-crash-handling.js b/detox/test/e2e/p-crash-handling.js deleted file mode 100644 index 89a8d7be53..0000000000 --- a/detox/test/e2e/p-crash-handling.js +++ /dev/null @@ -1,21 +0,0 @@ -describe(':ios: Crash Handling', () => { - - it('Should throw error upon app crash', async () => { - await device.reloadReactNative(); - let failed = false; - - try { - await element(by.text('Crash')).tap(); - await element(by.text('Crash')).tap(); - } catch (ex) { - failed = true; - } - - if (!failed) throw new Error('Test should have thrown an error, but did not'); - }); - - it('Should recover from app crash', async () => { - await device.launchApp({newInstance: false}); - await expect(element(by.text('Sanity'))).toBeVisible(); - }); -}); \ No newline at end of file From 2eaabda1d56e6a0bacaa2c8a87b24d48edca3d18 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 6 Mar 2018 16:27:54 +0200 Subject: [PATCH 03/16] add setColumnToValue method --- detox/src/ios/expect.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/detox/src/ios/expect.js b/detox/src/ios/expect.js index ac7e7bd953..c1d4ecb10d 100644 --- a/detox/src/ios/expect.js +++ b/detox/src/ios/expect.js @@ -154,6 +154,13 @@ class SwipeAction extends Action { } } +class ScrollColumnToValue extends Action { + constructor(column,value) { + super(); + this._call = invoke.callDirectly(GreyActions.actionForSetPickerColumnToValue(column,value)) + } +} + class Interaction { async execute() { //if (!this._call) throw new Error(`Interaction.execute cannot find a valid _call, got ${typeof this._call}`); @@ -284,6 +291,9 @@ class Element { this._selectElementWithMatcher(this._originalMatcher._avoidProblematicReactNativeElements()); return await new ActionInteraction(this, new SwipeAction(direction, speed, percentage)).execute(); } + async setColumnToValue(column,value) { + return await new ActionInteraction(this, new ScrollColumnToValue(column, value)).execute(); + } } class Expect {} From 1b7cb17bbdb3d48acb3b47daa2077c89ccd46e60 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 6 Mar 2018 16:34:45 +0200 Subject: [PATCH 04/16] delete testID --- detox/test/src/Screens/DatePickerScreen.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/detox/test/src/Screens/DatePickerScreen.js b/detox/test/src/Screens/DatePickerScreen.js index bf0a947178..e43427be64 100644 --- a/detox/test/src/Screens/DatePickerScreen.js +++ b/detox/test/src/Screens/DatePickerScreen.js @@ -15,10 +15,9 @@ export default class DatePickerScreen extends Component { render() { return ( - ); From 1a4d56f1ddb95f79ffc1183dc8f3021aa667e104 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 13 Mar 2018 09:16:52 +0200 Subject: [PATCH 05/16] add description for ActionsOnElement, delete expect for action --- detox/test/e2e/p-datePicker.js | 4 ++-- docs/APIRef.ActionsOnElement.md | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/detox/test/e2e/p-datePicker.js b/detox/test/e2e/p-datePicker.js index d5988da7e4..a34bd75231 100644 --- a/detox/test/e2e/p-datePicker.js +++ b/detox/test/e2e/p-datePicker.js @@ -9,8 +9,8 @@ describe('DatePicker', () => { it('check and scroll datePicker', async () => { await expect(element(by.type('UIPickerView'))).toBeVisible(); - await expect(element(by.type('UIPickerView')).setColumnToValue(1,"6")); - await expect(element(by.type('UIPickerView')).setColumnToValue(2,"34")); + await element(by.type('UIPickerView')).setColumnToValue(1,"6"); + await element(by.type('UIPickerView')).setColumnToValue(2,"34"); }); }); diff --git a/docs/APIRef.ActionsOnElement.md b/docs/APIRef.ActionsOnElement.md index b3f465647c..e7a652be35 100644 --- a/docs/APIRef.ActionsOnElement.md +++ b/docs/APIRef.ActionsOnElement.md @@ -21,6 +21,7 @@ Actions are functions that emulate user behavior. They are being performed on ma - [`.scroll()`](#scrollpixels-direction) - [`.scrollTo()`](#scrolltoedge) - [`.swipe()`](#swipedirection-speed-percentage) +- [`.setColumnToValue()`](#set-column-to-value) ### `tap()` @@ -107,3 +108,13 @@ await element(by.id('scrollView')).swipe('down'); await element(by.id('scrollView')).swipe('down', 'fast'); await element(by.id('scrollView')).swipe('down', 'fast', 0.5); ``` +### `setColumnToValue(column,value)` + +column - number of datepicker column (starts from 0) +value - string value in setted column (must be correct) + +```js +await expect(element(by.type('UIPickerView'))).toBeVisible(); +await element(by.type('UIPickerView')).setColumnToValue(1,"6"); +await element(by.type('UIPickerView')).setColumnToValue(2,"34"); +``` From bd01ad0f26007a651b3f5d86f9ba0d6921fcc114 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Wed, 14 Mar 2018 18:19:56 +0200 Subject: [PATCH 06/16] add checking data after scrolling datePicker --- detox/test/e2e/s-datePicker.js | 22 +++++++ .../ios/example.xcodeproj/project.pbxproj | 60 +------------------ detox/test/src/Screens/DatePickerScreen.js | 28 ++++++++- detox/test/src/Screens/index.js | 2 +- 4 files changed, 52 insertions(+), 60 deletions(-) create mode 100644 detox/test/e2e/s-datePicker.js diff --git a/detox/test/e2e/s-datePicker.js b/detox/test/e2e/s-datePicker.js new file mode 100644 index 0000000000..eafb08ca1c --- /dev/null +++ b/detox/test/e2e/s-datePicker.js @@ -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 () => { + 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'); + }); + + }); + \ No newline at end of file diff --git a/detox/test/ios/example.xcodeproj/project.pbxproj b/detox/test/ios/example.xcodeproj/project.pbxproj index dcafed1ca6..66eeeced44 100644 --- a/detox/test/ios/example.xcodeproj/project.pbxproj +++ b/detox/test/ios/example.xcodeproj/project.pbxproj @@ -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 */ @@ -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 */ @@ -1193,7 +1137,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEAD_CODE_STRIPPING = NO; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = S3GLW74Y8N; INFOPLIST_FILE = example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -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"; diff --git a/detox/test/src/Screens/DatePickerScreen.js b/detox/test/src/Screens/DatePickerScreen.js index e43427be64..2de669c27a 100644 --- a/detox/test/src/Screens/DatePickerScreen.js +++ b/detox/test/src/Screens/DatePickerScreen.js @@ -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 ( + + {"choosenTime is " + this.getTime()} + ); @@ -29,5 +52,8 @@ const styles = StyleSheet.create({ width:'100%', height:200, backgroundColor:'green', + }, + dateText: { + textAlign: 'center', } }); diff --git a/detox/test/src/Screens/index.js b/detox/test/src/Screens/index.js index 1a16f122be..8548420b1c 100644 --- a/detox/test/src/Screens/index.js +++ b/detox/test/src/Screens/index.js @@ -28,6 +28,6 @@ export { NetworkScreen, AnimationsScreen, LocationScreen, - ShakeScreen + ShakeScreen, DatePickerScreen }; From e9a7abe62da45e83fd190d609ff8148d60124cd4 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Wed, 14 Mar 2018 18:20:16 +0200 Subject: [PATCH 07/16] updates --- detox/test/e2e/p-datePicker.js | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 detox/test/e2e/p-datePicker.js diff --git a/detox/test/e2e/p-datePicker.js b/detox/test/e2e/p-datePicker.js deleted file mode 100644 index a34bd75231..0000000000 --- a/detox/test/e2e/p-datePicker.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('DatePicker', () => { - beforeEach(async () => { - await device.reloadReactNative(); - }); - - beforeEach(async () => { - await element(by.text('DatePicker')).tap(); - }); - - it('check and scroll datePicker', async () => { - await expect(element(by.type('UIPickerView'))).toBeVisible(); - await element(by.type('UIPickerView')).setColumnToValue(1,"6"); - await element(by.type('UIPickerView')).setColumnToValue(2,"34"); - }); - - }); - \ No newline at end of file From cb87e43fa596b9d720b437fc781e839a1ee30e5d Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 20 Mar 2018 15:09:11 +0200 Subject: [PATCH 08/16] changes --- detox/test/e2e/s-datePicker.js | 5 ----- detox/test/ios/example.xcodeproj/project.pbxproj | 4 ++-- docs/APIRef.ActionsOnElement.md | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/detox/test/e2e/s-datePicker.js b/detox/test/e2e/s-datePicker.js index eafb08ca1c..1389c1225e 100644 --- a/detox/test/e2e/s-datePicker.js +++ b/detox/test/e2e/s-datePicker.js @@ -7,11 +7,6 @@ describe('DatePicker', () => { await element(by.text('DatePicker')).tap(); }); - it('datePicker and dateLabel should be visible', async () => { - 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"); diff --git a/detox/test/ios/example.xcodeproj/project.pbxproj b/detox/test/ios/example.xcodeproj/project.pbxproj index 66eeeced44..f68de50be0 100644 --- a/detox/test/ios/example.xcodeproj/project.pbxproj +++ b/detox/test/ios/example.xcodeproj/project.pbxproj @@ -1145,7 +1145,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.example; + PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example; PRODUCT_NAME = example; }; name = Debug; @@ -1162,7 +1162,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.example; + PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example; PRODUCT_NAME = example; }; name = Release; diff --git a/docs/APIRef.ActionsOnElement.md b/docs/APIRef.ActionsOnElement.md index e7a652be35..c72b28ba10 100644 --- a/docs/APIRef.ActionsOnElement.md +++ b/docs/APIRef.ActionsOnElement.md @@ -21,7 +21,7 @@ Actions are functions that emulate user behavior. They are being performed on ma - [`.scroll()`](#scrollpixels-direction) - [`.scrollTo()`](#scrolltoedge) - [`.swipe()`](#swipedirection-speed-percentage) -- [`.setColumnToValue()`](#set-column-to-value) +- [`.setColumnToValue()`](#set-column-to-value) iOS only ### `tap()` @@ -108,7 +108,7 @@ await element(by.id('scrollView')).swipe('down'); await element(by.id('scrollView')).swipe('down', 'fast'); await element(by.id('scrollView')).swipe('down', 'fast', 0.5); ``` -### `setColumnToValue(column,value)` +### `setColumnToValue(column,value)` iOS only column - number of datepicker column (starts from 0) value - string value in setted column (must be correct) From b6db95d121c46e57b668a4951cde04350cea7104 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Tue, 20 Mar 2018 15:42:25 +0200 Subject: [PATCH 09/16] delete team --- detox/test/ios/example.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detox/test/ios/example.xcodeproj/project.pbxproj b/detox/test/ios/example.xcodeproj/project.pbxproj index f68de50be0..3f225714ef 100644 --- a/detox/test/ios/example.xcodeproj/project.pbxproj +++ b/detox/test/ios/example.xcodeproj/project.pbxproj @@ -1137,7 +1137,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEAD_CODE_STRIPPING = NO; - DEVELOPMENT_TEAM = S3GLW74Y8N; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1154,7 +1154,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = S3GLW74Y8N; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; From ae1d48e86a97147abf28e4dfc15b59010b5a0233 Mon Sep 17 00:00:00 2001 From: Leo Natan Date: Tue, 20 Mar 2018 15:58:48 +0200 Subject: [PATCH 10/16] Update s-datePicker.js --- detox/test/e2e/s-datePicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detox/test/e2e/s-datePicker.js b/detox/test/e2e/s-datePicker.js index 1389c1225e..3d0e4513ab 100644 --- a/detox/test/e2e/s-datePicker.js +++ b/detox/test/e2e/s-datePicker.js @@ -7,11 +7,11 @@ describe('DatePicker', () => { await element(by.text('DatePicker')).tap(); }); - it('datePicker should be scroll and change time', async () => { + it('datePicker should trigger change handler correctly', 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'); }); }); - \ No newline at end of file + From 02526c93322c8de37fdc127341e1e81f9871517f Mon Sep 17 00:00:00 2001 From: Leo Natan Date: Tue, 20 Mar 2018 16:00:19 +0200 Subject: [PATCH 11/16] Discard changes in this file --- generation/package.json | 95 ++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/generation/package.json b/generation/package.json index d868e933d0..729d99a507 100644 --- a/generation/package.json +++ b/generation/package.json @@ -1,47 +1,52 @@ { - "name": "generation", - "version": "0.0.1", - "description": "Generate wrapper code for native dependencies", - "main": "index.js", - "private": true, - "scripts": { - "build": "./index.js", - "test": "jest", - "precommit": "lint-staged", - "format": "prettier ./**/*.{js,json,css,md} --write" - }, - "author": "DanielMSchmidt ", - "license": "MIT", - "lint-staged": { - "*.{js,json,css,md}": ["prettier --write", "git add"] - }, - "devDependencies": { - "babel-generator": "^6.25.0", - "babel-types": "^6.25.0", - "download-file-sync": "^1.0.4", - "jest": "^20.0.4", - "lerna": "2.0.0-rc.4", - "lint-staged": "^6.0.0", - "objective-c-parser": "1.1.0", - "prettier": "^1.8.2", - "remove": "^0.1.5" - }, - "jest": { - "coveragePathIgnorePatterns": ["/index.js"], - "resetMocks": true, - "resetModules": true, - "coverageThreshold": { - "global": { - "statements": 100, - "branches": 100, - "functions": 100, - "lines": 100 - } - } - }, - "dependencies": { - "babel-generate-guard-clauses": "^2.0.0", - "babel-template": "^6.26.0", - "java-method-parser": "^0.4.5" - } + "name": "generation", + "version": "0.0.1", + "description": "Generate wrapper code for native dependencies", + "main": "index.js", + "private": true, + "scripts": { + "build": "./index.js", + "test": "jest", + "precommit": "lint-staged", + "format": "prettier ./**/*.{js,json,css,md} --write" + }, + "author": "DanielMSchmidt ", + "license": "MIT", + "lint-staged": { + "*.{js,json,css,md}": [ + "prettier --write", + "git add" + ] + }, + "devDependencies": { + "babel-generator": "^6.25.0", + "babel-types": "^6.25.0", + "download-file-sync": "^1.0.4", + "jest": "^20.0.4", + "lerna": "2.0.0-rc.4", + "lint-staged": "^6.0.0", + "objective-c-parser": "1.1.0", + "prettier": "^1.8.2", + "remove": "^0.1.5" + }, + "jest": { + "coveragePathIgnorePatterns": [ + "/index.js" + ], + "resetMocks": true, + "resetModules": true, + "coverageThreshold": { + "global": { + "statements": 100, + "branches": 100, + "functions": 100, + "lines": 100 + } + } + }, + "dependencies": { + "babel-generate-guard-clauses": "^2.0.0", + "babel-template": "^6.26.0", + "java-method-parser": "^0.4.5" + } } From 0a9d71d29c03e98d0e9ed7ce77da01d32cd3db21 Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Thu, 22 Mar 2018 13:18:40 +0200 Subject: [PATCH 12/16] unit tests --- detox/src/ios/expect.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/detox/src/ios/expect.test.js b/detox/src/ios/expect.test.js index ecb623e16e..db5a22efe2 100644 --- a/detox/src/ios/expect.test.js +++ b/detox/src/ios/expect.test.js @@ -34,6 +34,7 @@ describe('expect', async () => { it(`element by type`, async () => { await e.expect(e.element(e.by.type('test'))).toBeVisible(); + await e.expect(e.element(e.by.type('UIPickerView'))).toBeVisible(); }); it(`element by traits`, async () => { @@ -79,6 +80,8 @@ describe('expect', async () => { await e.waitFor(e.element(e.by.id('id'))).toHaveValue('value'); await e.waitFor(e.element(e.by.id('id'))).toNotHaveValue('value'); + await e.element(e.by.id('timeLabel')).toBeVisible(); + await e.waitFor(e.element(e.by.id('id'))).toBeVisible().whileElement(e.by.id('id2')).scroll(50, 'down'); await e.waitFor(e.element(e.by.id('id'))).toBeVisible().whileElement(e.by.id('id2')).scroll(50); }); From 46c5702431f40050de113544ca6d6a3b92a1555e Mon Sep 17 00:00:00 2001 From: Dmytro Ponomarenko Date: Fri, 23 Mar 2018 11:18:31 +0200 Subject: [PATCH 13/16] test new functionality --- detox/src/ios/expect.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detox/src/ios/expect.test.js b/detox/src/ios/expect.test.js index db5a22efe2..8256a30442 100644 --- a/detox/src/ios/expect.test.js +++ b/detox/src/ios/expect.test.js @@ -34,7 +34,7 @@ describe('expect', async () => { it(`element by type`, async () => { await e.expect(e.element(e.by.type('test'))).toBeVisible(); - await e.expect(e.element(e.by.type('UIPickerView'))).toBeVisible(); + await e.expect(e.element(e.by.type('UIPickerView')).setColumnToValue(1,"6")); }); it(`element by traits`, async () => { @@ -80,7 +80,7 @@ describe('expect', async () => { await e.waitFor(e.element(e.by.id('id'))).toHaveValue('value'); await e.waitFor(e.element(e.by.id('id'))).toNotHaveValue('value'); - await e.element(e.by.id('timeLabel')).toBeVisible(); + await e.waitFor(e.element(e.by.id('id'))).toBeVisible().whileElement(e.by.id('id2')).scroll(50, 'down'); await e.waitFor(e.element(e.by.id('id'))).toBeVisible().whileElement(e.by.id('id2')).scroll(50); From 087d2ba7cfe6d92972f30c6403ee423667ef75f0 Mon Sep 17 00:00:00 2001 From: Rotem M Date: Mon, 26 Mar 2018 14:19:47 +0300 Subject: [PATCH 14/16] fixed unit test --- detox/src/ios/expect.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detox/src/ios/expect.test.js b/detox/src/ios/expect.test.js index 8256a30442..d4430b8a30 100644 --- a/detox/src/ios/expect.test.js +++ b/detox/src/ios/expect.test.js @@ -34,7 +34,7 @@ describe('expect', async () => { it(`element by type`, async () => { await e.expect(e.element(e.by.type('test'))).toBeVisible(); - await e.expect(e.element(e.by.type('UIPickerView')).setColumnToValue(1,"6")); + await e.element(e.by.type('UIPickerView')).setColumnToValue(1,"6"); }); it(`element by traits`, async () => { From a22bbeb011393b4a5c3d11228f44710be2f917d3 Mon Sep 17 00:00:00 2001 From: Leo Natan Date: Mon, 26 Mar 2018 15:22:22 +0300 Subject: [PATCH 15/16] Update APIRef.ActionsOnElement.md --- docs/APIRef.ActionsOnElement.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/APIRef.ActionsOnElement.md b/docs/APIRef.ActionsOnElement.md index c72b28ba10..27f4439480 100644 --- a/docs/APIRef.ActionsOnElement.md +++ b/docs/APIRef.ActionsOnElement.md @@ -21,7 +21,7 @@ Actions are functions that emulate user behavior. They are being performed on ma - [`.scroll()`](#scrollpixels-direction) - [`.scrollTo()`](#scrolltoedge) - [`.swipe()`](#swipedirection-speed-percentage) -- [`.setColumnToValue()`](#set-column-to-value) iOS only +- [`.setColumnToValue()`](#setcolumntovalue-column-value) iOS only ### `tap()` From 6770cd4a82e35ecd64ebc724ee9ec1f70a9ca5c0 Mon Sep 17 00:00:00 2001 From: Leo Natan Date: Mon, 26 Mar 2018 15:24:07 +0300 Subject: [PATCH 16/16] Update APIRef.ActionsOnElement.md --- docs/APIRef.ActionsOnElement.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/APIRef.ActionsOnElement.md b/docs/APIRef.ActionsOnElement.md index 27f4439480..c6a6fb376e 100644 --- a/docs/APIRef.ActionsOnElement.md +++ b/docs/APIRef.ActionsOnElement.md @@ -21,7 +21,7 @@ Actions are functions that emulate user behavior. They are being performed on ma - [`.scroll()`](#scrollpixels-direction) - [`.scrollTo()`](#scrolltoedge) - [`.swipe()`](#swipedirection-speed-percentage) -- [`.setColumnToValue()`](#setcolumntovalue-column-value) iOS only +- [`.setColumnToValue()`](#setcolumntovalue-column-value) **iOS only** ### `tap()`