Talk given at CocoaHeads Nantes 15/02/2018
Based on Jörn Schoppe idea for testing push notifications with UI Tests, I took a step forward in order to handle notifications with actions and text inputs. In the project the notifications are handled from the Springboard, but by using userNotificationCenter(_:willPresent:withCompletionHandler:) we could interact with the received notifications while the app is in the foreground.
Also a UI Test example on interacting with the Control Center from the Springboard is added.
- Xcode 9.3
- Swift 4.0
- iOS 11.2.5+
- CocoaPods
Remember to setup the app in Apple Developer website
- Create the project's AppID (or set a new one) on your Apple's developer account
- Generate APNS certificate for development environment
- Add certificate to Keychain and extract the .p12 file from it. Don´t forget the password !
- Add the .p12 to UITest project's target.
- Remember to setup NWPusher to push the payload in sandbox environment
- UI Testing: Controlling Control Center iOS 11.2.5
- UI Testing: Push Notification with a Text Input Action iOS 11.2.5
- Testing: Push Notification with an Action iOS 11.2.5
- Testing: Push Notification tap from Springboard iOS 11.2.5
- UI Testing: Push Notification dismiss from Springboard iOS 11.2.5
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Nicolas Garcia GitHub