Giter Site home page Giter Site logo

pinkdiamond1 / testcafe-browser-provider-puppeteer-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from curvegrid/testcafe-browser-provider-puppeteer-core

0.0 1.0 0.0 152 KB

puppeteer-core TestCafe browser provider plugin.

License: MIT License

JavaScript 100.00%

testcafe-browser-provider-puppeteer-core's Introduction

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.

testcafe-browser-provider-puppeteer-core's People

Contributors

daenamkim avatar dahu33 avatar dependabot[bot] avatar stefanschenk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.