【发布时间】:2021-03-10 13:53:57
【问题描述】:
我正在从赛普拉斯文档中复制代码并返回此错误
cy.intercept is not a function
我的代码直接来自文档...
describe('My First Test', () => {
it('Visit Home Page', () => {
cy.intercept('search/*', [{ item: 'Book 1' }, { item: 'Book 2' }]).as('getSearch')
}
})
不知道为什么会这样?
【问题讨论】:
-
您的系统上安装的 cypress 版本是什么?
-
"cypress": "^5.3.0", -
您必须升级到 v6.0,
cy.intercept()才能工作。 -
它为您解决了问题吗?
-
是的,谢谢!