RedRoses
RedRoses

Reputation: 337

Clicking "Okay" on a UIAlertView only if it happens to show up

I have an iOS application that occasionally displays UIAlertViews. For example, if the user is close to a certain location, show them an alert, unless we've already showed them the alert within the past hour.

How can I test this with KIF? The alerts do not always appear, so I can't wait on them. I want to be able to click on "Okay" only if the alert shows up. If it does not show up, continue on.

I know that there are no conditionals in KIF, but can I still test this somehow?

Upvotes: 1

Views: 188

Answers (1)

Simon
Simon

Reputation: 25993

What condition do the alerts show up on? Can you cause that condition to be true or false in your tests? It seems like you'd be better off with a test that it does show up when it's true, and a test that it doesn't show up when it's false, than a single test that executes differently depending on the environment outside your tests.

Upvotes: 2

Related Questions