Slow performance after playing songs on Spotify

Hey there, I am trying to automate few things for Spotify and I have some performance issues after playing a song.

I am pretty new to Appium so I hope there is something that I’ve missed with my Python script (using Unit tests)

My Python script runs without significant delay when I don’t play any songs, but after playing a song there are 30-60 seconds delay between following actions.

I am using my physical device for the test Xiaomi Poco F4 connected to Mac via USB

I am starting Spotify Activity by:
self.driver.start_activity("com.spotify.music", ".MainActivity")

And playing a song by running this command:
self.driver.find_element(by=AppiumBy.ID, value="com.spotify.music:id/button_play_and_pause").click()

Song starts playing and after that script seems to run slowly, I’ve tried to printing a log from consoleprint(time) after song is played, but I got a log after 30 seconds or so.

After pausing a song script runs without significant delays.

Any help would be appreciated.

Apparently the device you are using is notoriously slow and in addition the OS will throttle performance due to heating issues:

https://www.hard-reset.org/lagging/how-to-fix-slow-xiaomi-poco-f4-to-run-faster-and-more-responsive-fix-lagging-performance/



Best advice is probably to try the strategies outlined in the above articles, but ultimately you may want to go with a phone that has better performance.

Try to reduce the value of waitForIdleTimeout setting as a possible workaround. It might be the playback thread does not let the app to stay in idle mode for long enough.

1 Like

try to disable animation on device OR use capability appium:disableWindowAnimation

Thanks, this solved my problem