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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ordino.ai/ordino-cy-services-core

v1.0.33

Published

ordino.ai Cypress services core - global generic services and behaviors for API testing

Readme

ordino-cy-services-core

A Cypress helper for API testing: configure base URL and headers once, then run GET, POST, PUT, PATCH, DELETE (and GET with query params) with a simple API. Built for use inside Cypress tests and supports header presets and a small key-value store via Cypress.env.

Requirements

  • Cypress (v14+)
  • Node.js (LTS)

Install

npm install @ordino.ai/ordino-cy-services-core

Quick start

import { OrdinoAPI } from '@ordino.ai/ordino-cy-services-core';

describe('API tests', () => {
  before(() => {
    OrdinoAPI.setBaseUrl('https://api.example.com');
    OrdinoAPI.setHeader('Authorization', 'Bearer your-token');
  });

  it('fetches a resource', () => {
    OrdinoAPI.setUrl('users/123');
    OrdinoAPI.requestGet().then((response) => {
      expect(response.status).to.eq(200);
      expect(response.body).to.have.property('id', 123);
    });
  });

  it('creates a resource', () => {
    OrdinoAPI.setUrl('users');
    OrdinoAPI.requestPost({ name: 'Jane', email: '[email protected]' }).then((response) => {
      expect(response.status).to.eq(201);
      OrdinoAPI.setValue('userId', response.body.id);
    });
  });
});

API reference

Configuration

| Method | Description | |--------|-------------| | setBaseUrl(url: string) | Set base URL for all requests. A trailing / is added if missing. | | setUrl(endpoint: string) | Set the path (endpoint) for the next request(s). A leading / is removed if present. | | setTimeout(ms: number) | Set request timeout in milliseconds (default: 30000). |

Final request URL is baseUrl + endpoint (e.g. https://api.example.com/ + users/1https://api.example.com/users/1).

Headers

| Method | Description | |--------|-------------| | setHeader(key, value) or setHeader(headers) | Set one header or merge an object of headers. | | setHeaders(headers) | Merge multiple headers at once. | | setGlobalHeader(key, value) or setGlobalHeader(headers) | Set headers that apply to every request (e.g. auth). | | saveHeaderPreset(name, headers?) | Save current (or given) headers under a name. | | loadHeaderPreset(name) | Restore headers from a preset. | | getHeaderPreset(name) | Return saved preset or null. | | deleteHeaderPreset(name) | Remove a preset. | | clearHeaders() | Reset to only Content-Type: application/json. | | clearGlobalHeaders() | Clear all global headers. |

Per-request headers and global headers are merged on each request; per-request wins on conflict.

Request methods

All methods use cy.request() and return a Cypress.Chainable<Cypress.Response>. They use failOnStatusCode: false and log: true, and the last response is stored on OrdinoAPI.request.

| Method | Description | |--------|-------------| | requestGet() | GET to current base URL + endpoint. | | requestGetWithQuery(queryParams) | GET with qs set to queryParams. | | requestPost(data) | POST with JSON body data. | | requestPut(data) | PUT with JSON body data. | | requestPatch(data) | PATCH with JSON body data. | | requestDelete() | DELETE. |

Value storage

Uses Cypress.env for storing and retrieving values (e.g. IDs from one step for the next).

| Method | Description | |--------|-------------| | setValue(key, value) | Store a value. | | getValue(key) | Retrieve a value. | | clearValue(key) | Remove a value. |

Example: auth and presets

before(() => {
  OrdinoAPI.setBaseUrl(Cypress.env('API_BASE_URL'));
  OrdinoAPI.setGlobalHeader('Content-Type', 'application/json');
});

it('uses different auth for admin', () => {
  OrdinoAPI.saveHeaderPreset('admin', {
    'Authorization': `Bearer ${Cypress.env('ADMIN_TOKEN')}`,
  });
  OrdinoAPI.loadHeaderPreset('admin');
  OrdinoAPI.setUrl('admin/users');
  OrdinoAPI.requestGet().then((res) => expect(res.status).to.eq(200));
});

Example: GET with query params

OrdinoAPI.setBaseUrl('https://api.example.com');
OrdinoAPI.setUrl('search');
OrdinoAPI.requestGetWithQuery({ q: 'test', limit: 10 }).then((response) => {
  expect(response.body.items).to.have.length.at.most(10);
});

License

GPL-3.0