TestWidget: TestWidget

View source: R/testwidget.R

TestWidgetR Documentation

TestWidget

Description

A wrapper to use CompareSnapshot. Compares a widget against a reference snapshot, creating snapshot if it differs from the reference or the reference does not exist.

Usage

TestWidget(
  widget,
  name,
  delay = 2,
  threshold = 0.001,
  ...,
  diff.path = "snapshots/diff",
  accepted.path = "snapshots/accepted"
)

Arguments

widget

The htmlwidget to display.

name

Used to name the snapshot; does not include file suffix.

delay

Time to wait before taking screenshot, in seconds. Sometimes a longer delay is needed for all assets to display properly.

threshold

Similarity parameter for comparing screenshots.

...

Other parameters passed to CreateSnapshot.

diff.path

Directory to place diff snapshot.

accepted.path

Directory to expect accepted snapshots to be. If no snapshots are found here, new snapshots will be taken of the widget and these will be considered the new reference.

Value

Return FALSE only if the snapshot of the widget differs from the accepted snapshot (i.e. returns TRUE when the accepted snapshot does not exist). The diff.file is only created if FALSE is returned otherwise the snapshot will be saved as accepted.file.

See Also

CompareSnapshot


Displayr/flipChartTests documentation built on Feb. 23, 2024, 9:36 p.m.