Socket
Socket
Sign inDemoInstall

@syngrisi/core-api

Package Overview
Dependencies
49
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.25-alpha.0 to 2.1.30-alpha.0

.nvmrc

21

package.json
{
"name": "@syngrisi/core-api",
"version": "2.1.25-alpha.0",
"version": "2.1.30-alpha.0",
"description": "Syngrisi Core JS client",
"main": "dist/SyngrisiApi.js",
"main": "dist/src/SyngrisiApi.js",
"private": false,

@@ -12,7 +12,8 @@ "scripts": {

"clean": "rimraf tsconfig.tsbuildinfo ./build ./coverage",
"compile": "tsc -p ./tsconfig.json"
"compile": "tsc -p ./tsconfig.json --declaration",
"pkglist": "npx npm-packlist # list of files that will be published in syngrisi package, show the files section"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com:viktor-silakov/syngrisi.git"
"url": "git@github.com:syngrisi/syngrisi.git"
},

@@ -28,5 +29,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/viktor-silakov/syngrisi/issues"
"url": "https://github.com/syngrisi/syngrisi/issues"
},
"homepage": "https://github.com/viktor-silakov/syngrisi",
"homepage": "https://github.com/syngrisi/syngrisi/tree/main/packages/core-api",
"dependencies": {

@@ -37,6 +38,7 @@ "@syngrisi/core-api": "*",

"got-cjs": "^12.0.4",
"hasha": "^5.2.0"
"hasha": "^5.2.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/node": "^20.8.8",
"@types/node": "^20.8.10",
"@typescript-eslint/eslint-plugin": "^5.48.2",

@@ -51,6 +53,7 @@ "@typescript-eslint/parser": "^5.48.2",

"eslint-plugin-unicorn": "^45.0.2",
"typedoc": "^0.25.3",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"gitHead": "8cce731290e41604b8066467971ddd7fe5ecc014"
"gitHead": "bf92123f516b52646893b810a54c02e7c878b364"
}

@@ -1,7 +0,86 @@

# Syngrisi core js api client
# Syngrisi Core API - Visual Regression Testing
## Environment variables
## 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](https://www.npmjs.com/package/wdio-syngrisi-cucumber-service) or [@syngrisi/syngrisi-wdio-sdk](https://www.npmjs.com/package/@syngrisi/syngrisi-wdio-sdk), if Playwright try to
use [@syngrisi/playwright-sdk](https://www.npmjs.com/package/@syngrisi/playwright-sdk). For detailed documentation on the API methods
and their parameters, refer to [Syngrisi Core API Documentation](https://syngrisi.github.io/syngrisi/modules/_syngrisi_core_api.html).
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](https://www.npmjs.com/package/wdio-syngrisi-cucumber-service) or [@syngrisi/syngrisi-wdio-sdk](https://www.npmjs.com/package/@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](https://syngrisi.github.io/syngrisi/modules/_syngrisi_core_api.html).
### Installation
Install the package with npm:
```shell
npm install @syngrisi/core-api
```
## Basic Workflow
### 1. Start Session
To begin visual regression testing, start a session with the Syngrisi service:
```js
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:
```js
// 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:
```js
// `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"`)
TODO: complete documentation
### License
This project is licensed under the MIT License - see the [LICENSE.md](./LICENSE.md) file for details.
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
"incremental": true, /* Enable incremental compilation */
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"types": ["@wdio/globals/types"],
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
"incremental": true,
"target": "ES2020",
"module": "commonjs",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
// "types": ["index.d.ts"],
"outDir": "./dist",
/* Redirect output structure to the directory. */
// "rootDir": "./src",
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},

@@ -72,0 +19,0 @@ "exclude": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc