Skip to content

Commit 2d18072

Browse files
committed
copy attachments files to the destination folder
1 parent 2f9fd7f commit 2d18072

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/core/ScreenShotRule.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.io.InputStream;
77
import java.nio.file.Files;
88
import java.nio.file.Path;
9+
import java.nio.file.StandardCopyOption;
910
import java.util.UUID;
1011
import java.util.logging.Level;
1112
import java.util.logging.Logger;
@@ -52,7 +53,7 @@ public void handleTestExecutionException(ExtensionContext context, Throwable cau
5253
private void captureScreenshots(ExtensionContext context) {
5354
final TestEnvironment environment;
5455
if (context.getRequiredTestInstance() instanceof AbstractSeleniumTest) {
55-
AbstractSeleniumTest testInstance = (AbstractSeleniumTest) context.getRequiredTestInstance();
56+
final AbstractSeleniumTest testInstance = (AbstractSeleniumTest) context.getRequiredTestInstance();
5657
environment = testInstance.getEnvironment();
5758
} else {
5859
throw new IllegalStateException("The test instance must be of type AbstractSeleniumTest to use the ScreenShotRule.");
@@ -74,6 +75,7 @@ private void captureScreenshots(ExtensionContext context) {
7475
final File destinationDir = new File(screenshotFolder, context.getRequiredTestClass().getName());
7576
destinationDir.mkdirs();
7677
final File destination = new File(destinationDir, filename + SCREENSHOT_FILE_EXTENSION);
78+
Files.copy(source, destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
7779
// Absolute path to the screenshot file
7880
final Path absoluteFile = destination.toPath().toAbsolutePath().normalize();
7981
// Jenkins JUnit Attachments Plugin resolves [[ATTACHMENT|<path>]] markers against

0 commit comments

Comments
 (0)