Closed ssuess closed 2 years ago
While doing component testing you need to initialize the Vuex store youself, check out Cypress, Vuex and Vue Test Utils docs about how to test a component which uses Vuex
Cypress AE only do the scaffolding and basic integration for you, but every other kind of setup is on you
If you find out how it's done, please report here the links which helped you so others can use them in the future as well
it is on the component testing, I didn't realize I needed to do other things there since the example components and tests that quasar installed seem to run fine. Is there some documentation on how to make my normal boot files, vuex, and router setup (on which my components depend after all) be used in this cypress testing environment? I can't find any documentation on this that is quasar specific (but maybe it doesn't need to be?). Thanks!
Not right now unluckily Since component testing is meant to test the component in isolation you can always mock Vuex I guess
There is this proposal for Jest AE which is pretty similar, but we still could not find the time to work on it either, any help and contribution on this is welcome
Cypress published their own recipe to setup Vuex with component testing, check it out https://docs.cypress.io/guides/component-testing/custom-mount-vue#Vuex
I have a spec file that mounts a very simple component that checks a value in the vuex store and creates a link. But my test is coming back with a
TypeError: Cannot read properties of undefined (reading 'state')
That seems be coming from this line in my component:Is there something special I need to do for the Vuex store to be recognized in cypress, or is this a bug? My store works fine everywhere in my app, as does the mapState function.