Activating ViewDidAppear in UnitTest:
Before getting to my question, I know there is a question very similar to this one (Unit tests don't call viewDidAppear method) but it doesn't seem quite to answer this.
I am wondering how best to activate viewDidAppear()
on a viewController to test various things that should occur in that method. I am pretty sure that it is poor practice to call viewDidAppear()
directly; so I am wondering how to call it indirectly in a test.
I have followed Natasha's tutorial https://www.natashatherobot.com/ios-testing-view-controllers-swift/ and so have discovered how to activate viewDidLoad()
without needing to call it directly. Near the bottom there is discussion of using beginAppearanceTransition(true, animated: true)
to call it indirectly, but this does not seem to be having the expected outcome for me.
Any advice? Thanks!