-
Notifications
You must be signed in to change notification settings - Fork 23
Make example with Vuex #6
Comments
Would help with https://github.com/bahmutov/array-explorer/issues/2 |
@bahmutov If you're not still working on this I can take stab it. I noticed the test was failing due the component not getting rendered at all. The issue was with Vuex not being installed on the root Vue instance, and also the test was testing for a non-existent import Vuex from 'vuex'
//...
const extensions = {
plugins: [Vuex],
components: {
counter: Counter
},
}
const template = '<counter />'
beforeEach(mountVue({template, store}, { extensions })) I confirmed that I also noticed the currently disabled/undocumented I was just looking at things quickly, but I'll come back and work it on some work when I get the chance, and if you find it helpful. |
Absolutely, @amirrustam take a stab at it. Basically I understand that our problem is loading components in test iframe, but then mounting them in app iframe. I had same issue with RouterLink when using vue-router in these tests https://github.com/bahmutov/vue-hackernews-2.0 See file https://github.com/bahmutov/vue-hackernews-2.0/blob/master/cypress/integration/item-spec.js specifically. |
@bahmutov We both arrived at the same conclusion (iframes!) here. I'll be happy to look into this, should be interesting. |
The inner Vue instance within Vuex Store must be refeshed by `resetStoreVM` to restore reactivity of the store state. This doesn’t fix stale mapped getters within components. That’s a separate WIP issue.
Current mapped vuex getters within components become stale. To have a working Counter example, the computed mapped `evenOrOdd` is accessed directly via `$store`. This will be changed back once the stale mapped getter issue (WIP) is fixed.
Added tests to cover all the features within the component. Fixes cypress-io#6
* fix: vuex integration (#6) The inner Vue instance within Vuex Store must be refeshed by `resetStoreVM` to restore reactivity of the store state. This doesn’t fix stale mapped getters within components. That’s a separate WIP issue. * fix: stale mapped getter `evenOrOdd` (#6) Current mapped vuex getters within components become stale. To have a working Counter example, the computed mapped `evenOrOdd` is accessed directly via `$store`. This will be changed back once the stale mapped getter issue (WIP) is fixed. * feat: added example tests for Counter component Added tests to cover all the features within the component. Fixes #6 * minor: following better practices
Refactors how the Vue instance within the component app frame is initialized, and fully fixes Vue integration. - fixes lingering issues after pull request cypress-io#13 - fully fixes cypress-io#6 - fixes #1 - README docs have been updated to reflect refactoring - 'vue' option has been deprecated (with warning to user) as it's no longer necessary - spread operator support has been added for upcoming Vuex example
To thoroughly demonstrate Vuex support after the refactoring in commit e8773383, Counter.vue now: - Utilizes all Vuex mapping functions. - Can properly use computed mapped getters in its template. This was an issue after cypress-io#13. - Set count state via an input field to demonstrate mapped mutations. Two tests have been added to the spec for this new input field. Close cypress-io#6
* fix: vuex integration (#6) The inner Vue instance within Vuex Store must be refeshed by `resetStoreVM` to restore reactivity of the store state. This doesn’t fix stale mapped getters within components. That’s a separate WIP issue. * fix: stale mapped getter `evenOrOdd` (#6) Current mapped vuex getters within components become stale. To have a working Counter example, the computed mapped `evenOrOdd` is accessed directly via `$store`. This will be changed back once the stale mapped getter issue (WIP) is fixed. * feat: added example tests for Counter component Added tests to cover all the features within the component. Fixes #6 * minor: following better practices * fix: refactor Vue initialization in app frame Refactors how the Vue instance within the component app frame is initialized, and fully fixes Vue integration. - fixes lingering issues after pull request #13 - fully fixes #6 - fixes amirrustam#1 - README docs have been updated to reflect refactoring - 'vue' option has been deprecated (with warning to user) as it's no longer necessary - spread operator support has been added for upcoming Vuex example * feat: enhanced Vuex Counter example and test spec To thoroughly demonstrate Vuex support after the refactoring in commit amirrustam/cypress-vue-unit-test@e8773383, Counter.vue now: - Utilizes all Vuex mapping functions. - Can properly use computed mapped getters in its template. This was an issue after #13. - Set count state via an input field to demonstrate mapped mutations. Two tests have been added to the spec for this new input field. Close #6 * minor: remove redundant declaration
* working on Vuex example for cypress-io/cypress-vue-unit-test#6 * fix: Vuex integration and add Counter example tests (cypress-io/cypress-vue-unit-test#13) * fix: vuex integration (bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6) The inner Vue instance within Vuex Store must be refeshed by `resetStoreVM` to restore reactivity of the store state. This doesn’t fix stale mapped getters within components. That’s a separate WIP issue. * fix: stale mapped getter `evenOrOdd` (bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6) Current mapped vuex getters within components become stale. To have a working Counter example, the computed mapped `evenOrOdd` is accessed directly via `$store`. This will be changed back once the stale mapped getter issue (WIP) is fixed. * feat: added example tests for Counter component Added tests to cover all the features within the component. Fixes bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6 * minor: following better practices * Full Vuex support with enhanced Counter.vue example and test spec (cypress-io/cypress-vue-unit-test#15) * fix: vuex integration (bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6) The inner Vue instance within Vuex Store must be refeshed by `resetStoreVM` to restore reactivity of the store state. This doesn’t fix stale mapped getters within components. That’s a separate WIP issue. * fix: stale mapped getter `evenOrOdd` (bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6) Current mapped vuex getters within components become stale. To have a working Counter example, the computed mapped `evenOrOdd` is accessed directly via `$store`. This will be changed back once the stale mapped getter issue (WIP) is fixed. * feat: added example tests for Counter component Added tests to cover all the features within the component. Fixes bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6 * minor: following better practices * fix: refactor Vue initialization in app frame Refactors how the Vue instance within the component app frame is initialized, and fully fixes Vue integration. - fixes lingering issues after pull request bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#13 - fully fixes bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6 - fixes amirrustam/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#1 - README docs have been updated to reflect refactoring - 'vue' option has been deprecated (with warning to user) as it's no longer necessary - spread operator support has been added for upcoming Vuex example * feat: enhanced Vuex Counter example and test spec To thoroughly demonstrate Vuex support after the refactoring in commit amirrustam/cypress-vue-unit-test@e8773383, Counter.vue now: - Utilizes all Vuex mapping functions. - Can properly use computed mapped getters in its template. This was an issue after bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#13. - Set count state via an input field to demonstrate mapped mutations. Two tests have been added to the spec for this new input field. Close bahmutov/cypress-vue-unit-testbahmutov/cypress-vue-unit-test#6 * minor: remove redundant declaration
Make example with Vuex that extends Vue and use data store from a component. This looks like a good code example https://github.com/vuejs/vuex/tree/dev/examples/counter
The text was updated successfully, but these errors were encountered: