Skip to content

Commit

Permalink
Use screenshot name as is
Browse files Browse the repository at this point in the history
  • Loading branch information
tianfeng92 committed Sep 13, 2023
1 parent ddc57aa commit 598bc94
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,7 @@ export default class SauceReporter implements Reporter {
break;
}

const filename = `${path.basename(path.dirname(attachment.path || ''))}-${path.basename(attachment.path || '')}`;
// Rename the screenshot using the generated filename.
const ouputDir = rootSuite.project()?.outputDir || '__assets__';
const newAttachmentPath = path.join(ouputDir, filename)
fs.renameSync(attachment.path || '', newAttachmentPath);

const filename = path.basename(attachment.path || '');
test.attach({
name: attachment.name,
path: filename,
Expand All @@ -320,7 +315,7 @@ export default class SauceReporter implements Reporter {
if (attachment.path) {
assets.push({
filename,
data: fs.createReadStream(newAttachmentPath),
data: fs.createReadStream(attachment.path),
});
} else if (attachment.body) {
assets.push({
Expand Down

0 comments on commit 598bc94

Please sign in to comment.