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

Multiple elements matched on action Swipe. #433

Closed
alissa-ferro opened this issue Nov 24, 2017 · 17 comments
Closed

Multiple elements matched on action Swipe. #433

alissa-ferro opened this issue Nov 24, 2017 · 17 comments

Comments

@alissa-ferro
Copy link

Hi.
When I try to swipe a view by it's type and index detox simply ignores the index and gives me a 'Multiple UI elements matched for the criteria' error .
I don´t have access to the apps code so I can´t put a testId on the view.

My code:

await element(by.type('UINavigationTransitionView')).atIndex(0).swipe('right', 'fast');

error:

  1. Test:
    Error: Error: Multiple UI elements matched for the given criteria.
    Exception with Action: {
    "Action Name" : "Swipe Right for duration 0.1",
    "Element Matcher" : "((((kindOfClass('UINavigationTransitionView') && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches((kindOfClass('UINavigationTransitionView') && kindOfClass('RCTScrollView')))))) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches((((kindOfClass('UINavigationTransitionView') && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches((kindOfClass('UINavigationTransitionView') && kindOfClass('RCTScrollView')))))) && kindOfClass('RCTScrollView'))))))",
    "Recovery Suggestion" : "Create a more specific matcher to uniquely match an element. If that's not possible then use atIndex: to select from one of the matched elements but the order of elements may change."
    }

