Skip to content

Releases: ashfurrow/Nimble-Snapshots

4.4.0

02 Jan 14:33
c12a31a
Compare
Choose a tag to compare
  • 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 and recordDynamicSizeSnapshot 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 use ResizeMode.block. The block will be call on every resize. Or you can
    implement the ViewResizer 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

4.3.0

30 Jan 01:30
Compare
Choose a tag to compare
  • 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 and recordDynamicTypeSnapshot 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

4.2.0

30 Jan 01:35
2bcf51d
Compare
Choose a tag to compare

Adds Swift 2.3/3.0 support - @carezone

4.1.0

30 Jan 01:30
7e93bf4
Compare
Choose a tag to compare
  • Adds tolerance so you can specify tolerance of reference image differences – @mpurland

4.0.1

30 Jan 01:30
Compare
Choose a tag to compare
  • Adds recordSnapshot(name=nil) so you can use expect(thing) == recordSnapshot() as this feels much nicer than
    writing expect(thing).to( recordSnapshot() ) - I'm still not over this to( thing() )' bit in Quick. Looks messy. - @orta

4.0.0

30 Jan 01:31
Compare
Choose a tag to compare
  • Nimble-Snapshots does not call view?.drawViewHierarchyInRect(bounds, afterScreenUpdates: true) on your views by default. - @orta

    If 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 inside FBSnapshotTestController, which we now expose as an option in recordSnapshot
      and haveValidSnapshot as usesDrawRect

          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.

3.0.1

30 Jan 01:31
Compare
Choose a tag to compare
  • Loosens dependency version. - @alesker

3.0.0

30 Jan 01:31
Compare
Choose a tag to compare
  • Calls through to drawViewHierarchyInRect on every snapshot prior to snapshot being made – @ashfurrow

2.0.1

30 Jan 01:31
Compare
Choose a tag to compare

2.0.0

30 Jan 01:32
Compare
Choose a tag to compare
  • Name sanitizing, custom folders and more housekeeping - @colinta