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

Expect element To Not Be Visible doesn't work correctly on Android #1825

Closed
2 tasks
j320 opened this issue Jan 3, 2020 · 2 comments
Closed
2 tasks

Expect element To Not Be Visible doesn't work correctly on Android #1825

j320 opened this issue Jan 3, 2020 · 2 comments

Comments

@j320
Copy link

j320 commented Jan 3, 2020

Describe the bug
I have an expandable/collapsable element that displays certain elements when expanded and hides them when collapsed. When collapsed, I expect the To Not Be Visible assertion to be true, however on Android it returns error, 2 different ones depending on how the assertion is carried out

To Reproduce
Make sure that the element is existing in the view but not visible An expandable/collapsable element is how this issue was found and it may be useful as the elements were visible once but after collapsing they no longer are.

  • If the assertion is implemented with await waitFor(element).toBeNotVisible().withTimeout(waitTime) - Detox will wait until timeout is finished and fail the test with the following error message: Error: [<seconds>]sec timeout expired without matching of given matcher: (null or not is displayed on the screen to the user)

  • If the assertion is implemented with await expect(MobileElement).toBeNotVisible() - Detox will instantly fail the test with the following message: Error: 'not is displayed on the screen to the user' doesn't match the selected view. Expected: not is displayed on the screen to the user Got: "ReactImageView{id=[<id>], visibility=VISIBLE, width=[<width>], height=[<height>], 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.view.ViewGroup$LayoutParams@fc8e1c0, tag=[<content-desc>], root-is-layout-requested=false, has-input-connection=false, x=0.0, y=35.0}"
    This error message is also displayed if a manual sleep is added before

Environment (please complete the following information):

  • Detox: 14.9.2
  • OS: Android

This issue doesn't happen on iOS, the To Not Be Visible assertion works correctly there

@tareqdayya
Copy link

yup, same here. Funny thing is, if i replace the toBeNotVisible() matcher with toBeVisible(), the test passes on Android while failing on iOS. It should fail, since the component is most certainly not visible. I've tried playing around with the withTimeout() argument, choosing longer periods to ensure without a doubt that the item is not visible, but to no avail.
Temporarily, i'm switching to asserting that a component on the screen i just navigated to is visible instead of asserting that a component on the screen i just navigated from isn't.

@d4vidi
Copy link
Collaborator

d4vidi commented Feb 2, 2020

@j320 thanks for this. While well articulated, this is a dup of #1185 (pinned).

@d4vidi d4vidi closed this as completed Feb 2, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 5, 2020
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

3 participants