Releases: skyweb07/Snap.swift
πΈ Multiple device snapshots + Kaleidoscope support
New year, new challenges! π₯
This version brings a really cool feature so we can test multiple device screens in one assertion, it's as simple as:
expect(viewController).toMatchSnapshot(for devices: [.iphone4, .iphone5s])
// or
expect(viewController).toMatchSnapshot(for: .allDevices)
Also thanks to @PhilippeRiegert we have added support for Kaleidoscope ksdiff
#29 tool so it logs in the console the command needed to do diffing using the tool. To finish up we have fixed a small issue with auto layout constraints that needed to finish to update the layout before rendering the image on #28
tvOS support πΊ + Carthage π§ + Custom snapshot names γ
Another minor release with some good stuff on it
- @dcordero added support for
tvOS
support #17 πΊ - @vojtechvrbka added support for
Carthage
#19 π§
Also, I've added support for custom snapshot names, now you can take many screenshots from a test case using custom names as:
expect(view).toMatchSnapshot(named: "custom_name") // Reference image will be stored with this name
To end, @rnystrom found an issue π when generating snapshots in projects with spaces on directory #22
Thanks everyone involved β¨
Export image resources π
What
As requested @niilohlin we now store the image assets in disk so external agents like (CI systems etc) can use those images
CALayer & Objective-C support β
What
- Added support for checking for CALayers, now you can use the same pattern that for view checking
func test_box_with_gradient_layer() {
let layer = CAGradientLayer()
layer.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
expect(layer).toMatchSnapshot()
}
- Added Objective-C compatibility and it's as easy as swift
@import XCTest;
#import <Snap_swift/Snap_swift-swift.h>
#import <Snap_swift/Snap.h>
@interface SnapTests : XCTestCase
@end
@implementation SnapTests
- (void)test_box_with_text_aligned_to_center {
UIView *view = [BoxWithTextAlignedToCenterView new];
verifyView(view); // or verifyLayer if it's a CALayer subclass
}
@end