0

I'm writing tests where I want to delete a tableViewCell by swiping it, exposing the red "Delete" editing action. I can swipe the cell fine, but the problem arises when I try to use tapAtPoint.

This is straight from the GREYActions.h:

* @param point The point that should be tapped. It must be in the coordinate system of the element and it's position is relative to the origin of the element, as in (element_width/2, element_height/2) will tap at the center of element.

I've tried using the element's frame and bounds width minus 1 point, and then halfway down the cell like this:

CGPointMake(element.frame.size.width - 1, element.frame.size.height / 2)

I'm still unable to tap the end of the cell.

Please let me know if I can explain further.

ArielSD
  • 829
  • 10
  • 27
  • Have you tried decreasing the `element.frame.size.width - 1`? You might have some content offset or a boundary that might be swallowing the touches. Something like `element.frame.size.width - 20` or so? – gran_profaci May 18 '17 at 21:08

1 Answers1

1

@gran_profaci I took your idea and went the other way with it.

Here's what I learned:

There's a class called UITableViewCellDeleteConfirmationView, and that's what shows when you swipe on a cell. It might be a private class, since you can't access it or match it while iterating through a cell's subviews with

if ([subview class] == [UITableViewCellDeleteConfirmationView class])

Technically, it's as if this view is off screen, and swiping brings it on screen. Because of that, it's actually not within the cell's coordinate system - it's after on the x-axis. For example, if the width of the screen and therefore the width of the tableView and tableViewCell are 600 the confirmationView's frame origin will be something like (600.5, ...).

In the end, I added 5 points to the cell's width, and that worked perfectly.

CGPointMake(element.frame.size.width + 5, element.frame.size.height / 2)
ArielSD
  • 829
  • 10
  • 27