happo/happo.io

Run browsers in modes that disable animations better

lencioni opened this issue · 0 comments

I know that Happo does some work to try to pause animations to help prevent spurious diffs, however the current techniques are not 100% effective--e.g. when rendering an animated GIF.

I wondered if Happo could run browsers in a way that disables more animations.

I poked around a bit and found this Animation Policy Chrome extension that Google released that does the trick. Trying it out locally, it does exactly what we want for animated GIFs when set to "Disable all image animation". Perhaps Happo can use this extension? It looks like extensions can be loaded with the --load-extension= cli arg, but I'm not entirely sure how to configure it. One option might be to copy the extension locally and modify it to have this behavior by default.

Firefox appears to have a setting image.animation_mode that can be set to 'none' to disable animations. It looks like this can be set in selenium via the FirefoxProfile, e.g.

profile = webdriver.FirefoxProfile();
profile.set_preference('image.animation_mode', 'none');

(There might be some other settings here to improve Firefox as well https://stackoverflow.com/a/21026372/18986)

I didn't spend any time looking into what might be possible in other browsers.