I need to automate some UI tests and I have to assert some results that only occur if changing the date on the simulator to a few days the future. Does anyone know any way of doing that on the simulator without having to change the date on my mac or without using xcodebuild command line? I need to be able to change the date multiple times during my tests using different values each time.
The only way for you to test it on your app is to create an Date
wrapper
class DateWrapper {
func currentDate() -> Date {
return Date()
}
}
and mock currentDate()
function according to your test.