-
-
Save GlickG/302b53a0c0892ff213d02329b1662a25 to your computer and use it in GitHub Desktop.
cypress disable basic css transitions + animations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cypress.Commands.add('cssDisableMotion', (selector = 'head') => { | |
cy.get('html').then(() => { | |
document.querySelector(selector).insertAdjacentHTML('beforeend', ` | |
<style> | |
/* Disable CSS transitions. */ | |
* { -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important; } | |
/* Disable CSS animations. */ | |
* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; } | |
/* Reset values on non-opaque/offscreen framer-motion components. */ | |
*[style*="opacity"] { opacity: 1 !important; } | |
*[style*="transform"] { transform: none !important; } | |
</style> | |
`); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment