Class ScreenShooterExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

    public class ScreenShooterExtension
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.AfterAllCallback
    Use this class to automatically take screenshots in case of ANY errors in tests (not only Selenide errors).

    How to use in Java:

     {@code
    Since:
    4.12.2
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)  
      void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)  
      void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)  
      ScreenShooterExtension to​(java.lang.String folderWithScreenshots)
      One-liner to configure Configuration.reportsFolder property.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScreenShooterExtension

        public ScreenShooterExtension()
      • ScreenShooterExtension

        public ScreenShooterExtension​(boolean captureSuccessfulTests)
        Parameters:
        captureSuccessfulTests - param that indicate if need to capture successful tests
    • Method Detail

      • to

        public ScreenShooterExtension to​(java.lang.String folderWithScreenshots)
        One-liner to configure Configuration.reportsFolder property.
        Parameters:
        folderWithScreenshots - Folder to put screenshots to
        Returns:
        current extension instance
      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
      • afterEach

        public void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
      • afterAll

        public void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback