iOS: How to determine notification name for use with "mobile: expectNotification" command?

Hello all, I’m trying to write a test that asserts my app receives a notification using the mobile: expectNotification command provided by the XCUItest driver. One of the required arguments to this command is the notification’s “name”.

The example in the driver documentation (here) implies it should be the bundle identifier of the app sending the notification, but that hasn’t worked. I’ve tried tried all of the below possibilities, to no avail

  • Bundle identifier (aka the apns topic) (co.my-company.name)
  • Bundle identifier plus app name (co.my-company.name.app)
  • The verbatim text of the notification
  • The verbatim name of the app
  • The string “alert” (aka the apns push type)

If it helps, I’m using PyAPNs2 to send the notification from my server.

Appium Inspector only shows UI attributes of the notification as well, so I haven’t been able to determine its “name” in that way either.

I’d appreciate any assistance you can offer!

You need to check with developers the details for XCTNSNotificationExpectation | Apple Developer Documentation in order to pass correct arguments to this method.

1 Like

Thanks for that–if those are the supported notification types, I think I have misunderstood this command to apply to push notifications when it does not.