All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shaft.properties.internal.Visuals Maven / Gradle / Ivy

Go to download

SHAFT is a unified test automation engine. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve. Stop reinventing the wheel. Upgrade now!

There is a newer version: 8.2.20240402
Show newest version
package com.shaft.properties.internal;

import com.shaft.tools.io.ReportManager;
import org.aeonbits.owner.Config.Sources;
import org.aeonbits.owner.ConfigFactory;

@SuppressWarnings("unused")
@Sources({"system:properties", "file:src/main/resources/properties/VisualValidations.properties", "file:src/main/resources/properties/default/VisualValidations.properties", "classpath:VisualValidations.properties"})
public interface Visuals extends EngineProperties {
    private static void setProperty(String key, String value) {
        var updatedProps = new java.util.Properties();
        updatedProps.setProperty(key, value);
        Properties.visuals = ConfigFactory.create(Visuals.class, updatedProps);
        // temporarily set the system property to support hybrid read/write mode
        System.setProperty(key, value);
        ReportManager.logDiscrete("Setting \"" + key + "\" property with \"" + value + "\".");
    }

    @Key("visualMatchingThreshold")
    @DefaultValue("0.90")
    double visualMatchingThreshold();

    @Key("screenshotParams_scalingFactor")
    @DefaultValue("1")
    double screenshotParamsScalingFactor();

    @Key("screenshotParams_whenToTakeAScreenshot")
    @DefaultValue("ValidationPointsOnly")
    String screenshotParamsWhenToTakeAScreenshot();

    @Key("screenshotParams_screenshotType")
    @DefaultValue("FullPage")
    String screenshotParamsScreenshotType();

    @Key("screenshotParams_highlightElements")
    @DefaultValue("true")
    boolean screenshotParamsHighlightElements();

    @Key("screenshotParams_highlightMethod")
    @DefaultValue("AI")
    String screenshotParamsHighlightMethod();

    @Key("screenshotParams_skippedElementsFromScreenshot")
    @DefaultValue("")
    String screenshotParamsSkippedElementsFromScreenshot();

    @Key("screenshotParams_watermark")
    @DefaultValue("true")
    boolean screenshotParamsWatermark();

    @Key("screenshotParams_watermarkOpacity")
    @DefaultValue("0.2")
    float screenshotParamsWatermarkOpacity();

    @Key("createAnimatedGif")
    @DefaultValue("false")
    boolean createAnimatedGif();

    @Key("animatedGif_frameDelay")
    @DefaultValue("500")
    int animatedGifFrameDelay();

    @Key("videoParams_recordVideo")
    @DefaultValue("false")
    boolean videoParamsRecordVideo();

    @Key("videoParams_scope")
    @DefaultValue("DriverSession")
    String videoParamsScope();

    @Key("whenToTakePageSourceSnapshot")
    @DefaultValue("Never")
    String whenToTakePageSourceSnapshot();

    default SetProperty set() {
        return new SetProperty();
    }

    class SetProperty implements EngineProperties.SetProperty {

        public void visualMatchingThreshold(String value) {
            setProperty("visualMatchingThreshold", value);
        }

        public void screenshotParamsScalingFactor(String value) {
            setProperty("screenshotParams_scalingFactor", value);
        }

        public void screenshotParamsWhenToTakeAScreenshot(String value) {
            setProperty("screenshotParams_whenToTakeAScreenshot", value);
        }

        public void screenshotParamsScreenshotType(String value) {
            setProperty("screenshotParams_screenshotType", value);
        }

        public void screenshotParamsHighlightElements(boolean value) {
            setProperty("screenshotParams_highlightElements", String.valueOf(value));
        }

        public void screenshotParamsHighlightMethod(String value) {
            setProperty("screenshotParams_highlightMethod", value);
        }

        public void screenshotParamsSkippedElementsFromScreenshot(String value) {
            setProperty("screenshotParams_skippedElementsFromScreenshot", value);
        }

        public void screenshotParamsWatermark(boolean value) {
            setProperty("screenshotParams_watermark", String.valueOf(value));
        }

        public void screenshotParamsWatermarkOpacity(float value) {
            setProperty("screenshotParams_watermarkOpacity", String.valueOf(value));
        }

        public void createAnimatedGif(boolean value) {
            setProperty("createAnimatedGif", String.valueOf(value));
        }

        public void animatedGifFrameDelay(int value) {
            setProperty("animatedGif_frameDelay", String.valueOf(value));
        }

        public void videoParamsRecordVideo(boolean value) {
            setProperty("videoParams_recordVideo", String.valueOf(value));
        }

        public void videoParamsScope(String value) {
            setProperty("videoParams_scope", value);
        }

        public void whenToTakePageSourceSnapshot(String value) {
            setProperty("whenToTakePageSourceSnapshot", value);
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy