Synchronise webhook test by waiting for events before triggering hook

This prevents the occasional "Request failed:" error messages from
showing up in STDOUT, as the webhook is only triggered once all other
HTTP requests have completed.