-
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
expose EarlGrey's matcherForInteractable #668
Conversation
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.
Hey @kkhaidukov,
Thanks for the contribution! In order for this to be merged please add test to the E2E suite, so we can actually make sure it works, and will not break in the future without us noticing.
9d43d4f
to
2f26f31
Compare
@rotemmiz I need help with this failed build here -- https://travis-ci.org/wix/detox/jobs/367176057 |
Travis will be Travis 😒, restarted, green |
@rotemmiz the e2e test is added, please have another look |
I am trying to understand the usecase for using this API. |
@rotemmiz We have an app with tabbed interface, and two (or more) tabs may have elements with the same testIDs, because when the tab is switched, a new screen is pushed onto the stack, overlaying the one beneath it (which is not destroyed and its elements are therefore locatable). In this case, detox cannot distinguish between the two elements when trying to e.g. tap. Adding the |
What prevents you from adding testID to each tab ? |
BTW, I think this proposition will solve your problem and much more. |
would that help?
it does, it ensures that only the elements belonging to the uppermost screen will be matched
it might, but it doesn't look like it's getting any action |
So is everything mounted to the screen (even things which are not in the active tab?) |
yes
if you mean |
In sake of your app's performance, try detaching those views from the hierarchy. This will also solve your problem. |
@rotemmiz You can't detach it in every case (at least in the router implementation @kkhaidukov is referring to). While you transition between the screens they need to be mounted and they need to be kept in case you want to transition back. React Native itself takes care of what needs to be rendered and what not, there shouldn't be an performance impact. Do you see an issue with a matcher for interactable? |
@rotemmiz any other changes needed to get this PR merged? |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The issue has been closed for inactivity. |
Hey, sorry for the delayed response here, but I don't think this PR is a good idea, along with what I wrote previously. A PR of this type makes much more sense IMO. |
Detox is being used in React Native Navigation v2, and we had the same issue of multiple views with the same testID on multiple tabs on its Android playground app (the app we test RNNv2 on). You'll probably need to add |
Currently I'm trying to switch IdMatcher from calling GreyMatchers.matcherForAccessibilityID to a method that I created in GREYMatchers+Detox.m that looks like this:
But the problem is, the tests get very noticeably slower, when there is an extra grey_ matcher inside of grey_allOf. I've tried with |
I suggest you either open a PR or a new issue. Visibility of closed issues is very limited. You can reference this issue in the new one. |
Will expose EarlGrey's matcherForInteractable in
by
for iOS.