Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
526 views
in Technique[技术] by (71.8m points)

reactcsstransitiongroup - CSSTransition component's callbacks are not called in Cypress testing environment

I've been using this React CSSTransition component:

http://reactcommunity.org/react-transition-group/css-transition

I'm adding Cypress tests. CSSTransition callbacks such as onExited and onEntered always run when I'm walking through my app in a regular browser (Chrome). But in the version of Chrome being automated by Cypress, these callbacks are either never called or never executed.

I wonder if anyone else has run into this issue, or has some ideas about why it's happening, and how to fix it, or work around it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It had to do with cy.clock. If you use cy.clock earlier in the test, you need to use cy.tick, or

        cy.clock().then((clock) => {
            clock.restore()
        })

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...