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

angles-javascript-client

v1.0.39

Published

This is the javascript client for the Angles Dashboard. It allows you to store your test results.

Downloads

311

Readme

angles-javascript-client

The angles-javascript-client has all the necessary functions to store your test results in the Angles Dashboard.

Installation

To install the angles javascript client in your project simply run the following command.

# if your only using whilst running your tests (otherwise remove --save-dev)
npm install  angles-javascript-client --save-dev

Usage

You should be able to use the angles-javascript-client with any javascript execution framework to help you store your test results and do your image comparison. You make use of the client in the following ways.

// Option 1 (preferred): You can import an (singleton) instance of the anglesReporter
import anglesReporter from 'angles-javascript-client';

// And you can then point it to your instance of the Angles dashboard.
anglesReporter.setBaseUrl('http://127.0.0.1:3000/rest/api/v1.0/');
await anglesReporter.startBuild('TestRunName', 'Team', 'Environment', 'Component');

// store the versions of your system under test (so you can compare builds)
const artifact = new Artifact('angles-ui', 'anglesHQ', '1.0.0');
const artifactArray: Artifact[] = [];
artifactArray.push(artifact);
await anglesReporter.addArtifacts(artifactArray);

// Called e.g. in the "before"
anglesReporter.startTest('test1', 'suite1');

// This will group all the loging afterwards in this action
anglesReporter.addAction('My first action');

// Using the following two requests you can store your screenshots (with a view name and platform details)
const platform = new ScreenshotPlatform('Android', '10', 'Chrome', '89.0', 'Samsung Galaxy S9');
const screenshot = await anglesReporter.saveScreenshotWithPlatform(
  '/path/to/your/screenshot.png',
  'view_1',
  platform,
);

// this will add your screenshot to the info and display a thumbnail.
anglesReporter.infoWithScreenshot('Checking my view on android', screenshot._id);

// these methods don't do an assertion, but just report on the result (and change the state of the test run in Angles).
anglesReporter.pass('Assertion', 'true', 'true', 'Just doing an assertion');
anglesReporter.fail('Assertion', 'true', 'false', 'Just doing an assertion');

// Needs to be called once the test is done to send it to the Angles Dashboard.
await anglesReporter.saveTest();

If you want to create your own reporter, you can instantiate the request classes yourself.


// Option 2: you can import the invidividual TypeScript classes
import { BuildRequests, EnvironmentRequests } from 'angles-javascript-client';

// and instantiate the request classes yourself with your own axios instance.
const buildRequests = new BuildRequests(axios);
const environmentRequests = new EnvironmentRequests(axios);

To see more details about Angles Dashboard and e.g. how to set it up, have a look at our documentation on our github page.