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

assertVisible is returning true even if the element is not visible inside a scroll view. UiElement bounds are not correctly captured in ViewHierarchy for iOS #1768

Open
prasanta-biswas opened this issue Jun 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@prasanta-biswas
Copy link

Describe the bug
assertVisible is returning true for elements inside a scroll view even if the element is not inside the view port. Similar behaviour is notices with assertNotVisible returning false when element is visible and same happening while using visible/notVisible in rulFLow or repeat commands.

To Reproduce

  1. The app should have a scroll view
  2. Scroll view should have elements with text
  3. Run a flow having and assertVisible for an element in the scroll view which is not inside the view port.

Expected behavior
The command assertVisible should return false for elements that are not inside view port even if they are in a scroll view.

Environment information (please complete the following information):

  • Maestro version: 1.36.30
  • Platform: iOS 15
  • Framework: Native iOS
  • Device model and OS version: iPhone6 Simulator
  • Host: Mac M1
@prasanta-biswas prasanta-biswas added the bug Something isn't working label Jun 17, 2024
@prasanta-biswas prasanta-biswas changed the title assertVisible is returning true even if the element is not visible inside a scroll view assertVisible is returning true even if the element is not visible inside a scroll view. UiElement bounds are not correctly captured in ViewHierarchy for iOS Jun 21, 2024
@prasanta-biswas
Copy link
Author

prasanta-biswas commented Jun 21, 2024

@prasanta-biswas
Copy link
Author

The suggestion provided is not working

// This function should be implemented in a class conforming to UITableViewDelegate
// in case of UICollectionView `collectionView(_:willDisplay:forItemAt:)` from
// UICollectionViewDelegate should be used
func tableView(_ tableView: UITableView,
                   willDisplay cell: UITableViewCell,
                   forRowAt indexPath: IndexPath) {
  // additional check whether the cell is currently visible or not is needed
  // to make sure calls caused by XCTest or other random tableView reloads
  // do not unintentional data fetch request
  guard let visibleIndexPaths = tableView.indexPathsForVisibleRows,
            visibleIndexPaths.contains(indexPath),
            <additional checks that were previosly there> else { return }
        
  print("load new data..")
}

@arthurhammer
Copy link

Same issue here. Suggested workaround is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants