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

atIndex() not working as expected on Android #337

Closed
SMJ93 opened this issue Oct 12, 2017 · 12 comments
Closed

atIndex() not working as expected on Android #337

SMJ93 opened this issue Oct 12, 2017 · 12 comments

Comments

@SMJ93
Copy link
Contributor

SMJ93 commented Oct 12, 2017

Description

I am trying to select the first ScrollView in my view hierarchy on Android.

await element(by.type('android.widget.ScrollView')).atIndex(1) works on it's own, but then when calling a .click() / .scroll() / .swipe() event after e.g:

await element(by.type('android.widget.ScrollView')).atIndex(1).scroll(100, 'up');

It throws the following error:

Error: Error: Error performing 'scrollInDirection' on view 'matches 1th view.'.

Steps to Reproduce

Call atIndex() followed by any of the ActionsOnElements on Android.

Node, Device, Xcode and macOS Versions

  • Node: 8.1.0
  • Device: Nexus_5_API_26
  • Xcode: N/A
  • macOS: 10.12.6
  • Detox: 5.8.1
@SMJ93 SMJ93 mentioned this issue Oct 12, 2017
@rotemmiz
Copy link
Member

@isnifer, this is not a fix for that issue. atIndex seems to return a wrong value.

@simonracz
Copy link
Contributor

I'll take a look at this.

@simonracz simonracz self-assigned this Oct 14, 2017
@simonracz
Copy link
Contributor

simonracz commented Oct 17, 2017

Hey @SMJ93 ,

Silly thing, but could you please check it with atIndex(0)?

I just noticed that you want to match the first Scrollview. It's zero indexed.

By the way, thanks to your report, I noticed a discrepancy between iOS and Android in how they handle atIndex. You might have to differentiate between the two platforms there with the getPlatform API.

if (device.getPlatform() === 'ios') {
   await ...atIndex(1)...;
} else {
   await ...atIndex(0)...;
}

The difference is NOT in being zero indexed and one indexed. Both are zero indexed. It's about the ordering of the matched elements.

@SMJ93
Copy link
Contributor Author

SMJ93 commented Oct 17, 2017

Hi @simonracz,

I tried with both atIndex(0) and atIndex(1), both returned the same error.

There are 2 ScrollViews in the view hierarchy so using 1 or 2 should pick up a ScrollView.

Let me know if you need anything else.

@simonracz
Copy link
Contributor

After the error, does detox print out the view hierarchy?
Could you copy it here? At least the part about the ScrollViews?

I am sure it's not about the atIndex at all.

I'll also check out something in the mean time.