Error Trace: [
{
"Description" : "Multiple elements were matched: (
"<UINavigationTransitionView:0x7f8f30e2a930; AX=N; AX.frame={{0, 0}, {414, 736}}; AX.activationPoint={207, 368}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {414, 736}}; opaque; alpha=1>",
"<UINavigationTransitionView:0x7f8f3304eab0; AX=N; AX.frame={{0, 800}, {414, 672}}; AX.activationPoint={207, 1136}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {414, 672}}; opaque; alpha=1>",
"<UINavigationTransitionView:0x7f8f30d63200; AX=N; AX.frame={{0, 800}, {414, 672}}; AX.activationPoint={207, 1136}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {414, 672}}; opaque; alpha=1>",
). Please use selection matchers to narrow the selection down to single element.",
"Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
"Error Code" : "5",
"File Name" : "GREYElementInteraction.m",
"Function Name" : "-[GREYElementInteraction grey_errorForMultipleMatchingElements:withMatchedElementsIndexOutOfBounds:]",
"Line" : "956"
}
]
at Client._callee8$ (node_modules/detox/lib/client/Client.js:57:19)
at tryCatch (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as throw] (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
at step (node_modules/detox/lib/client/Client.js:1:809)
at node_modules/detox/lib/client/Client.js:1:1008
at
at process._tickCallback (internal/process/next_tick.js:188:7)

child_process.js:641
throw err;
^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts

Detox: 5.9.2
Node: 8.8.1
Device: iPhone 6 (simulator)
Xcode: 9.0.1
macOS: Sierra 10.12.6
@anton6
Copy link

anton6 commented Nov 24, 2017

I was just about to report the same, but for scrollTo instead of swipe.

I'm having problem with this:
await element(by.type('RCTScrollView')).atIndex(0).scrollTo('bottom');

I get "Multiple elements were matched"

But this is okay:
await expect(element(by.type('RCTScrollView')).atIndex(0)).toBeVisible();

@akuschqa
Copy link

akuschqa commented Nov 29, 2017

I have the same issue with nested scrollView:

const scrollView = element(by.id('scene.id.base').and(by.type('RCTScrollView'))).atIndex(0);
await expect(scrollView).toBeVisible();
await expect(scrollView).toExist();

toBeVisible and toExist work properly, but scroll/scrollTo/swipe do not work:

await scrollView.scroll(100, 'down');
A part of the logs:

Error Trace: [
  {
    "Description" : "Multiple elements were matched: (
    "<RCTCustomScrollView:0x7fb877a6d400; AX=N; AX.frame={{0, 110}, {375, 517}} <...>
    "<RCTCustomScrollView:0x7fb877aade00; AX=N; AX.frame={{0, 477}, {375, 106}} <...>
    "<RCTCustomScrollView:0x7fb87721ae00; AX=N; AX.frame={{0, 707.5}, {375, 751.5}} <...>
). Please use selection matchers to narrow the selection down to single element."

@anton6
Copy link

anton6 commented Nov 29, 2017

I think there are generally problems around matching scrollviews. I'm also keeping an eye on this one: #164

@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
@chadlwilson
Copy link

This might be a dupe of #164, but I think this is still relevant.

@stale stale bot removed the 🏚 stale label Mar 8, 2018
@stale
Copy link

stale bot commented Apr 22, 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 Apr 22, 2018
@chadlwilson
Copy link

Still not working on latest Detox.

@stale stale bot removed the 🏚 stale label Apr 22, 2018
@ma-pe
Copy link

ma-pe commented Apr 24, 2018

I can confirm this is still not working.

scroll, scrollTo, swipe ignore atIndex(0). Though tap regards atIndex(0).

@stale
Copy link

stale bot commented Jun 8, 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 Jun 8, 2018
@ma-pe
Copy link

ma-pe commented Jun 12, 2018

Please unstale, this is still an issue :)

@stale stale bot removed the 🏚 stale label Jun 12, 2018
@lalka-workco
Copy link
Contributor

Confirmed still an issue, pasted error below

React 16.3.1
RN 0.55.4
node 9.2.0
Detox 7.3.7

Error: Multiple UI elements matched for the given criteria.
Exception with Action: {
"Action Name" : "Scroll To Bottom content edge",
"Element Matcher" : "(((((kindOfClass('UIScrollView') || kindOfClass('UIWebView')) && (respondsToSelector(accessibilityIdentifier)&& accessibilityID('scrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches((respondsToSelector(accessibilityIdentifier) && accessibilityID('scrollView')))))) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches(((((kindOfClass('UIScrollView') || kindOfClass('UIWebView')) && (respondsToSelector(accessibilityIdentifier) && accessibilityID('scrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches((respondsToSelector(accessibilityIdentifier) && accessibilityID('scrollView')))))) && kindOfClass('RCTScrollView'))))))",
"Recovery Suggestion" : "Create a more specific matcher to uniquely match an element. If that's not possible then use atIndex: to select from one of the matched elements but the order of elements may change."
}

Error Trace: [
  {
    "Description" : "Multiple elements were matched: (
    "<RCTCustomScrollView:0x7fb8a2830800; AX=N; AX.frame={{-750, 0}, {375, 695}}; AX.activationPoint={-562.5, 347.5}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {375, 695}}; opaque; alpha=1>",
    "<RCTCustomScrollView:0x7fb8a1234800; AX=N; AX.frame={{0, 44}, {375, 651}}; AX.activationPoint={187.5, 369.5}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {375, 651}}; opaque; alpha=1>",
    "<RCTCustomScrollView:0x7fb8a10a7800; AX=N; AX.frame={{-750, 1327.3333129882812}, {375, 360}}; AX.activationPoint={-562.5, 1507.3333129882812}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {375, 360}}; opaque; alpha=1>",
    "<RCTCustomScrollView:0x7fb8a1099a00; AX=N; AX.frame={{-740, 498}, {355, 330}}; AX.activationPoint={-562.5, 663}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {355, 330}}; opaque; alpha=1>"
). Please use selection matchers to narrow the selection down to single element.",
    "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
    "Error Code" : "5",
    "File Name" : "GREYElementInteraction.m",
    "Function Name" : "-[GREYElementInteraction grey_errorForMultipleMatchingElements:withMatchedElementsIndexOutOfBounds:]",
    "Line" : "956"
  }
]

@rotemmiz
Copy link
Member

The fact that @ma-pe found different behaviours in tap and other actions is pretty odd.
The implementation is generic for all actions, and the underlying EarlGrey implementation seems generic as well.

  1. Do you have a demo project we can test this on ?
  2. If not, it would be super helpful, either by adding failing tests to detox test suite, or creating a different project.
  3. If all that is impossible, can you at least paste verbose log of those tests fail, I would like to see the constructed invocation json passed to the device.

@Milesyan
Copy link

Milesyan commented Jul 2, 2018

same issue.

@stale
Copy link

stale bot commented Aug 16, 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 Aug 16, 2018
@stale
Copy link

stale bot commented Aug 23, 2018

The issue has been closed for inactivity.

@stale stale bot closed this as completed Aug 23, 2018
@ma-pe
Copy link

ma-pe commented Aug 23, 2018

unstale unclose.

I'll try to setup something for reproducing the issue in the next days.

@noomorph noomorph reopened this Aug 23, 2018
@stale stale bot removed the 🏚 stale label Aug 23, 2018
@LeoNatan
Copy link
Contributor

Multiple elements issues have been resolved recently. Please try a new build and if it still occurs, open a new issue, rather than bumping an old one. Thanks

@wix wix locked and limited conversation to collaborators Aug 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