Moi*_*med 4 regression cypress
我正在做一个视觉回归,我比较了相同 URL 但在不同环境中的两个屏幕截图。我正在从生产中获取屏幕截图并将其与从测试环境中获取的快照进行比较。那么谁能告诉我如何在开始测试运行之前删除上次运行中存储的所有屏幕截图。我想将它添加到 cypress 默认值中或作为选项添加,这样我就不必每次都手动添加
describe('Visual regression for elements in hotnews section', () => {
beforeEach(() => {
cy.viewport("macbook-15")
})
it('Take the screenshot of entire hot-news section in prod env', () => {
cy.visit("https://www.thequint.com/hot-news")
cy.get("#container").first().matchImageSnapshot('Hot-news',{coverage: 'fullpage'})
})
it('compare the screenshot of the hotnews section with the one taken in beta env', () => {
cy.visit('/hot-news',{failOnStatusCode: false})
cy.get("#container").matchImageSnapshot('Hot-news',{coverage: 'fullpage'})
})
})
Run Code Online (Sandbox Code Playgroud)
我希望您必须"trashAssetsBeforeRuns": true在cypress.json文件中设置该选项,这将在每次测试运行之前删除screenshotsFolder和videosFolder。
希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
1876 次 |
| 最近记录: |