From 164468f9fc68b8067b53fec280975a3460151f8d Mon Sep 17 00:00:00 2001 From: Thomas Mellenthin Date: Mon, 4 Nov 2024 17:26:37 +0100 Subject: [PATCH] Modernize snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop iPhone SE 1 (breaking change!), switch default phone devices to iphone8 (4.7”) + 13proMax (6.7”) - adopt new SnapshotTesting API --- Package.swift | 2 +- Sources/TestingExtensions/SnapshotTestBase.swift | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 076a5d7..6df7d63 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,7 @@ let package = Package( .library(name: "TestingExtensionsDynamic", type: .dynamic, targets: ["TestingExtensions"]) ], dependencies: [ - .package(name: "swift-snapshot-testing", url: "https://github.com/pointfreeco/swift-snapshot-testing.git", .upToNextMajor(from: "1.10.0")), + .package(name: "swift-snapshot-testing", url: "https://github.com/pointfreeco/swift-snapshot-testing.git", .upToNextMajor(from: "1.12.0")), .package(name: "SwiftRex", url: "https://github.com/SwiftRex/SwiftRex.git", .upToNextMajor(from: "0.8.12")) ], targets: [ diff --git a/Sources/TestingExtensions/SnapshotTestBase.swift b/Sources/TestingExtensions/SnapshotTestBase.swift index 41e74ea..9a4c46e 100644 --- a/Sources/TestingExtensions/SnapshotTestBase.swift +++ b/Sources/TestingExtensions/SnapshotTestBase.swift @@ -22,8 +22,8 @@ open class SnapshotTestBase: XCTestCase { open var defaultDevices: [(name: String, device: ViewImageConfig)] { [ - ("SE", .iPhoneSe), - ("X", .iPhoneX), + ("iPhone8", .iPhone8), + ("iPhone13proMax", .iPhone13ProMax), ("iPadMini", .iPadMini(.portrait) ), ("iPadPro", .iPadPro12_9(.portrait)) ] @@ -56,7 +56,7 @@ open class SnapshotTestBase: XCTestCase { } assertSnapshot( - matching: vc, + of: vc, as: .image(on: config.device, precision: imageDiffPrecision), file: file, testName: "\(testName)-\(config.name)\(suffix)",