在我的 E2E Cypress 测试中,我想访问被测应用程序的 Redux 存储并调度一些操作来更改某些 redux 存储值。我已经阅读了一些关于从 Cypress (https://www.cypress.io/blog/2018/11/14/testing-redux-store/) 访问 Redux 商店的博客和教程,我需要在 src/index.js 中公开应用程序商店,它应该位于应用程序包中.
供您参考,我们的“被测应用程序”和 Cypress 测试位于不同的项目结构(不同的包名称)中。
const store = createStore(reducer)
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)
// expose store when run in Cypress
if (window.Cypress) {
window.store = store
}
赛普拉斯是否可以访问在不同包中运行的应用程序的 redux 存储?