Copy LCP and LS images (#3371)

This commit is contained in:
Peter Hedenskog 2021-05-03 13:50:46 +02:00 committed by GitHub
parent 959981154d
commit e26e8fa44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 15 deletions

View File

@ -49,23 +49,33 @@ module.exports = {
// We can have multiple screenshots (taken by the user) and
// only use the standard one
for (let screenshot of message.data.screenshots) {
if (screenshot.indexOf('afterPageCompleteCheck') > -1) {
if (
/afterPageCompleteCheck|layoutShift|largestContentfulPaint/.test(
screenshot
)
) {
const type = screenshot.substring(
screenshot.lastIndexOf('/') + 1,
screenshot.lastIndexOf('.')
);
imagePath = screenshot;
}
const imageFullPath = path.join(baseDir, imagePath);
await this.storageManager.copyFileToDir(
imageFullPath,
newPath +
'/' +
name +
(type !== 'afterPageCompleteCheck' ? `.${type}` : '') +
'.' +
options.browser +
'.' +
connectivity +
'.' +
this.screenshotType
);
} else console.log(screenshot);
}
const imageFullPath = path.join(baseDir, imagePath);
await this.storageManager.copyFileToDir(
imageFullPath,
newPath +
'/' +
name +
'.' +
options.browser +
'.' +
connectivity +
'.' +
this.screenshotType
);
}
if (options.browsertime && options.browsertime.video) {
const videoFullPath = path.join(baseDir, message.data.video);