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

testcafe-browser-provider-puppeteer-core

v1.1.1

Published

puppeteer-core TestCafe browser provider plugin.

Downloads

17

Readme

testcafe-browser-provider-puppeteer-core

This is the puppeteer-core browser provider plugin for TestCafe.

This package implements the puppeteer browser automation for TestCafe.

This browser provider plugin can:

  • connect to remote Chromium instance through the DevTools Protocol
  • download a recent Chromium build (if not already downloaded) and use it for the tests
  • launch a specific Chromium executable

Same as with the official puppeteer-core package, this package doesn't download Chromium when installed.

Install

npm install testcafe-browser-provider-puppeteer-core

Usage

There are two browser aliases available:

  • puppeteer-core:connect
  • puppeteer-core:launch

Parameters can be passed to a browser alias using a URL query string (URL encoded or not):

puppeteer-core:browser_alias_name?param1=value&param2=value&param3=value

puppeteer-core:connect

puppeteer-core:connect connects to a remote Chromium instance through the DevTools Protocol.

Parameters:

  • url: the url to connect to the remote Chromium instance (defaults to http://127.0.0.1:9222).
  • resolve: whether or not to resolve the hostname in the url as a workaround to the issue described in GoogleChrome/puppeteer#2242 (defaults to false).

Example:

The command below launches a headless-shell build of Chromium in a Docker container:

docker run -d --rm -p 9222:9222 --entrypoint '/headless-shell/headless-shell' chromedp/headless-shell --no-sandbox --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222

Run the tests using the the Chromium instance launched above:

testcafe 'puppeteer-core:connect?url=http://127.0.0.1:9222' 'path/to/test/file.js'

puppeteer-core:launch

puppeteer-core:launch downloads (optional) and launches a Chromium executable.

Parameters:

  • revision: revision of the bundled Chromium to download and launch (see https://omahaproxy.appspot.com for the list of revision). Defaults to the puppeteer-core package recommended version.
  • path: path to a Chromium (or Chrome) executable to run instead of the bundled Chromium (optional).
  • headless: whether or not to run Chromium headless (defaults to true).
  • arg: extra command line arguments to pass to Chromium (repeat the arg parameter to pass multiple arguments).

NOTE: if the path parameter is used, revision is ignored and Chromium won't be downloaded if the executable is not found.

Example:

Run the tests using the bundled Chromium (it will download it if not found locally):

testcafe 'puppeteer-core:launch' 'path/to/test/file.js'

Run the tests using a specific bundled Chromium revision (it will download it if not found locally):

testcafe 'puppeteer-core:launch?revision=693954' 'path/to/test/file.js'

Run the tests using the bundled Chromium (it will download it if not found locally) and the --no-sandbox and --disable-setuid-sandbox Chromium arguments:

testcafe 'puppeteer-core:launch?arg=--no-sandbox&arg=--disable-setuid-sandbox' 'path/to/test/file.js'

Run the tests using a specific Chromium executable:

testcafe 'puppeteer-core:launch?path=/my/path/to/chromium' 'path/to/test/file.js'

Development

Please read the Testcafe browser provider plugin documentation.

To test the browser provider while developing, you can link the browser provider to TestCafe by using the npm link command:

First, link the browser provider package:

cd testcafe-browser-provider-puppeteer-core
npm link

Then, to use the local package in your project:

cd my-project
npm link testcafe-browser-provider-puppeteer-core

Contributing

Pull requests welcome.