我使用的是cypress 4.0.2版本,在配置cypress中的屏幕截图支持时遇到了问题。如果出现错误,则不会创建截图目录,并且该目录中没有转储。
我采取了以下步骤:
a)根据https://docs.cypress.io/guides/references/configuration.html#Screenshots,我在cypress.json中增加了"screenshotsFolder“参数:"cypress / screenshots","trashAssetsBeforeRuns":true,
b)根据https://docs.cypress.io/api/cypress-api/screenshot-api.html#Arguments - in cypress / support,我创建了文件index.js,并在其中添加了: Cypress.Screenshot.defaults ({ screenshotOnRunFailure: true })
我运行了测试,尽管其中两个有错误,但目录和屏幕截图都没有创建。
发布于 2020-04-26 20:39:03
只有手动截图才需要cy.screenshot()。默认情况下会截取屏幕截图。我在4.4.1中也遇到了同样的问题。我没有更改任何设置,但我的屏幕截图不再在出错时被捕获。
https://stackoverflow.com/questions/60551606
复制相似问题