How can one go about unit-testing pieces of iOS code that work in a non-trivial graphical setup?
Consider for instance view controllers A and B, where A stacks B on top with performSegueWithIdentifier:sender:. A unit test should check the behavior of a C that depends on the two view controllers being arranged like that.
performSegueWithIdentifier:sender: works asynchronously, i.e. the unit test would end before it has completed its task unless one lets the unit test wait for something like an XCTestExpectation. But in a case like this neither B nor C is prepared to call fulfill on that expectation.
Is there a way forward in situations like this, i.e. for testing asynchronous UI code without ready hooks for calling fulfill?