Coder Social home page Coder Social logo

visualknight_agent_java_core's Introduction

Java implementation for Visual Knight API

Port from JavaScript implementation link

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.pashidlos:visualknight_agent_java_core:${VERSION}'
}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.pashidlos</groupId>
    <artifactId>visualknight_agent_java_core</artifactId>
    <version>${VERSION}</version>
</dependency>

Available versions

More info about https://jitpack.io/

Usage

  • Setup options object
VisualKnightOptions visualKnightOptions = VisualKnightOptions.builder()
    // URL to Visual Knight backend
    // Required
    .apiEndpoint("http://localhost:3333/graphql")

    // Your Visual Knight API key
    // Required
    .apiKey("API_KEY") 

    // Your project name or ID
    // Required
    .project("PROJECT_KEY_OR_NAME")

    // The mismatch tolerance for the comparison, 0.01 is 1%
    // Optional
    // Default: 0.01
    .misMatchTolerance(0.01)

    // Accept first testsession for a variation as baseline
    // Optional
    // Default: false
    .autoBaseline(false)
    .build();
  • Create instance of VisualKnightCore
VisualKnightCore visualKnightCore = new VisualKnightCore(visualKnightOptions);
  • Take a screenshot as String in Base64 format
// Selenium example
String screenshotBase64 = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);
  • Create instance of VisualKnightCapabilities
VisualKnightCapabilities visualKnightCapabilities = VisualKnightCapabilities.builder()
                // Available: 'Windows', 'Mac OS', `Puppeteer`
                .os("Windows")

                // Available: 'Internet Explorer', 'Firefox', 'Safari', 'Chrome', 'Opera'
                .browserName("Chrome")
                .build()
  • Process image
visualKnightCore.processScreenshot(
        "Name for test",
        screenshotBase64,
        visualKnightCapabilities
);

visualknight_agent_java_core's People

Contributors

pashidlos avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.