Class ScreenshotCreator


  • public class ScreenshotCreator
    extends Object
    Create screenshot and save it to file system. Return the screenshot URL relative of story report.
    Author:
    Daniel Keiss <daniel.keiss@telekom.de>

    Copyright (c) 2020 Daniel Keiss, Deutsche Telekom IT GmbH This file is distributed under the conditions of the Apache License, Version 2.0. For details see the file license on the toplevel.

    • Field Detail

      • SCREENSHOT_PATH

        public static String SCREENSHOT_PATH
      • reporterBuilder

        @NonNull
        protected final @NonNull org.jbehave.core.reporters.StoryReporterBuilder reporterBuilder
      • webDriverWrapper

        @NonNull
        protected final @NonNull WebDriverWrapper webDriverWrapper
    • Constructor Detail

      • ScreenshotCreator

        public ScreenshotCreator​(@NonNull
                                 @NonNull org.jbehave.core.reporters.StoryReporterBuilder reporterBuilder,
                                 @NonNull
                                 @NonNull WebDriverWrapper webDriverWrapper)
    • Method Detail

      • createScreenshot

        public String createScreenshot​(String storyFolder,
                                       String step,
                                       String status)
        Create screenshot for given step.
        Parameters:
        storyFolder - - The current story folder. Every story has it's own folder
        step - - The current step
        status - - The status of the current step: successful, failed
        Returns:
        The URL of the created screenshot as String. If no screenshot was created, the result is null.
      • screenshotPath

        protected String screenshotPath​(String storyFolder,
                                        String screenshotName)
      • screenshotIsNotEmpty

        protected boolean screenshotIsNotEmpty​(String screenshotPath)
      • logScreenshot

        protected void logScreenshot​(String step,
                                     String screenshotPath)