Advertisement
zhytnytskyi

WithAttachedScreenshotForEachTest

Jul 25th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package ua.net.azhytnytskyi.housework;
  2.  
  3. import com.codeborne.selenide.Screenshots;
  4. import com.google.common.io.Files;
  5. import org.junit.After;
  6. import ru.yandex.qatools.allure.annotations.Attachment;
  7.  
  8. import java.io.File;
  9. import java.io.IOException;
  10.  
  11. public class WithAttachedScreenshotForEachTest extends BasicTest {
  12.  
  13.     @After
  14.     public void takeScreenshot() {
  15.         try {
  16.             screenshot();
  17.         } catch (IOException e) {
  18.             e.printStackTrace();
  19.         }
  20.     }
  21.  
  22.     @Attachment(type = "image/png")
  23.     public byte[] screenshot() throws IOException {
  24.         File screenshot = Screenshots.takeScreenShotAsFile();
  25.         return Files.toByteArray(screenshot);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement