In my test code I am registering a method to listen for a particular event. My intention is when this method is called, I can continue test execution between screen transitions. Couple of approaches I am trying to solve this with.
Approach 1: (Notification Center for listening to events)
App code:
NotificationCenter.default.post(name: Notification.Name.PageLoadCompleteTestReady, object: nil)
Test Code:
// Click to load a new screen
NotificationCenter.default.addObserver(self, selector: #selector(self.printState), name: NSNotification.Name.PageLoadCompleteTestReady, object: nil)
// Continue execution on new screen.
Approach 2: (Implement the delegates under App module, by importing the Module in UI test code)
But none of the above methods seem to work. With approach 1: the notification observer on the test side is not being called. With approach 2: The class that implemented the delegate under test code base is not being called but on the Module is being called.