# SVG Loader
# SVG element is removed
📺 Watch this recipe in the video SVG Loader Example (opens new window).
cy.get('.loader svg').should('be.visible')
cy.get('.loader svg').should('not.exist')
cy.contains('.loader', 'Loaded')
# SVG animation finishes
Imagine we want to know when the SVG animation finishes. From the spec code we can listen to the endEvent
event on the animateTransform
element. By using a cy.spy
and its assertion have.called
we can automatically wait in our test.
📺 Watch this recipe in the video Wait For SVG Animate Transform End Event (opens new window)
cy.get('.loader svg')
.should('be.visible')
.find('animateTransform')
.invoke('on', 'endEvent', cy.spy().as('animate'))
// wait for the animation to finish
cy.get('@animate').should('have.been.called')