Skip to content

Test runners

PawelDalek edited this page Dec 5, 2022 · 6 revisions

Test runners

This section is dedicated to test runner-esque scripts that allow to test different ways of exporting (CLI, HTTP and NodeJS module) that concern testing almost every option described in the README. Scripts are located in the tests folder.

Export methods

There are three basic methods to trigger exporting process:

  • Using CLI (e.g. highcharts-export-server --infile chart.json --outfile chart.png).
  • Sending POST requests to a previously enabled server (highcharts-export-server --enableServer 1).
  • Directly calling the startExport function in a Node module.

For each of mentioned methods there is a script that triggers export action per set of options from a file. These files are located in the scenarios folder. Every successful scenario will result in an exported image file of a specified type in the _results folder.

CLI

  • File: cli_test_runner.js
  • Command: yarn cli-tests

This script simulates CLI export by creating a child process that spawns a shell then executes the command within that shell. The script accepts objects where the property: value scheme corresponds to the CLI argument: value, described in Command Line Arguments section.

HTTP

  • File: http_test_runner.js
  • Command: yarn http-tests

This script sends POST requests by executing CURL commands to a previously enabled HTTP server. The acceptable options for the payload can be found in the HTTP Server section.

NODE MODULE

  • File: node_test_runner.js
  • Command: yarn node-tests

This script inits pool of browser instances, loads the default options (from the lib/schemas/config.js file), merges custom options from each scenario and runs the startExport function which is the main function that starts the export process when provided with a correct configuration. The Loading JSON Configs describes possible configuration. Although, for the image export purposes, only the export and customCode sections are taken under consideration in this script and all configuration options are omitted.

Clone this wiki locally