All adapters are using the core to provide a shared integration and easy extensibility.
You can use one of our Adapters or write your own based on the core to be able to get updates and new features with less effort.
If you are using a different language than we provide go to this section API
If you want to use the core module than just install it
npm i @visual-knight/core
The code for the libraries are written in typescript.
How to use the core module
import { VisualKnightCore, IProcessScreenshotOptionsUser} from"@visual-knight/core";constuserConfig:IProcessScreenshotOptionsUser;constvisualKnightCoreInstance=newVisualKnightCore(userConfig);// to start a screenshot comparison just use consttestName:string="My Testname";constscreenshot:Base64=newBuffer() // <-- this must be your screenshot// In additional you can put any kind of information which you need for your Variationconstadditional: { [key:string]:string|number|boolean } = { someInformation:"1" }visualKnightCoreInstance.processScreenshot(testName, screenshot, additional).then(() =>console.log("success")).catch((error) =>console.error(error))
Core Options
{// Your Visual Knight Api key// Required key: string;// Your project name or ID// Required project: string;// URL where backend is running // Required apiEndpoint: string;// Accept first testsession for a variation as baseline// Optional// Default: false autoBaseline?: boolean;// The mismatch tolerance for the comparison, 0.01 is 1%// Optional// Default: 0.01 misMatchTolerance?: number;// You don't want realtime feedback in your CI? ;)// It just sends the image and continues as successful test without feedback// Optional// Default: true liveResult?: boolean;}