square/KIF — Issue #105: picking photo fails (image-specific, timing-specific)
Author: drewcrawford
Created: 2012-01-10 08:29:11+00:00
State: open

This issue is (unfortunately) not consistently reproducible. I have several screens in an application that are completely identical, and it will reproduce for some and not for others. Perhaps it is a race condition or is timing-related. I am not sure that it can be fixed without a reproducing test case, but I wanted to document it in case others ran into it.

I placed [this picture](http://boourns.cjb.net/aperturescience.png) into my camera roll by using "Save Image" in Safari.

Then I would show the media picker and call `+ (NSArray *)stepsToChoosePhotoInAlbum:(NSString *)albumName atRow:(NSInteger)row column:(NSInteger)column;`.

My log would show:

```
[DEBUG] 2012-01-10 01:42:06.918 appKIF[95955:15503] PASS (0.01s): Select the "Saved Photos" photo album

[DEBUG] 2012-01-10 01:42:07.436 appKIF[95955:15503] PASS (0.52s): Wait for media picker view controller to be pushed.
```

At this point, the program would terminate. No crash log would be written, and nothing is shown in the console. ios-sim shows an exit code of 0.

At first, my suspicion was that something odd was going on in the hit test where the thumbnail is tapped. Being essentially donut-shaped, it's possible that the line is doing a hit test back to the view behind the photo picker.

However, a white image fails to show the same behavior.

I have [uploaded a video](http://dl.dropbox.com/u/59605/4178-evil-bug.m4v) in case it sheds any light on the matter. A frame-by-frame analysis of the exit is most peculiar. It appears that the status bar unloads first, followed by a return to Springboard, followed by a slide gesture, followed by Springboard getting stuck in-between two home screens. There is nothing either in my application or in its test suite that would obviously produce such behavior. The steps that follow selecting the photo are waiting for the appearance of views, so the test cannot be progressing silently farther.

After replacing that picture with an arbitrary photo, the issue goes away.

This is one of the strangest bugs I have ever seen.