Playbook Documentation Beta

Structure Snapshot

public struct Snapshot: TestTool

The testing tool which generates snapshot images from scenarios managed by Playbook.

Conforms To

TestTool

Represents a tool for testing scenarios managed by playbooks.

Initializers

init(directory:​clean:​format:​timeout:​scale:​key​Window:​devices:​)

public init(directory: URL, clean: Bool = false, format: SnapshotSupport.ImageFormat, timeout: TimeInterval = 600, scale: CGFloat = UIScreen.main.scale, keyWindow: UIWindow? = nil, devices: [SnapshotDevice])

Creates a new snapshot tool for export all image files into specified directory.

Parameters

directory URL

A base directory for exporting snapshot image files.

clean Bool

Specifies whether to clean directory before generating snapshots.

format Snapshot​Support.​Image​Format

An image file format of exported data.

timeout Time​Interval

A timeout interval until the finish snapshot of all scenarios.

scale CGFloat

A rendering scale of the snapshot image.

key​Window UIWindow?

The key window of the application.

devices [Snapshot​Device]

A set of snapshot environment simulating devices.

Properties

directory

var directory: URL

A base directory for exporting snapshot image files.

clean

var clean: Bool

Specifies whether that to clean directory before generating snapshots.

format

var format: SnapshotSupport.ImageFormat

An image file format of exported data.

timeout

var timeout: TimeInterval

A timeout interval until the finish snapshot of all scenarios.

scale

var scale: CGFloat

A rendering scale of the snapshot image.

key​Window

var keyWindow: UIWindow?

The key window of the application.

devices

var devices: [SnapshotDevice]

A set of snapshot environment simulating devices.

Methods

run(with:​)

public func run(with playbook: Playbook) throws

Generates snapshot images for passed Playbook instance.

Parameters

playbook Playbook

A Playbook instance to be tested.