Fix waitForView cannot find UITableViewCell or label, and results in UITableView on iOS 11 #1010
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Xcode 9 & iOS 11,
waitForViewWithAccessibilityLabel: @"label text on the cell"
returns itsUITableView
. As commented in the existing code, UITableView is too far in view hierarchy to work with cells level.On iOS 10, it correctly returns
UITableViewCell
orUITableViewLabel
.This PR adds testcases to reproduce issue. (After my some inspections,
tapViewWithAccessibilityLabel
change some unknown states which affects reproducibility, I have added 2 testcases.)Then this patches the view finding logic by searching
-tableViewCell
in addition to-view
.element accessibilityContainer
for table cells is like below:iOS 10:
UITextAccessibilityElement -> accessibilityContainer = UITableViewCell
iOS 11:
UITextAccessibilityElement -> accessibilityContainer = UITableViewCellAccessibilityElement -> accessibilityContainer = UITableView
Thus, we can take
UITableViewCell
on iOS 10, but we unexpectedly go through toUITableView
on iOS 11.