- Adds support for Carthage (Swift 3.0) - @juolgon & @lascorbe
- Adds support for Carthage (Swift 2.3) - @juolgon & @lascorbe
-
Adds support for testing dynamic sizes - @bruno.mazzo
You need the use the new subspec to enjoy this new feature:
pod 'Nimble-Snapshots/DynamicSize'
Then you can use the new
haveValidDynamicSizeSnapshot
andrecordDynamicSizeSnapshot
matchers to use it:let sizes = ["SmallSize": CGSize(width: 44, height: 44), "MediumSize": CGSize(width: 88, height: 88), "LargeSize": CGSize(width: 132, height: 132)] // expect(view).to(recordDynamicSizeSnapshot(sizes: sizes)) expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes)) // You can also just test some sizes: expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes)) // If you prefer the == syntax, we got you covered too: expect(view) == dynamicSizeSnapshot(sizes: sizes) expect(view) == dynamicSizeSnapshot(sizes: sizes)
By default, the size will be set on the view using the frame property. To change this behavior you can use the
ResizeMode
enum:public enum ResizeMode { case frame case constrains case block(resizeBlock: (UIView, CGSize)->()) case custom(ViewResizer: ViewResizer) }
To use the enum you can
expect(view) == dynamicSizeSnapshot(sizes: sizes, resizeMode: newResizeMode)
. For custom behavior you can useResizeMode.block
. The block will be call on every resize. Or you can implement theViewResizer
protocol and resize yourself. The custom behavier can be use to record the views too.
For more info on usage, check the dynamic sizes tests.
- Improved failure messages by removing the prefix ", got" - @MP0w
-
Adds support for testing dynamic type - @marcelofabri
You need the use the new subspec to enjoy this new feature:
pod 'Nimble-Snapshots/DynamicType'
Then you can use the new
haveValidDynamicTypeSnapshot
andrecordDynamicTypeSnapshot
matchers to use it:// expect(view).to(recordDynamicTypeSnapshot() expect(view).to(haveValidDynamicTypeSnapshot()) // You can also just test some sizes: expect(view).to(haveValidDynamicTypeSnapshot(sizes: [UIContentSizeCategoryExtraLarge])) // If you prefer the == syntax, we got you covered too: expect(view) == dynamicTypeSnapshot() expect(view) == dynamicTypeSnapshot(sizes: [UIContentSizeCategoryExtraLarge])
Note that this will post an
UIContentSizeCategoryDidChangeNotification
, so your views/view controllers need to observe that and update themselves.For more info on usage, check the dynamic type tests.
-
Removes support for Xcode 7.3 and Swift 2.2 - @marcelofabri
-
Adds Swift 2.3/3.0 support - @carezone
- Adds
tolerance
so you can specify tolerance of reference image differences – @mpurland
- Adds
recordSnapshot(name=nil)
so you can useexpect(thing) == recordSnapshot()
as this feels much nicer than writingexpect(thing).to( recordSnapshot() )
- I'm still not over thisto( thing() )
' bit in Quick. Looks messy. - @orta
-
Nimble-Snapshots does not call
view?.drawViewHierarchyInRect(bounds, afterScreenUpdates: true)
on your views by default. - @ortaIf this is something that you need in order to get your snapshots passing, you should look at two options:
-
Adding the view to an existing window, then calling
drawViewHierarchyInRect:afterScreenUpdates:
- this is the technique that is used insideFBSnapshotTestController
, which we now expose as an option inrecordSnapshot
andhaveValidSnapshot
asusesDrawRect
expect(imageView).to( recordSnapshot(usesDrawRect: true) ) expect(imageView).to( haveValidSnapshot(usesDrawRect: true) )
You can get more info on the technique on this issue
-
Spending time looking in how you can remove Async code from your App. Or look for places where you are relying on a view structure which isn't set up in your tests. There are a bunch of examples in https://github.com/orta/pragmatic-testing on removing Async.
-
- Loosens dependency version. - @alesker
- Calls through to
drawViewHierarchyInRect
on every snapshot prior to snapshot being made – @ashfurrow
- Disables bitcode – @ashfurrow
- Name sanitizing, custom folders and more housekeeping - @colinta
- Device diagnostic code – @esttorhe
- Swift 2 support - @tibr
- Updates Quick and Numble to latest (requires Xcode 6.3+) - @andreamazz
- Adds pretty syntax support for snapshots with unspecified names - @ashfurrow
- Ensure all ReferenceImages folders are in the same root folder - @orta
- Updated to official repos of Quick and Nimble for beta 5 support - @ashfurrow