use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testRelocateHtmlSameFolder.
@Test(groups = { "ut" })
public void testRelocateHtmlSameFolder() 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");
s.relocate(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), null, Paths.get(ScreenshotUtil.SCREENSHOT_DIR, "foo.html").toString());
Assert.assertTrue(Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.SCREENSHOT_DIR, "foo.html").toFile().exists());
Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.HTML_DIR, "foo.html").toFile().exists());
Assert.assertEquals(s.getHtmlSourcePath(), ScreenshotUtil.SCREENSHOT_DIR + "/foo.html");
}
use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testRelocateNullFile.
/**
* No error should be raised
* @throws IOException
*/
@Test(groups = { "ut" })
public void testRelocateNullFile() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.deleteDirectory(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toFile());
ScreenShot s = new ScreenShot(null);
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 testRelocateNullHtmlFile.
/**
* No error should be raised
* @throws IOException
*/
@Test(groups = { "ut" })
public void testRelocateNullHtmlFile() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.deleteDirectory(Paths.get(SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory(), "out").toFile());
ScreenShot s = new ScreenShot();
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 testRelocateSameFolder.
/**
* Check we can move a file from a sub-folder of output directoru to another sub-folder
* @throws IOException
*/
@Test(groups = { "ut" })
public void testRelocateSameFolder() throws IOException {
FileUtils.deleteDirectory(new File(SeleniumTestsContextManager.getThreadContext().getOutputDirectory()));
FileUtils.copyFile(createFileFromResource("tu/ffLogo1.png"), Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), "video", "foo.jpg").toFile());
ScreenShot s = new ScreenShot("video/foo.jpg");
s.relocate(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), Paths.get(ScreenshotUtil.SCREENSHOT_DIR, "foo.jpg").toString(), null);
Assert.assertTrue(Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), ScreenshotUtil.SCREENSHOT_DIR, "foo.jpg").toFile().exists());
Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), "video", "foo.jpg").toFile().exists());
Assert.assertEquals(s.getImagePath(), ScreenshotUtil.SCREENSHOT_DIR + "/foo.jpg");
}
use of com.seleniumtests.driver.screenshots.ScreenShot in project seleniumRobot by bhecquet.
the class TestScreenshot method testGetImageName.
@Test(groups = { "ut" })
public void testGetImageName() {
ScreenShot s = new ScreenShot("video/foo.jpg");
Assert.assertEquals(s.getImageName(), "foo.jpg");
}
Aggregations