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

blocking-proxy

v1.0.1

Published

WebDriver Proxy for testing rich clients. It block certain calls until Angular is done updating the page under test.

Downloads

3,581,399

Readme

Blocking Proxy Build Status

Blocking Proxy is a tool for adding functionality to WebDriver-based tests. It sits between your tests and the Selenium Server. For each WebDriver command, it runs a set of 'barriers' that will block forwarding the command to the Selenium server until some condition is met.

Because it interacts with WebDriver at the network level, Blocking Proxy can be used regardless of which language your tests are written in. See the example for a demonstration of using Blocking Proxy with WebDriver tests written in Python.

Although Blocking Proxy can handle multiple WebDriver sessions, it can not yet handle multiple concurrent clients. Thus, it's recommended to start a separate instance for each test process.

Usage

Blocking Proxy can be installed globally with npm install -g blocking-proxy. You can also use it by cloning this repo and running these commands:

npm install
webdriver-manager update && webdriver-manager start (in another terminal)
node ./built/lib/bin.js --seleniumAddress http://localhost:4444/wd/hub

Features

Wait for Angular

When testing an Angular application, Blocking Proxy can block webdriver commands until Angular's change detection is finished, and thus make your tests less flaky.

Highlight Delay

If --highlightDelay <delayMS> is specified, Blocking Proxy will wait for the specified delay (in milliseconds) before executing click commands or sending keys. It will also highlight the element that is the target of the command.

Here's an example of highlight delay in action:

Highlight Delay

WebDriver logging

When --logDir <path> is set, Blocking Proxy will create a readable log of WebDriver commands at the specified path. The log will look something like this:

20:08:14.830 |    834ms | 37f13c | NewSession
    {"browserName":"chrome"}
20:08:15.674 |      4ms | 37f13c | SetTimeouts
20:08:15.681 |    578ms | 37f13c | Go http://localhost:8081/ng1/#/interaction
20:08:16.300 |    438ms | 37f13c | FindElement
    Using css selector \'.invalid\'
    ERROR: no such element

Each line shows the command that was executed and how long it took. For some commands, extra data or the response from WebDriver will be shown on following lines.

Development

Formatting and lint

gulp format runs clang-format. gulp lint validates format and runs tslint.

Running tests

Unit tests live in spec/unit and can be run with npm test. Run npm run test:auto to automatically watch for changes and run unit tests.

Running e2e tests

Start webdriver

webdriver-manager update
webdriver-manager start

in another terminal, start the testapp

npm run testapp 

Start the proxy with

npm start

in yet another terminal, run the tests

npm run test:e2e