2022-08-18 09:02:00 +00:00
|
|
|
const MacRunner = require('../../mac-runner')
|
|
|
|
const { compressPngImage } = require('../../utils')
|
2020-08-16 13:49:24 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
run: async (outputPath) => {
|
2022-08-18 09:02:00 +00:00
|
|
|
console.log(
|
|
|
|
'> Recording screencapture disable-shadow with param set to false'
|
2020-11-27 12:45:16 +00:00
|
|
|
)
|
2022-08-18 09:02:00 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const runner = new MacRunner()
|
|
|
|
await runner
|
|
|
|
.openApp('Safari', '-F https://apple.com')
|
|
|
|
.activateApp('Safari')
|
|
|
|
.moveAndResizeApp('Safari', 0, 0, 740 * 2, 413 * 2)
|
|
|
|
// We do not set the default as `captureApp` takes a param to disable shadow
|
|
|
|
.captureApp('Safari', `${outputPath}/false-tmp.png`, false)
|
|
|
|
.killApp('Safari')
|
|
|
|
.run()
|
|
|
|
} catch (runnerError) {
|
2020-08-16 13:49:24 +00:00
|
|
|
logRollbackInfo()
|
2022-08-18 09:02:00 +00:00
|
|
|
throw new Error(runnerError)
|
2020-08-16 13:49:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2022-08-18 09:02:00 +00:00
|
|
|
await compressPngImage(`${outputPath}/false-tmp.png`, outputPath, 'false')
|
2020-08-16 13:49:24 +00:00
|
|
|
} catch (compressPngImageError) {
|
|
|
|
logRollbackInfo()
|
|
|
|
throw new Error(compressPngImageError)
|
|
|
|
}
|
|
|
|
|
2022-08-18 09:02:00 +00:00
|
|
|
return { filepath: `${outputPath}/false` }
|
2020-11-27 12:45:16 +00:00
|
|
|
},
|
2020-08-16 13:49:24 +00:00
|
|
|
}
|
|
|
|
|
2022-08-18 09:02:00 +00:00
|
|
|
function logRollbackInfo() {}
|