TestWidget | R Documentation |
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.
TestWidget(
widget,
name,
delay = 2,
threshold = 0.001,
...,
diff.path = "snapshots/diff",
accepted.path = "snapshots/accepted"
)
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 |
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. |
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
.
CompareSnapshot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.