diff --git a/src/engine-scripts/puppet/disableAnimations.js b/src/engine-scripts/puppet/disableAnimations.js new file mode 100644 index 00000000..d42293e3 --- /dev/null +++ b/src/engine-scripts/puppet/disableAnimations.js @@ -0,0 +1,18 @@ +async function disableAnimations( page ) { + page.on( 'load', () => { + const content = `*, + *::after, + *::before { + transition-delay: 0s !important; + transition-duration: 0s !important; + animation-delay: -0.0001s !important; + animation-duration: 0s !important; + animation-play-state: paused !important; + caret-color: transparent !important; + }`; + + page.addStyleTag( { content } ); + } ); +} + +module.exports = disableAnimations; diff --git a/src/engine-scripts/puppet/onReady.js b/src/engine-scripts/puppet/onReady.js index add4357e..6365ec59 100644 --- a/src/engine-scripts/puppet/onReady.js +++ b/src/engine-scripts/puppet/onReady.js @@ -2,6 +2,7 @@ const deferToFrame = require( './deferToFrame' ); const fastForwardAnimations = require( './fastForwardAnimations' ); const waitForIdle = require( './waitForIdle' ); const clickBtn = require( './clickBtn' ); +const disableAnimations = require( './disableAnimations' ); /** * Runs after onReady event on all scenarios -- use for simulating interactions. @@ -17,6 +18,8 @@ module.exports = async ( page, scenario ) => { // Make sure the main skin JavaScript module has loaded. await require( './jsReady' )( page, hashtags ); + await disableAnimations( page ); + // These only apply to Vector 2022 if ( hashtags.includes( '#vector-2022' ) ) { await require( './limitedWidth' )( page, hashtags );