Using the snap app spotify for ubuntu 18.04 on a laptop. I noticed that if i used spotify it would play about 1 or 2 songs and then it would stop and go offline and would turn off the internet for everything I was using. I was able to fix this but it seems that the auto detect proxy settings are the culprit and need a fix. When I disabled the proxy it started to work.
So to fix your your problem I suggest that you go to the top right of the spotify app and find the down arrow > settings > Scroll down > advanced settings > proxy
click on the dropdown bar that says auto detect and set to No Proxy then you Press the Update Proxy button. Restart your wifi and spotify, I found entering airplane mode or doing a full restart of the machine will reenable the wifi correctly. It should be working at that point. Hope I helped!