I am running a simple test inside my app which should tap and verify every single row inside a TableView (is the Settings view of my application so every single row is loaded from the disk and nothing is downloaded from the web at this step), but for a strange reason when I tap on a row which previously wasn't visible the .tap() method doesn't work.
Example Code:
let app = XCUIApplication()
let myTableView = app.tables.element(matching: .table, identifier: "tableView01")
myTableView.swipeUp(). //I swipe so that the cell becomes visible...
let myCell = myTableView.cells.element(matching: .cell, identifier: "tappableCell")
myCell.tap()
The strange thing is that I have a correct output from the console in Xcode .
t = 328.24s Tap "tappableCell" Cell
t = 328.24s Wait for app to idle
t = 328.80s Find the "tappableCell" Cell
t = 328.80s Snapshot accessibility hierarchy for com.thefloow.enterprise.ownbrand
t = 328.92s Find: Descendants matching type Table
t = 328.92s Find: Element at index 0
t = 328.92s Find: Descendants matching type Cell
t = 328.92s Find: Elements matching predicate '"tappableCell" IN identifiers'
t = 329.04s Wait for app to idle
t = 329.22s Synthesize event
t = 329.37s Wait for app to idle
Another strange thing is that if I put a breakpoint before the tap method and then I run it from the command line it works perfectly giving me the same output from the console.
What could be the reason of this strange behaviour?
Thank you for your help! Andrea
I found that the problem is in the framework. After scrolling the UI doesn't respond properly so I had to double tap on the cell to resign the UIResponder and then the test works properly. I've also reported the issue to to know if it is a regular behaviour or not.
However thank you to everyone! Happy coding!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.