use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testRelocateNonExistingHtmlFile.
@Test(groups = { "ut" })
public void testRelocateNonExistingHtmlFile() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.deleteDirectory(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toFile());
ScreenShot s = new ScreenShot();
s.setHtmlSourcePath(ScreenshotUtil.HTML_DIR + "/foo.html");
s.relocate(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toString());
}
use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testGetHtmlSource.
@Test(groups = { "ut" })
public void testGetHtmlSource() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.copyFile(createFileFromResource("tu/test.html"), Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.HTML_DIR, "foo.html").toFile());
ScreenShot s = new ScreenShot();
s.setHtmlSourcePath(ScreenshotUtil.HTML_DIR + "/foo.html");
Assert.assertTrue(s.getHtmlSource().contains("<html>"));
}
use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testGetHtmlSourceNull.
@Test(groups = { "ut" })
public void testGetHtmlSourceNull() throws IOException {
ScreenShot s = new ScreenShot();
Assert.assertEquals(s.getHtmlSource(), "");
}
use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testRelocateHtml.
@Test(groups = { "ut" })
public void testRelocateHtml() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.deleteDirectory(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toFile());
FileUtils.copyFile(createFileFromResource("tu/test.html"), Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.HTML_DIR, "foo.html").toFile());
ScreenShot s = new ScreenShot();
s.setHtmlSourcePath(ScreenshotUtil.HTML_DIR + "/foo.html");
s.relocate(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toString());
Assert.assertTrue(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out", ScreenshotUtil.HTML_DIR, "foo.html").toFile().exists());
Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.HTML_DIR, "foo.html").toFile().exists());
}
use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testRelocate.
@Test(groups = { "ut" })
public void testRelocate() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.deleteDirectory(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toFile());
FileUtils.copyFile(createFileFromResource("tu/ffLogo1.png"), Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.SCREENSHOT_DIR, "foo.jpg").toFile());
ScreenShot s = new ScreenShot(ScreenshotUtil.SCREENSHOT_DIR + "/foo.jpg");
s.relocate(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toString());
Assert.assertTrue(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out", ScreenshotUtil.SCREENSHOT_DIR, "foo.jpg").toFile().exists());
Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.SCREENSHOT_DIR, "foo.jpg").toFile().exists());
Assert.assertEquals(s.getFullImagePath(), Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out", ScreenshotUtil.SCREENSHOT_DIR, "foo.jpg").toString().replace("\\", "/"));
}
Aggregations