-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
detox/test/e2e/p-datePicker.js
Outdated
}); | ||
|
||
it('check and scroll datePicker', async () => { | ||
await expect(element(by.type('UIPickerView'))).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why by type and not by id? Does it not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIPickerView have not accessibility ID, testID = {'CustomDatePicker'} need to be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a problem. If user has more than one pickers, the API will break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIPickerView
is a UIView
, so it can have an accessibility ID. Are you seeing that UIDatePicker
does not forward that ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked that UI element via AccessebilityInspector (from Xcode Instruments), and now I found only one way to get element by type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't work on android
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We know. We want to hone down iOS support first, then we will implement Android as well.
@@ -491,10 +519,14 @@ | |||
39A34C5D1E30ED3600BEBB59 /* libcxxreact.a */, | |||
39A34C5F1E30ED3600BEBB59 /* libjschelpers.a */, | |||
39A34C611E30ED3600BEBB59 /* libjschelpers.a */, | |||
D58447B0204E9C6000248543 /* libjsinspector.a */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this? What will happen if old RN is used? In CI, we have an RN matrix that changes RN versions on the fly. Currently we are testing RN 51 and 53.3
render() { | ||
return ( | ||
<View style={{flex: 1, paddingTop: 20, justifyContent: 'center', alignItems: 'center'}}> | ||
<DatePickerIOS testID = {'CustomDatePicker'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is testID
why find by type in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIPickerView have not accessibility ID, testID = {'CustomDatePicker'} need to be deleted
In the future, please do not open new PRs, just push in to previous. From the previous PR discussion:
|
You are missing the |
detox/test/e2e/p-datePicker.js
Outdated
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")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect should not be on actions.
You should have a label and see that the correct value is shown there.
Should be something like
await element(by.type('UIPickerView')).setColumnToValue(2,"34");
await expect(element(by.id('time'))).toHaveText('6:34');
I was working on a PR of my own to fix this issue and should have checked here first! Very keen to see this enhancement get in, as it's a blocker for our tests at the moment. Would it be possible to get this merged with support for iOS only? I notice the implementation for Android is missing, and I myself haven't attempted to implement the Android version because we're not using it. Surely motivated Android devs could implement the [equivalent to] GreyAction for Android should they have a desire to get it working. crosses fingers |
@timsawtell-sportsbet We discusses this internally and finallly decided we will merge it before the Android support lands. Once the PR is satisfactory (very soon), we will merge. |
Why is this stale for so long? @DmitryPonomarenko |
# Conflicts: # detox/test/ios/example.xcodeproj/project.pbxproj # detox/test/ios/example/Info.plist # detox/test/src/Screens/index.js # detox/test/src/app.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing. Please check why and fix where needed.
generation/package.json
Outdated
"name": "generation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What changed in this file? If nothing, please revert this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still remains open. Why did the file change?
docs/APIRef.ActionsOnElement.md
Outdated
@@ -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)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be explicitly marked as iOS only in the documentation.
@@ -1145,7 +1201,7 @@ | |||
"-ObjC", | |||
"-lc++", | |||
); | |||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; | |||
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.example; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
detox/test/e2e/p-datePicker.js
Outdated
}); | ||
|
||
it('check and scroll datePicker', async () => { | ||
await expect(element(by.type('UIPickerView'))).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should be wrapped with if(iOS)
.
detox/test/e2e/p-datePicker.js
Outdated
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, this test checks nothing. There should be a label in the screen, and on date picker change value, it should update. You should then assert that the label has the correct value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking label with text will be always true, because this label always on date picker, I think right solution is checking property of datePicker current value or something like that, now I work in this direction, add this functionality asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. The label is updated with the value set in the picker. So if you select 6:41, it won't say "6:34" in the label. If you assert that label.text == "6:34"
, you will test that the picker really changed value. That's what we want to test in the testing suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my example if element (UIPickerView) can't find variable with current column or value test will be failed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that is not what we test in the suite. We test that the native system behaves as expected following Detox changes.
As we discussed, also please test if Earl Grey has API to assert on the picker value at column. |
detox/test/e2e/s-datePicker.js
Outdated
await element(by.text('DatePicker')).tap(); | ||
}); | ||
|
||
it('datePicker and dateLabel should be visible', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary.
@@ -1137,15 +1137,15 @@ | |||
buildSettings = { | |||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
DEAD_CODE_STRIPPING = NO; | |||
DEVELOPMENT_TEAM = ""; | |||
DEVELOPMENT_TEAM = S3GLW74Y8N; |
There was a problem hiding this comment.
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.
generation/package.json
Outdated
"name": "generation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still remains open. Why did the file change?
Implement functionality for changing the column values of pickers on IOS
Add test screen with pickerView(iOS)
Add tests to e2e folder for this pickerView