Search in sources :

Example 1 with ScreenshotImage

use of org.definitylabs.flue2ent.plugin.screenshot.ScreenshotImage in project flue2ent by DefinityLabs.

the class ScreenshotPluginTest method takeAnd_returnsScreenshotImage.

@Test
public void takeAnd_returnsScreenshotImage() throws Exception {
    File file = mock(File.class);
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    when(mockedDriver.getScreenshotAs(OutputType.FILE)).thenReturn(file);
    PowerMockito.mockStatic(ImageIO.class);
    BufferedImage image = mock(BufferedImage.class);
    PowerMockito.when(ImageIO.class, "read", file).thenReturn(image);
    ScreenshotPlugin screenshotPlugin = new ScreenshotPlugin(mockedDriver);
    ScreenshotImage screenshotImage = screenshotPlugin.takeAnd();
    assertThat(screenshotImage).isEqualTo(new ScreenshotImage(image));
}
Also used : ScreenshotImage(org.definitylabs.flue2ent.plugin.screenshot.ScreenshotImage) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) ImageIO(javax.imageio.ImageIO) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 ImageIO (javax.imageio.ImageIO)1 ScreenshotImage (org.definitylabs.flue2ent.plugin.screenshot.ScreenshotImage)1 Test (org.junit.Test)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1