Monday 12 July 2021

What is the correct way to access Vuex getters from Cypress?

I have a getter called viewItems in my Vuex store, returning an array. I can access it from my Cypress test with:

Cypress.Commands.add("getStore", () => {
  return cy.window().its("app.$store");
});

cy.getStore().its("getters.viewItems.length").should("equal", 13);

It works, but I get an error on the console when running Cypress:

[Vue warn]: Property or method "nodeType" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties

Is there a better way to access getters, or is it something else?



from What is the correct way to access Vuex getters from Cypress?

No comments:

Post a Comment