Quantcast
Channel: How to expose/access a data store like Redux within a cypress test? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by euZebe for How to expose/access a data store like Redux within a cypress test?

$
0
0

Based on the answer about Vuex, I did that, which works:

// after createStore(...)if (window.Cypress) {  window.__store__ = store;}// in cypress testscy.window().should('have.property', '__store__');cy.window().its('__store__')  .then(    store => store.dispatch({ type: 'UPDATE_CURRENT_PROFILE' })  );

Don't forget to cy.visit('anyRoute') before doing anything with the store, so that React app is started and redux store is already created when you try to access it.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>