(By the way, without an expectation or action, detox commands are no ops. It's just good to know.)

@SMJ93
Copy link
Contributor Author

SMJ93 commented Oct 17, 2017

Cool, cheers @simonracz. Here is the full Hierarchy:

+>DecorView{id=-1, visibility=VISIBLE, width=960, height=1557, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 sim=#20 ty=2 fl=#1820002 fmt=-3 wanim=0x10302f7 needsMenuKey=2 colorMode=0}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+->FrameLayout{id=-1, visibility=VISIBLE, width=864, height=1461, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@cdd9916, tag=null, root-is-layout-requested=false, has-input-connection=false, x=48.0, y=48.0, child-count=2}
|
+-->FrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=864, height=1461, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@4c31c84, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+--->AlertDialogLayout{id=16909134, res-name=parentPanel, visibility=VISIBLE, width=864, height=1461, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@b318269, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4}
|
+---->LinearLayout{id=16909382, res-name=topPanel, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@a0f781c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+----->LinearLayout{id=16909372, res-name=title_template, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@5d4a3ab, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+------>ImageView{id=16908294, res-name=icon, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@6a9fa08, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+------>DialogTitle{id=16908696, res-name=alertTitle, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@abe15a1, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=, input-type=0, ime-target=false, has-links=false}
|
+----->Space{id=16909367, res-name=titleDividerNoCustom, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@90c73c6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+---->FrameLayout{id=16908800, res-name=contentPanel, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@6e8aeb4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+----->ScrollView{id=16909220, res-name=scrollView, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@84c0652, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+------>LinearLayout{id=-1, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c80359e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+------->Space{id=16909350, res-name=textSpacerNoTitle, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@921287f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+------->TextView{id=16908299, res-name=message, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@eaf204c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=, input-type=0, ime-target=false, has-links=false}
|
+------->Space{id=16909349, res-name=textSpacerNoButtons, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@3301895, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+---->FrameLayout{id=16908807, res-name=customPanel, visibility=VISIBLE, width=864, height=1293, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@9a9cd9b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+----->FrameLayout{id=16908331, res-name=custom, visibility=VISIBLE, width=864, height=1293, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@246a911, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+------>DatePicker{id=16908811, res-name=datePicker, visibility=VISIBLE, width=864, height=1293, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@34da877, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+------->LinearLayout{id=-1, visibility=VISIBLE, width=864, height=1293, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@6bea802, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-------->LinearLayout{id=16908813, res-name=date_picker_header, visibility=VISIBLE, width=864, height=279, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e643350, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+--------->LinearLayout{id=-1, visibility=VISIBLE, width=864, height=279, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@79b2f6f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+---------->TextView{id=16908815, res-name=date_picker_header_year, visibility=VISIBLE, width=156, height=105, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@461347c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=48.0, y=24.0, text=2017, input-type=0, ime-target=false, has-links=false}
|
+---------->TextView{id=16908814, res-name=date_picker_header_date, visibility=VISIBLE, width=546, height=120, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@f495105, tag=null, root-is-layout-requested=false, has-input-connection=false, x=72.0, y=105.0, text=Wed, Oct 11, input-type=0, ime-target=false, has-links=false}
|
+-------->ScrollView{id=-1, visibility=VISIBLE, width=864, height=1014, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@2d5538b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=279.0, child-count=1}
|
+--------->DialogViewAnimator{id=16908712, res-name=animator, visibility=VISIBLE, width=864, height=1014, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@592f881, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+---------->DayPickerView{id=16908812, res-name=date_picker_day_picker, visibility=GONE, width=864, height=1014, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c114d26, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+----------->DayPickerViewPager{id=16908820, res-name=day_picker_view_pager, visibility=VISIBLE, width=864, height=1014, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@bb515b2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+------------>SimpleMonthView{id=16909059, res-name=month_view, visibility=VISIBLE, width=864, height=1014, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=com.android.internal.widget.ViewPager$LayoutParams@262a903, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+------------>SimpleMonthView{id=16909059, res-name=month_view, visibility=VISIBLE, width=864, height=1014, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=com.android.internal.widget.ViewPager$LayoutParams@ed31080, tag=null, root-is-layout-requested=false, has-input-connection=false, x=-864.0, y=0.0}
|
+------------>SimpleMonthView{id=16909059, res-name=month_view, visibility=VISIBLE, width=864, height=1014, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=com.android.internal.widget.ViewPager$LayoutParams@1e536b9, tag=null, root-is-layout-requested=false, has-input-connection=false, x=864.0, y=0.0}
|
+----------->ImageButton{id=16909170, res-name=prev, desc=Previous month, visibility=VISIBLE, width=144, height=144, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@15adafe, tag=null, root-is-layout-requested=false, has-input-connection=false, x=41.0, y=30.0}
|
+----------->ImageButton{id=16909074, res-name=next, desc=Next month, visibility=VISIBLE, width=144, height=144, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@dcd25f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=679.0, y=30.0}
|
+---------->YearPickerView{id=16908816, res-name=date_picker_year_picker, visibility=VISIBLE, width=864, height=1014, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=true, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@caaed44, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=8}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@fa9ee2d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=-45.0, text=2015, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@5ba4f62, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=99.0, text=2016, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=177, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@c4fd8f3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=243.0, text=2017, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@10b99b0, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=420.0, text=2018, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@8e44029, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=564.0, text=2019, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@d71ffae, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=708.0, text=2020, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@405114f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=852.0, text=2021, input-type=0, ime-target=false, has-links=false}
|
+----------->TextView{id=16908308, res-name=text1, visibility=VISIBLE, width=864, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@388a0dc, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=996.0, text=2022, input-type=0, ime-target=false, has-links=false}
|
+---->ScrollView{id=16908756, res-name=buttonPanel, visibility=VISIBLE, width=864, height=168, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@ae268ba, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=1293.0, child-count=1}
|
+----->ButtonBarLayout{id=-1, visibility=VISIBLE, width=864, height=168, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@d2cb61, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4}
|
+------>Button{id=16908315, res-name=button3, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@1be5686, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=, input-type=0, ime-target=false, has-links=false}
|
+------>Space{id=16909290, res-name=spacer, visibility=INVISIBLE, width=369, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e0bdb47, tag=null, root-is-layout-requested=false, has-input-connection=false, x=36.0, y=156.0}
|
+------>Button{id=16908314, res-name=button2, visibility=VISIBLE, width=231, height=144, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@7c62f74, tag=null, root-is-layout-requested=false, has-input-connection=false, x=405.0, y=12.0, text=Cancel, input-type=0, ime-target=false, has-links=false}
|
+------>Button{id=16908313, res-name=button1, visibility=VISIBLE, width=192, height=144, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@98fbc9d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=636.0, y=12.0, text=OK, input-type=0, ime-target=false, has-links=false}
|
+-->ViewStub{id=16908678, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c195512, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|

@simonracz
Copy link
Contributor

simonracz commented Oct 17, 2017

I have a hunch.

You have an AlertDialog shown on the screen, right?

Sadly, it seems that causes issues for Espresso, which is used inside Detox Android. :(

In Espresso syntax it means, that tests like this:

onView(withText("blabla")).perform(click());

Must be transformed to

onView(withText("blabla")).inRoot(isDialog()).perform(click());

In case this is really the cause of this issue, sadly I don't have a quick solution to it. Maybe we have to expose this oddity in Detox API too in the end. Which would be super ugly. :(

@SMJ93
Copy link
Contributor Author

SMJ93 commented Oct 20, 2017

@simonracz, yeah the date picker displays as an AlertDialog:

screen shot 2017-10-20 at 10 48 40

I can interact with other parts of the AlertDialog using by text, it's just the scroll view that has the issue because there are duplicates:

    await element(by.id('WhatIsYourDOB')).tap();
    await element(by.text('2017')).tap();

    // There are a few issues with atIndex() which blocks up from scrolling to a valid date
    // await element(by.type('android.widget.ScrollView')).atIndex(1).scroll(100, 'up');

    await expect(element(by.text('2016'))).toBeVisible();
    await element(by.text('2016')).tap();
    await expect(element(by.text('OK'))).toBeVisible();
    await element(by.text('OK')).tap();

@simonracz
Copy link
Contributor

Thanks for the extra info. I plan create a small test with a dialog and scrollviews to debug the issue. I can't promise a date though yet.

@SMJ93
Copy link
Contributor Author

SMJ93 commented Oct 20, 2017

Cool, we are using the react-native-modal-datetime-picker if that is any help!

Let me know if you need anything else.

@stale
Copy link

stale bot commented Mar 7, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.

@stale stale bot added the 🏚 stale label Mar 7, 2018
@stale
Copy link

stale bot commented Mar 14, 2018

The issue has been closed for inactivity.

@stale stale bot closed this as completed Mar 14, 2018
@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants