This was happening with my HTC One M8 (Lollipop). It is still happening with my new Droid Turbo 2 (Lollipop and Marshmallow). Gmail notifications work fine on cell network. Then when I switch over to wifi, I do not get notifications until I go to the Gmail app and swipe down to refresh. After that refresh I will continue to get notifications (until I go on cell then back to wifi again).