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

rest-assured-ts

v0.1.8

Published

Test framework for automating rest api & JS & typescript!

Downloads

188

Readme

Rest-Assured tool, it supports both TypeScript and JavaScript

#you can use with other frameworks such as cucumber, mocha, jest etc

#Integrated with cucumber report

#Upcoming features

  • testrail integrations
  • https://www.npmjs.com/package/testrail-integration
  • New JSON response utils to validate search filters,
  • Getting Server timestamps based on TimeZone
  • More handy json validations(ex: sorting ,date,limit, offset validations etc) for search filters(any GET call) without writing asserts

Highlights

  • This API automation tool designed to support API automation like other tools Postman, RestAssured and Karate
  • It supports CommonJS, ES6 and TypeScript
  • Pretty easy to use this library for non JavaScript developers as well
  • It supports Cucumber, Mocha and other frameworks as well
  • This tool helps integration testing with webui , mobile and other applications
  • It helps API integration (example : to automate combination of promo, tax and price services) testing as well.
  • Best feature, Chai asserts are supported implicitly for json response validations
  • Easy to find json paths and node values like https://jsonpath.com/
  • Easy to externalize test data request and response json files
  • Supports huge jsons request and responses
  • Can send json request body as File and String
  • where Include or exclude parameters from the request body for the negative testing
  • Mutations on JSON objects where Dynamic parameters can be applied on json objects
  • Can send full json response as file for complete json schema validations
  • Https API
  • Promise API
  • Handled exceptions internally
  • Easy to use Request API's with basic knowledge of javascript and typescript
  • Going to add more utils for json validation to meet API's functionality
  • it supports fixtures similar to https://www.npmjs.com/package/fixtures
  • Actively maintained

Extra features: Chai asserts supported implicitly for json response validations Passing request body as json file , full json response validation as file for complete schema validations. It supports json path validations

|json path|value| |username| myname| using exact path : example: |json path|value| |data[*].username| myname|

Easy way of automation

making request of api end point Same method can be used for GET(Default), PUT,POST, PATCH, DELETE

Below package also contains same methods except few https://www.npmjs.com/package/cucumberjs-rest-assured

More documentation will be added, refer github links clone and execute sample code snippets

  • https://github.com/automatekitbox/cucumber-rest-assured-typescript

  • https://github.com/automatekitbox/restassured-mocha-typescript

Please refer github links for code snippets , these methods can be used for mocha and other frameworks as well contact [email protected] , [email protected] [email protected]

Note : in case error for tunnel

npm i tunnel --save-dev npm i @types/tunnel

Proxy support

Use your proxy details if needed https://github.com/koichik/node-tunnel

 response = await restRequest("https://gorest.co.in/public-api/users", {
    headerOptions: JSON.parse(headerOptions),
    httpMethod: "GET", timeOut: 20000,
    agent: tunnel.httpOverHttp({
           		proxy: {
           			host: 'localhost',
                    port: '8080',
                    headers: {
                    'User-Agent': 'Node'
                    } 
           	})
  });

Access token

Note: You can keep request body in json file as well and replace user name and passwords from env or config files
const requestBodyAsJsonString: string = JSON.stringify({
  "grant_type": "password",
  "username": "{username}",
  "password": "{password}",
  "client_id": "localhost-dev"
});

const headerOptions: string = JSON.stringify({"Content-Type": "application/x-www-form-urlencoded"});

 response = await restRequest("https://gorest.co.in/public-api/users", {
    headerOptions: JSON.parse(headerOptions),
    httpMethod: "POST", inputBody: requestBodyAsJsonString,
    formFlag: true, timeOut: 10000
  });

License

Please see LICENSE.md.