Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 1.69 KB

testing.md

File metadata and controls

45 lines (28 loc) · 1.69 KB

Node Chrome

Testing deck.gl Applications and Layers

This article is a work in progress.

Using probe.gl BrowserTestDriver

Helper class primarily intended for automating browser tests from Node.js shell scripts. A RenderTestDriver starts a Chrome browser instance and a server and opens a page with a URL that loads a script from the server. The script that runs in the browser is expected to be using the RenderTest class.

For details on how the automation works, see the probe.gl BrowserDriver class.

Usage

In your node.js start script:

// This is the script that runs in Node.js and starts the browser
const {BrowserTestDriver} = require('probe.gl/test-utils');
new BrowserTestDriver().run({
  process: 'webpack-dev-server',
  parameters: ['--env.render']
});

Create a BrowserTestDriver instance.

new BrowserTestDriver()

renderTestDriver.run()

Runs the tests:

  • starts a Chrome browser instance,
  • starts a server (typically a webpack-dev-server) that bundles a test script.
  • the test script renders a set of tests (described below), compares the output against golden images
  • closes down all processes and browser tabs.
  • the test script returns a pass/fail value to the BrowserTestDriver which ultimately passes back a 0 (success) or 1 failure to the invoking shell.