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

@marc1706/web-push-testing-service

v0.5.2

Published

A service that can be run locally or on a CLI to manage testing of web push in a language agnostic way

Downloads

10

Readme

Why

Testing web push is hard and with difference between browsers being an issue as standards are created and implemented, the best approach to ensure a library is up to date is to have integration tests. Sadly this involves knowledge and implementation of selenium web driver and implementing the logic to manage those browsers for push testing.

This library handles the selenium and browser orchestrating and makes them available via a JSON API, simplifying the whole process.

Install

npm install @marc1706/web-push-testing-service -g

Usage

To start the push testing service run:

web-push-testing-service start <Service Name>

This will start the service and run it in the background on port 8090. If you need to run it on a different port, you can use the port flag:

web-push-testing-service start <Service Name> -p 9000

Once you've finished using the service you just need run the stop command.

web-push-testing-service start <Service Name>

With the service started you can make POST requests in the following flow to write integration tests for your push library.

Regardless of the API you call, you'll receive JSON and the top level parameter will be either 'data' or 'error'. Data will change depending on the API called and error with have an 'id' and 'message' parameter.

  1. Start Test Suite This assigns a test suite ID to the current run that all future tests are tied to.

    http://localhost:8090/api/start-test-suite/

    Input: Nothing

    Output

    {
      data: {
        testSuiteId: <New ID>
      }
    }
  2. Get a Subscription This method expected a testSuiteId, a browser name and the release version and it will return a subscription.

    http://localhost:8090/api/get-subscription/

    Input

    {
        testSuiteId: <Test Suite ID Number>,
        browserName: <'chrome' | 'firefox'>,
        browserVersion: <'stable' | 'beta' | 'unstable' >,
        vapidPublicKey: <Base64 URL Encode Vapid Public Key>
    }

    Output

    {
        data: {
            testId: <ID for this test instance>,
            subscription: <A Subscription Object, will have endpoint and keys>
        }
    }
  3. Wait for notification to arrive Once your library has sent a message you can retrieve what details the browser received.

    http://localhost:8090/api/get-notification-status/

    Input

    {
        testSuiteId: <Test Suite ID Number>
        testId: <Test ID Number>
    }

    Output

    {
        data: {
            messages: [
                <Payload String>,
                ...
            ]
        }
    }
  4. End the Test Suite This will end and close any currently open tests.

    http://localhost:8090/api/end-test-suite/

    Input

    {
      testSuiteId: <Your Test Suite ID>
    }

    Output

    {
      data: {
        success: true
      }
    }