Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blocking-proxy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blocking-proxy

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

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
785K
increased by11.33%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 18 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc