【发布时间】:2022-12-10 05:10:45
【问题描述】:
在 Angular 应用程序中,我想访问 Cypress 测试中的 App State。
我遵循了以下建议: How to use Angular Store in Cypress e2e tests
到目前为止没有任何效果。我目前的设置:
export interface IWindowCypress {
store: Store;
Cypress: unknown;
}
export class AppComponent {
constructor(protected store: Store) {
const windowWithStore: IWindowCypress = window as unknown as IWindowCypress;
console.log('AppComponent');
if (windowWithStore.Cypress) {
console.log('save store');
windowWithStore.store = store;
}
}
}
在柏树边,
describe('My First Test', () => {
before(() => {
cy.window().its('store').should('have.length', 6)
})
此设置没有类型错误。但是在 Cypress 测试中,cy.window.store 不存在。我试过传递一个数组而不是一个商店,甚至在赛普拉斯方面也不存在。关于如何解决此问题的任何想法?
【问题讨论】:
标签: angular cypress ngrx ngrx-store