Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(playwright): fix copyFile error #104

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/playwright/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ class ArgosReporter implements Reporter {
await writeFile(path, body);
}

async copyFile(from: string, to: string) {
const dir = dirname(to);
if (dir !== this.uploadDir) {
await mkdir(dir, { recursive: true });
}
await copyFile(from, to);
}

getAutomaticScreenshotName(test: TestCase, result: TestResult) {
let name = test.titlePath().join(" ");
name += result.retry > 0 ? ` #${result.retry + 1}` : "";
Expand All @@ -98,7 +106,7 @@ class ArgosReporter implements Reporter {
this.uploadDir,
getAttachmentFilename(attachment.name),
);
await copyFile(attachment.path, path);
await this.copyFile(attachment.path, path);
return;
}

Expand All @@ -110,8 +118,8 @@ class ArgosReporter implements Reporter {
const path = join(this.uploadDir, `${name}.png`);
await Promise.all([
this.writeFile(path + ".argos.json", JSON.stringify(metadata)),
copyFile(attachment.path, path),
trace ? copyFile(trace.path, path + ".pw-trace.zip") : null,
this.copyFile(attachment.path, path),
trace ? this.copyFile(trace.path, path + ".pw-trace.zip") : null,
]);
return;
}
Expand Down