mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-07 23:40:21 -05:00
af26fbebe6
Co-authored-by: Jessica Sachs <jess@jessicasachs.io> Co-authored-by: Barthélémy Ledoux <bart@cypress.io> Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> Co-authored-by: Zach Bloomquist <github@chary.us> Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com> Co-authored-by: ElevateBart <ledouxb@gmail.com> Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
25 lines
663 B
TypeScript
25 lines
663 B
TypeScript
import screenshots from '../screenshots'
|
|
|
|
export function Screenshot (screenshotsFolder: string) {
|
|
return {
|
|
capture (data, automate) {
|
|
return screenshots.capture(data, automate)
|
|
.then((details) => {
|
|
// if there are no details, this is part of a multipart screenshot
|
|
// and should not be saved
|
|
if (!details) {
|
|
return
|
|
}
|
|
|
|
return screenshots.save(data, details, screenshotsFolder)
|
|
.then((savedDetails) => {
|
|
return screenshots.afterScreenshot(data, savedDetails)
|
|
})
|
|
}).catch((err) => {
|
|
screenshots.clearMultipartState()
|
|
throw err
|
|
})
|
|
},
|
|
}
|
|
}
|