我刚刚开始在我的 React Typescript 项目中使用 Cypress。我有一些简单的测试要运行:
describe('settings page', () => {
beforeEach(() => {
cy.visit('http://localhost:3000')
});
it('starts in a waiting state, with no settings.', () => {
cy.contains('Waiting for settings...')
});
it('shows settings once settings are received', () => {
const state = cy.window().its('store').invoke('getState')
console.log(state) // different question: how do I get this to be the state and not a $Chainer?
});
});
Run Code Online (Sandbox Code Playgroud)
它在 Cypress 中运行得很好。但是我在 Webstorm 中收到 Typescript 错误,说cy没有定义(TS 和 ESlint 错误)和describe说all files must be …