Skip to content

Commit

Permalink
Selenide mixes names of screenshots in case of parallel run selenide#570
Browse files Browse the repository at this point in the history
  • Loading branch information
jane-ryabchenko committed Sep 6, 2017
1 parent ad5e3ee commit 49965da
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/test/java/integration/ScreenshotTest.java
Expand Up @@ -14,7 +14,6 @@
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;

import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.WebDriverRunner.getWebDriver;
Expand Down Expand Up @@ -43,14 +42,8 @@ public void canTakeScreenshotOfElement() throws IOException {
BufferedImage img = ImageIO.read(screenshot);
assertEquals("Screenshot doesn't fit width " + info, img.getWidth(), element.getSize().getWidth());
assertEquals("Screenshot doesn't fit height " + info, img.getHeight(), element.getSize().getHeight());
// Since File.getPath() return system-dependent path, we have to replace non-UNIX separators with UNIX separators
// to make sure that test will be passed.
String path = screenshot.getPath();
if (!FileSystems.getDefault().getSeparator().equals("/")) {
path = path.replace(FileSystems.getDefault().getSeparator(), "/");
}
assertTrue("Screenshot file should be located in " + Configuration.reportsFolder + ", but was: " + path,
path.startsWith(Configuration.reportsFolder));
assertTrue("Screenshot file should be located in " + Configuration.reportsFolder
+ ", but was: " + screenshot.getPath(), screenshot.getPath().startsWith(Configuration.reportsFolder));
}

@Test
Expand Down

0 comments on commit 49965da

Please sign in to comment.