Structure
Snapshot
public struct Snapshot: TestTool
The testing tool which generates snapshot images from scenarios managed by Playbook
.
Relationships
Conforms To
TestTool
Represents a tool for testing scenarios managed by playbooks.
Initializers
init(directory:clean:format:timeout:scale:keyWindow:devices:viewPreprocessor:)
public init(
directory: URL,
clean: Bool = false,
format: SnapshotSupport.ImageFormat,
timeout: TimeInterval = 600,
scale: CGFloat = UIScreen.main.scale,
keyWindow: UIWindow? = nil,
devices: [SnapshotDevice],
viewPreprocessor: ((UIView) -> UIView)? = nil
)
Creates a new snapshot tool for export all image files into specified directory.
Parameters
Name | Type | Description |
---|---|---|
directory | URL |
A base directory for exporting snapshot image files. |
clean | Bool |
Specifies whether to clean directory before generating snapshots. |
format | SnapshotSupport.ImageFormat |
An image file format of exported data. |
timeout | TimeInterval |
A timeout interval until the finish snapshot of all scenarios. |
scale | CGFloat |
A rendering scale of the snapshot image. |
keyWindow | UIWindow? |
The key window of the application. |
devices | [SnapshotDevice] |
A set of snapshot environment simulating devices. |
viewPreprocessor | ((UIView) -> UIView)? |
A closure to preprocess scenario UIView before generating snapshot. |
Properties
timeout
public var timeout: TimeInterval
A timeout interval until the finish snapshot of all scenarios.
viewPreprocessor
public var viewPreprocessor: ((UIView) -> UIView)?
A closure to preprocess scenario UIView before generating snapshot.
Methods
run(with:)
public func run(with playbook: Playbook) throws
Generates snapshot images for passed Playbook
instance.
Parameters
Name | Type | Description |
---|---|---|
playbook | Playbook |
A |