Skip to content

Commit

Permalink
Fixed screenshot bug & updated to 2.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgates55 committed Jul 27, 2016
1 parent 447c12a commit d25195a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.Frameworkium</groupId>
<artifactId>Frameworkium-core</artifactId>
<version>2.0.6</version>
<version>2.0.8</version>

<name>Frameworkium-core</name>
<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void takeScreenshotAndSaveLocally(String testName) {
screenshotDirectory + File.separator
+ System.currentTimeMillis() + "_" + testName + ".png";
Path screenshot = Paths.get(absolutePath);
if (createFile(screenshot)) {
if (createScreenshotDirectory(screenshot.getParent())) {
WebDriverWrapper driver = BaseTest.getDriver();
try {
writeScreenshotToFile(driver, screenshot);
Expand All @@ -65,16 +65,15 @@ private void takeScreenshotAndSaveLocally(String testName) {
}
}

private boolean createFile(Path screenshotPath) {
if (!Files.exists(screenshotPath)) {
private boolean createScreenshotDirectory(Path screenshotDirectory) {
if (!Files.isDirectory(screenshotDirectory)) {
try {
Files.createDirectories(screenshotPath.getParent());
Files.createDirectories(screenshotDirectory);
} catch (IOException e) {
logger.error("Error creating screenshot", e);
logger.error("Error creating screenshot directory", e);
}
}

return Files.exists(screenshotPath);
return Files.isDirectory(screenshotDirectory);
}

@Attachment(value = "Screenshot on failure", type = "image/png")
Expand Down

0 comments on commit d25195a

Please sign in to comment.