赛普拉斯Vuex访问模块存储状态

问题描述

我有一个使用vuex的应用程序。已设置Vuex,以便每个模块都有其自己的状态。

示例设置:

const store = new Vuex.Store({
  state: {
    app: window.application,view: ''
  },modules: {
    checkout,account,navigation
  }


然后模块具有其自己的状态。 示例:

const checkout = {
    namespaced: true,// IMPORTANT for modules
    state: {
        site: null,deliveryType: 'homeDelivery',deliveryOption: 'standardDelivery',manualAddressActive: false,}
}

我已经像这样启动了应用程序:

const app = new Vue({
    el: '#baseMountTarget',api,i18n,router,store,render: h => h(Base)
});

if(window.Cypress) {
    window.app = app;
}

现在我的问题是如何访问赛普拉斯中的模块状态?通过执行以下操作,我只能访问基本状态,而不能访问模块状态,并且我无法确定如何访问模块状态

context('DeliveryOption',() => {
   describe('Delivery option home delivery',() => {
        it('Should have active class for home delivery',() => {
            const getStore = () => cy.window().its('app.$store');

            getStore().its('state.deliveryType').should('equal','homeDelivery');
        });
})

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)