Skip to content

Commit

Permalink
Paywalls: changed snapshots to scale 1 (#3016)
Browse files Browse the repository at this point in the history
This reduces the total size of all paywall snapshots from 247MB to 34MB.
  • Loading branch information
NachoSoto authored Aug 14, 2023
1 parent 448ea21 commit b523646
Show file tree
Hide file tree
Showing 86 changed files with 11 additions and 8 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions Tests/StoreKitUnitTests/Support/DebugViewSwiftUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class DebugViewSwiftUITests: TestCase {
}

func testLoadingState() {
expect(self.view(with: .init(), width: 300, height: 400))
.to(haveValidSnapshot(as: .image))
self.snapshot(.init(), width: 300, height: 400)
}

func testDebugView() throws {
Expand All @@ -55,24 +54,24 @@ class DebugViewSwiftUITests: TestCase {
response: .mockResponse
))

expect(self.view(with: model, width: 450, height: 900))
.to(haveValidSnapshot(as: .image))
self.snapshot(model, width: 450, height: 900)
}

}

@available(iOS 16.0, *)
private extension DebugViewSwiftUITests {

func view(
with model: DebugViewModel,
func snapshot(
_ model: DebugViewModel,
width: CGFloat,
height: CGFloat
) -> some View {
) {
NavigationView {
DebugSummaryView(model: model)
}
.frame(width: width, height: height)
.snapshot(size: CGSize(width: width, height: height))
}

static var mockCustomerInfo: CustomerInfo {
Expand Down
6 changes: 5 additions & 1 deletion Tests/UnitTests/TestHelpers/SnapshotTesting+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension SwiftUI.View {
controller
).toEventually(
haveValidSnapshot(
as: .image(perceptualPrecision: 0.98, size: size),
as: .image(perceptualPrecision: 0.98, size: size, traits: traits),
named: "1", // Force each retry to end in `.1.png`
file: file,
line: line
Expand All @@ -78,6 +78,10 @@ extension SwiftUI.View {
}

}

// Generate snapshots with scale 1, which drastically reduces the file size.
private let traits: UITraitCollection = .init(displayScale: 1)

#endif

private let timeout: DispatchTimeInterval = .seconds(5)
Expand Down

0 comments on commit b523646

Please sign in to comment.