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

Fix waitForView cannot find UITableViewCell or label, and results in UITableView on iOS 11 #1010

Merged

Conversation

banjun
Copy link
Contributor

@banjun banjun commented Sep 22, 2017

On Xcode 9 & iOS 11, waitForViewWithAccessibilityLabel: @"label text on the cell" returns its UITableView. 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 or UITableViewLabel.

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 to UITableView on iOS 11.

@designatednerd
Copy link

Guh, thank you for the detailed explanation, it explains some really odd failures I was seeing (entire table view getting swiped off to the side when trying to swipe to open the delete functionality).

@@ -83,6 +83,20 @@ - (void)testTappingRowUnderToolbarByLabel
[tester tapViewWithAccessibilityLabel:@"Cell 32"];
}

- (void)testWaitingRowByLabel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the equivalent tests for TableViewTests_ViewTestActor.m. We'd like to shift people towards using the new syntax and should have test parity between viewTester and tester.

@justinseanmartin
Copy link
Contributor

Thank you for the contribution and for adding tests that validate the fix! Please squash the commits and address the one piece of feedback and we'll get this merged.

Separately, I'm going to try and get back to having CI working on latest versions of Xcode (#974) so we can ensure this doesn't regress going forward.

@justinseanmartin justinseanmartin moved this from To Do to In Progress in Xcode 9 / iOS 11 Sep 25, 2017
…tually returns UITableView and let it return its tableViewCell

`-[UITableViewCellAccessibilityElement tableViewCell]` is found in: Xcode 9 UIAccessibility.framework
@banjun
Copy link
Contributor Author

banjun commented Sep 26, 2017

Added paired testcases to ViewTestActor and squashed.

@justinseanmartin justinseanmartin merged commit 98e75d6 into kif-framework:master Sep 26, 2017
@justinseanmartin justinseanmartin moved this from In Progress to Done in Xcode 9 / iOS 11 Sep 26, 2017
@banjun banjun deleted the ios11-find-tableviewcell-fix branch September 26, 2017 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants