npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@syngrisi/core-api

v2.2.4

Published

Syngrisi Core JS client

Downloads

25

Readme

Syngrisi Core API - Visual Regression Testing

Overview

Syngrisi Core API (@syngrisi/core-api) provides an interface to communicate with the Syngrisi visual regression testing service. This service allows clients to start and stop sessions, create checks, and get snapshots and baselines. This is the common JS/TS library, if you use WebdriverIO as automation framework try to use wdio-syngrisi-cucumber-service or @syngrisi/syngrisi-wdio-sdk, if Playwright try to use @syngrisi/playwright-sdk. For detailed documentation on the API methods and their parameters, refer to Syngrisi Core API Documentation.

Syngrisi Core API (@syngrisi/core-api) provides a way to interact with the Syngrisi visual regression testing service. This service lets you start and stop testing sessions, set up test checks, and retrieve snapshots and baseline images. This is a common JavaScript/TypeScript library. If your automation framework is WebdriverIO, consider using wdio-syngrisi-cucumber-service or @syngrisi/syngrisi-wdio-sdk. If you are using Playwright, the @syngrisi/playwright-sdk is recommended. For a comprehensive guide on how to use the API's functions and parameters, please check out the Syngrisi Core API Documentation.

Installation

Install the package with npm:

npm install @syngrisi/core-api

Basic Workflow

1. Start Session

To begin visual regression testing, start a session with the Syngrisi service:

import { SyngrisiApi } from '@syngrisi/core-api';

// Initialize the API client with your configuration
const apiClient = new SyngrisiApi({
    url: 'http://<your-domain>/',
    apiKey: 'your-api-key'
});

// Start a new session with the required parameters
// The `sessionResponse` will have data about the test that started, and contains a `testId` which will be used for creating checks
const sessionResponse = await apiClient.startSession({
    run: 'run-id',
    suite: 'suite-name',
    runident: 'run-identifier',
    name: 'test-name',
    viewport: '1200x800',
    browser: 'chrome',
    browserVersion: '113',
    os: 'macOS',
    app: 'MyProject'
});

2. Create Check

Once the session is started, you can perform a visual check:

// Assuming `imageBuffer` is the Buffer instance of the screenshot to check
// The `checkResponse` will contain the result of the visual comparison
const checkResponse = await apiClient.coreCheck(imageBuffer, {
    name: 'homepage',
    viewport: '1200x800',
    browserName: 'chrome',
    os: 'macOS',
    app: 'MyProject',
    branch: 'main',
    testId: sessionResponse.testId // obtained from the startSession call
});

3. Stop Session

After checks are completed, stop the session:

// `stopResponse` will have data about the completed test.
const stopResponse = await apiClient.stopSession(sessionResponse.testId);

Environment variables

SYNGRISI_LOG_LEVEL - logging level ("trace" | "debug" | "info" | "warn" | "error")

License

This project is licensed under the MIT License - see the LICENSE.md file for details.