Skip to content

Current Notification Click Test Results

Jason Pang edited this page Mar 30, 2017 · 1 revision
  • All tests with "Event Available" means the notification.click event is available on the target tab if the developer calls addListenerForNotificationOpened(). The event does not automatically fire after SDK initialization until the developer calls addListenerForNotificationOpened(). Also, once the available event is fired, it won't be returned again (removed from database).

  • "Event Fired" as opposed to "Event Available" means the event is fired without the developer having to call anything (except the developer has to listen to the event).

Test Setting > Test Action > Test Results

Test Environment: HTTPS, notificationClickHandlerMatch: 'exact' (default), notificationClickHandlerAction: 'navigate' (default)

No Tabs > Send Notification w/ Some URL > Opens New Tab, Event Available 1 Tab > Send Notification w/ Different URL > Opens New Tab, Event Available on Opened Tab 1 Tab > Send Notification w/ Identical URL > Focuses Existing Tab, Event Fired 3 Tabs > Send Notification w/ Different URL (none match) > Opens New Tab, Event Available on Opened Tab (identical to 1 tab test) 3 Tabs > Send Notification w/ Matching URL (one match) > Focuses Existing Tab, Event Fired on Correct Tab


Test Change: Changing notificationClickHandlerMatch from 'exact' --> 'origin'

Test Environment: HTTPS, notificationClickHandlerMatch: 'origin' (default), notificationClickHandlerAction: 'navigate' (default)

No Tabs > Send Notification w/ Some URL > Opens New Tab, Event Available 1 Tab > Send Notification w/ Different URL > Last opened tab is focused, and navigated to the notification's URL. Event available on navigated tab. 1 Tab > Send Notification w/ Identical URL > Last opened tab (this is the only existing tab) is focused, Event Fired 3 Tabs > Send Notification w/ Different URL (none match) > Last opened tab is focused, and navigated to the notification's URL. Event available on navigated tab 3 Tabs > Send Notification w/ Matching URL (one match) > Last opened tab is focused, and navigated to the notification's URL. Event available on navigated tab, and if the last opened tab that was navigated still leaves an existing tab with a matching URL, that existing tab with a matching URL could also get that event. So there could be two tabs with matching URLs, since the randomly last opened tab is focused and navigated. However, only one tab can get the event, since it is removed after retrieval.

==============================================================================================================

Test Change: Changing notificationClickHandlerMatch from 'exact' --> 'origin' Test Change: Changing notificationClickHandlerAction from 'navigate' --> 'focus'

Test Environment: HTTPS, notificationClickHandlerMatch: 'origin' (default), notificationClickHandlerAction: 'focus' (default)

No Tabs > Send Notification w/ Some URL > Opens New Tab, Event Available 1 Tab > Send Notification w/ Different URL > Last opened tab is focused, event fired. 1 Tab > Send Notification w/ Identical URL > Last opened tab is focused, event fired. 3 Tabs > Send Notification w/ Different URL (none match) > Last opened tab is focused, event fired. 3 Tabs > Send Notification w/ Matching URL (one match) > Last opened tab is focused, event fired.

==============================================================================================================

Test Change: HTTPS --> HTTP

Test Environment: HTTP, notificationClickHandlerMatch: 'exact' (default), notificationClickHandlerAction: 'navigate' (default)

No Tabs > Send Notification w/ Some URL > Opens New Tab, Event Available 1 Tab > Send Notification w/ Different URL > Opens New Tab, Event Available on Opened Tab 1 Tab > Send Notification w/ Identical URL > Focuses Existing Tab, Event Fired 3 Tabs > Send Notification w/ Different URL (none match) > Opens New Tab, Event Available on Opened Tab (identical to 1 tab test) 3 Tabs > Send Notification w/ Matching URL (one match) > (!WEB PUSH BUG) Opens new tab, event available on new tab/matching URL of existing tab (WEB PUSH BUG)

Web Push Bug: Because an HTTP site is undiscoverable to the controlling service worker (the service worker only knows about the OneSignal iFrame to https://subdomain.onesignal.com), the HTTP page reports its actual page URL by placing a value in IndexedDB called lastKnownHostUrl. A web push bug is that if multiple HTTP sites are open, the last opened site tab will overwrite lastKnownHostUrl with its value. The effect of this is as follows. If a user opens http://site.com/a, http://site.com/b, and http://site.com/c, the lastKnownhostUrl will only be http://site.com/c. When a notification is sent with the launch URL to http://site.com/b, and notificationClickHandlerMatch is exact and notificationClickHandlerAction is navigate, the existing http://site.com/b tab will not be focused, and a new tab will be opened instead. This is because the service worker does not know that tab http://site.com/b exists.


Test Change: HTTPS --> HTTP Test Change: Changing notificationClickHandlerMatch from 'exact' --> 'origin'

Test Environment: HTTP, notificationClickHandlerMatch: 'origin' (default), notificationClickHandlerAction: 'navigate' (default)

No Tabs > Send Notification w/ Some URL > Opens New Tab, Event Available 1 Tab > Send Notification w/ Different URL > Last opened tab is focused, and navigated to the notification's URL. Event available on navigated tab. (!This is the original bug reported by two clients when we changed the click behavior.) 1 Tab > Send Notification w/ Identical URL > Last opened tab (this is the only existing tab) is focused, Event Fired 3 Tabs > Send Notification w/ Different URL (none match) > Last opened tab is focused, and navigated to the notification's URL. Event available on navigated tab 3 Tabs > Send Notification w/ Matching URL (one match) > Due to web push bug reported above, last opened HTTP tab (since that is all that is saved in lastKnownHostUrl by the last opened HTTP tab) is focused and navigated to the notification's URL. Event available on navigated tab.


Test Change: HTTPS --> HTTP Test Change: Changing notificationClickHandlerMatch from 'exact' --> 'origin' Test Change: Changing notificationClickHandlerAction from 'navigate' --> 'focus'

Test Environment: HTTP, notificationClickHandlerMatch: 'origin' (default), notificationClickHandlerAction: 'focus' (default)

No Tabs > Send Notification w/ Some URL > Opens New Tab, Event Available 1 Tab > Send Notification w/ Different URL > Last opened tab is focused, event fired. 1 Tab > Send Notification w/ Identical URL > Last opened tab is focused, event fired. 3 Tabs > Send Notification w/ Different URL (none match) > Last opened tab is focused, event fired. 3 Tabs > Send Notification w/ Matching URL (one match) > Last opened tab is focused, event fired. Due to web push bug, matching tab is not fired.