Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow with macOS 11 #104

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8811743
Update workflow with macOS 11
alcivanio Sep 8, 2022
c6aff61
Update macOS 11
alcivanio Sep 8, 2022
550db8b
Update build OS simulator versions
alcivanio Sep 8, 2022
21760e6
Update ci.yml
alcivanio Sep 8, 2022
b5ac528
Update device sizes
alcivanio Sep 8, 2022
0f75164
Update snapshots
alcivanio Sep 9, 2022
9137a41
Update XCode version for simulators and CI
alcivanio Sep 9, 2022
5dbd2de
Update snapshots
alcivanio Sep 9, 2022
ca8d757
Update snapshots
alcivanio Sep 9, 2022
4bfe4c3
Update Objc Snapshots
alcivanio Sep 9, 2022
8151b5f
Update Snapshot pod version
alcivanio Sep 9, 2022
4a44f17
Check if updating snapshots with server render snapshots will fix the…
alcivanio Sep 13, 2022
5c3dd44
Update pixel perfect tolerance
alcivanio Sep 13, 2022
2469310
Merge branch 'master' into alcivanio/update-workflow-macos11
alcivanio Sep 13, 2022
5de1fa1
update CI
alcivanio Sep 13, 2022
44258bb
Change pixel tolerance
alcivanio Sep 13, 2022
7b76b50
Replace snapshots for the rendering methods
alcivanio Sep 13, 2022
5eb0fab
Update snapshots for 14.5
alcivanio Sep 14, 2022
62fc9cb
Update accessibility verify function signature to include pixel toler…
alcivanio Sep 14, 2022
93b04ae
Update tests sensitivity
alcivanio Sep 14, 2022
ad4d8f9
fix uikit imports
alcivanio Sep 14, 2022
f34c1aa
Update iOS 14 snapshots
alcivanio Sep 14, 2022
e39e76b
update ios 13 snapshots
alcivanio Sep 14, 2022
1b5a2d4
Fix per pixel tolerance in simple snapshot tests
alcivanio Sep 14, 2022
24095b1
Follow up on initial change suggestions
alcivanio Sep 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,40 @@ on:
jobs:
xcode-build:
name: Xcode Build
runs-on: macOS-10.15
runs-on: macOS-11
strategy:
matrix:
platform: ['iOS_14', 'iOS_13', 'iOS_12']
platform: ['iOS_14','iOS_13']
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install --gemfile=Example/Gemfile
- name: Select Xcode Version (12.2)
run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
- name: Select Xcode Version (12.5.1)
run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app/Contents/Developer
if: matrix.platform == 'iOS_14'
- name: Select Xcode Version (11.7)
run: sudo xcode-select --switch /Applications/Xcode_11.7.app/Contents/Developer
if: matrix.platform == 'iOS_13'
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platform }}
- name: Pod Install
run: bundle exec --gemfile=Example/Gemfile pod install --project-directory=Example
- name: Build and Test
run: Scripts/build.swift xcode ${{ matrix.platform }} `which xcpretty`
- name: Upload Results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Test Results
path: .build/derivedData/**/Logs/Test/*.xcresult
pod-lint:
name: Pod Lint
runs-on: macOS-10.15
runs-on: macOS-11
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install --gemfile=Example/Gemfile
- name: Pod Install
Expand All @@ -48,15 +51,15 @@ jobs:
run: bundle exec --gemfile=Example/Gemfile pod lib lint --verbose --fail-fast
spm:
name: SPM Build
runs-on: macOS-10.15
runs-on: macOS-11
strategy:
matrix:
platform: ['iOS_14']
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app/Contents/Developer
- name: Build
run: Scripts/build.swift spm ${{ matrix.platform }}
4 changes: 4 additions & 0 deletions Example/AccessibilitySnapshot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
1635CE4E251EAC6700907101 /* SnapshotTestingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1635CE4D251EAC6700907101 /* SnapshotTestingTests.swift */; };
3175D0E828D23C730006FCB2 /* LocalTestsConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3175D0E528D173180006FCB2 /* LocalTestsConstants.swift */; };
3D04B6D6211558B0006218A4 /* AccessibilityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D04B6D5211558B0006218A4 /* AccessibilityViewController.swift */; };
3D04B6D921155942006218A4 /* LabelAccessibilityPropertiesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D04B6D821155942006218A4 /* LabelAccessibilityPropertiesViewController.swift */; };
3D04B6DB21155D92006218A4 /* ButtonAccessibilityTraitsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D04B6DA21155D92006218A4 /* ButtonAccessibilityTraitsViewController.swift */; };
Expand Down Expand Up @@ -78,6 +79,7 @@
/* Begin PBXFileReference section */
0BFCB4FD6BC17AB232B26E72 /* Pods_UnitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UnitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1635CE4D251EAC6700907101 /* SnapshotTestingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnapshotTestingTests.swift; sourceTree = "<group>"; };
3175D0E528D173180006FCB2 /* LocalTestsConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalTestsConstants.swift; sourceTree = "<group>"; };
358D84DCD315110A89BD052E /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = "<group>"; };
3A3192D7B9B16BD10FB517A2 /* Pods_SnapshotTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SnapshotTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B8EB28BD6E6A6332C5D3115 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
Expand Down Expand Up @@ -206,6 +208,7 @@
isa = PBXGroup;
children = (
3D220A2A252AF72900359C1E /* AccessibleContainerView.swift */,
3175D0E528D173180006FCB2 /* LocalTestsConstants.swift */,
);
name = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -644,6 +647,7 @@
3D220A2B252AF72900359C1E /* AccessibleContainerView.swift in Sources */,
3DC8D05B224750F500E8A03C /* TextAccessibilityTests.swift in Sources */,
1635CE4E251EAC6700907101 /* SnapshotTestingTests.swift in Sources */,
3175D0E828D23C730006FCB2 /* LocalTestsConstants.swift in Sources */,
3DBEAA5D2223C0CE00FAE61D /* SwitchControlsTests.swift in Sources */,
3DF46500220D5FB00048D446 /* ElementSelectionTests.swift in Sources */,
3DBAC28722406EBB00EF4D0A /* AccessibilityContainersTests.swift in Sources */,
Expand Down
5 changes: 4 additions & 1 deletion Example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ GIT
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)

GEM
specs:

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -123,4 +126,4 @@ DEPENDENCIES
xcodeproj!

BUNDLED WITH
1.17.3
2.3.19
4 changes: 1 addition & 3 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ target 'AccessibilitySnapshotDemo' do
pod 'AccessibilitySnapshot/iOSSnapshotTestCase', :path => '../AccessibilitySnapshot.podspec'
pod 'AccessibilitySnapshot/SnapshotTesting', :path => '../AccessibilitySnapshot.podspec'

# SnapshotTesting dropped support for building with Xcode 10 in 1.8.0, so pin the version to 1.7 in order to
# run our tests against Xcode 10.
pod 'SnapshotTesting', '= 1.7.2'
pod 'SnapshotTesting', '= 1.9.0'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this ~> 1.9 now, since we don't need to pin to a specific version?

end

target 'UnitTests' do
Expand Down
10 changes: 5 additions & 5 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ PODS:
- iOSSnapshotTestCase/SwiftSupport (8.0.0):
- iOSSnapshotTestCase/Core
- Paralayout (0.9.1)
- SnapshotTesting (1.7.2)
- SnapshotTesting (1.9.0)

DEPENDENCIES:
- AccessibilitySnapshot/Core (from `../AccessibilitySnapshot.podspec`)
- AccessibilitySnapshot/iOSSnapshotTestCase (from `../AccessibilitySnapshot.podspec`)
- AccessibilitySnapshot/SnapshotTesting (from `../AccessibilitySnapshot.podspec`)
- Paralayout (from `https://github.com/square/Paralayout`)
- SnapshotTesting (= 1.7.2)
- SnapshotTesting (= 1.9.0)

SPEC REPOS:
trunk:
Expand All @@ -38,11 +38,11 @@ CHECKOUT OPTIONS:
:git: https://github.com/square/Paralayout

SPEC CHECKSUMS:
AccessibilitySnapshot: 30f66cb9786812eb95381d9f763abcf2b6cc57ad
AccessibilitySnapshot: 3f5cbf62f08fea6130347706b5e359eb25a9d7f7
iOSSnapshotTestCase: a670511f9ee3829c2b9c23e6e68f315fd7b6790f
Paralayout: f4d6727fca5b592eb93a7cc408e45404599a4b0a
SnapshotTesting: 8caa6661fea7c8019d5b46de77c16bab99c36c5c
SnapshotTesting: 6141c48b6aa76ead61431ca665c14ab9a066c53b

PODFILE CHECKSUM: 9d965121b60425a32e1b4c884c4c6b7aff62fa52
PODFILE CHECKSUM: f507f1276a0162c64115b671b571aa8f5d60697f

COCOAPODS: 1.11.0.rc.1
41 changes: 41 additions & 0 deletions Example/SnapshotTests/LocalTestsConstants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright 2022 Square Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import UIKit

public class LocalTestsConstants: NSObject {

/**
This float ranges from 0 to 1 and will be used to calculate how precise a snapshot test will be,
where 1 means all pixels should match, and 0 means that none of them need to match.
*/
static public let testPrecision: CGFloat = 0.9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

90% seems pretty low... does it need to be this low to pass, or can we be stricter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good catch. It was a type, but I haven't tested with other numbers. Let's try 98% to see how it goes.


/**
In these local tests, we will use test precision to calculate pixel tolerance.
*/
static public var perPixelTolerance: CGFloat {
return 1.0 - testPrecision
}

/**
Used to activate or deactivate record mode. If active, new snapshots will be recorded/saved for
those thats that are run.
*/
static public let isRecordMode: Bool = false

}
20 changes: 12 additions & 8 deletions Example/SnapshotTests/ObjectiveCTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

@import AccessibilitySnapshot;
@import FBSnapshotTestCase;
@import UIKit;
@import XCTest;


Expand All @@ -26,10 +27,13 @@ @interface ObjectiveCTests : FBSnapshotTestCase

@implementation ObjectiveCTests

CGFloat perPixelTolerance = 0.02;

- (void)setUp;
{

[super setUp];

self.fileNameOptions = FBSnapshotTestCaseFileNameIncludeOptionOS | FBSnapshotTestCaseFileNameIncludeOptionScreenSize | FBSnapshotTestCaseFileNameIncludeOptionScreenScale;
}

Expand All @@ -44,7 +48,7 @@ - (void)testSimpleView;
label.textAlignment = NSTextAlignmentCenter;
[view addSubview:label];

SnapshotVerifyAccessibility(view, nil);
SnapshotVerifyAccessibility(view, nil, perPixelTolerance);
}

- (void)testSimpleViewWithIdentifier;
Expand All @@ -58,7 +62,7 @@ - (void)testSimpleViewWithIdentifier;
label.textAlignment = NSTextAlignmentCenter;
[view addSubview:label];

SnapshotVerifyAccessibility(view, @"identifier");
SnapshotVerifyAccessibility(view, @"identifier", perPixelTolerance);
}

- (void)testSimpleViewWithActivationPointDefault;
Expand All @@ -75,7 +79,7 @@ - (void)testSimpleViewWithActivationPointDefault;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
label.accessibilityActivationPoint = CGPointMake(screenBounds.size.width / 2, screenBounds.size.height / 2 - 10);

SnapshotVerifyAccessibility(view, nil);
SnapshotVerifyAccessibility(view, nil, perPixelTolerance);
}

- (void)testSimpleViewWithActivationPointAlways;
Expand All @@ -89,7 +93,7 @@ - (void)testSimpleViewWithActivationPointAlways;
label.textAlignment = NSTextAlignmentCenter;
[view addSubview:label];

SnapshotVerifyAccessibilityWithOptions(view, nil, YES, YES);
SnapshotVerifyAccessibilityWithOptions(view, nil, YES, YES, perPixelTolerance);
}

- (void)testSimpleViewWithActivationPointNever;
Expand All @@ -106,7 +110,7 @@ - (void)testSimpleViewWithActivationPointNever;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
label.accessibilityActivationPoint = CGPointMake(screenBounds.size.width / 2, screenBounds.size.height / 2 - 10);

SnapshotVerifyAccessibilityWithOptions(view, nil, NO, YES);
SnapshotVerifyAccessibilityWithOptions(view, nil, NO, YES, perPixelTolerance);
}

- (void)testSimpleViewWithColorSnapshots;
Expand All @@ -123,7 +127,7 @@ - (void)testSimpleViewWithColorSnapshots;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
label.accessibilityActivationPoint = CGPointMake(screenBounds.size.width / 2, screenBounds.size.height / 2 - 10);

SnapshotVerifyAccessibilityWithOptions(view, nil, NO, NO);
SnapshotVerifyAccessibilityWithOptions(view, nil, NO, NO, 0);
}

- (void)testViewWithInvertedColors;
Expand All @@ -137,7 +141,7 @@ - (void)testViewWithInvertedColors;
[subview setAccessibilityIgnoresInvertColors:YES];
[view addSubview:subview];

SnapshotVerifyWithInvertedColors(view, nil);
SnapshotVerifyWithInvertedColors(view, nil, 0);
}

@end
Binary file added ..._64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ..._64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .../_64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .../_64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...Images/_64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...Images/_64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ..._64/ObjectiveCTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ..._64/ObjectiveCTests/[email protected]
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.
Binary file added ...essibilityContainersTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ...ityContainersTests/[email protected]
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.
Binary file added ...bilitySnapshotTests/[email protected]
Binary file added ...bilitySnapshotTests/[email protected]
Binary file added ...bilitySnapshotTests/[email protected]
Binary file added ...bilitySnapshotTests/[email protected]
Binary file added ...bilitySnapshotTests/[email protected]
Binary file added ...ccessibilitySnapshotTests/[email protected]
Binary file added ...ccessibilitySnapshotTests/[email protected]
Binary file added ...ccessibilitySnapshotTests/[email protected]
Binary file added ...tivationPointTests/[email protected]
Binary file added ...tivationPointTests/[email protected]
Binary file added ...tivationPointTests/[email protected]
Binary file added ...ests.ElementOrderTests/[email protected]
Binary file added ...ests.ElementOrderTests/[email protected]
Binary file added ...ests.ElementOrderTests/[email protected]
Binary file added ...hotTests.ElementOrderTests/[email protected]
Binary file added ...hotTests.ElementOrderTests/[email protected]
Binary file added ...hotTests.ElementOrderTests/[email protected]
Binary file added ...ests.ElementOrderTests/[email protected]
Binary file added ...ests.ElementOrderTests/[email protected]
Binary file added ...ests.ElementOrderTests/[email protected]
Binary file added ...ests.ElementSelectionTests/[email protected]
Binary file added ...ests.ElementSelectionTests/[email protected]
Binary file added ...ests.ElementSelectionTests/[email protected]
Binary file added ...SelectionTests/[email protected]
Binary file added ...SelectionTests/[email protected]
Binary file added ...SelectionTests/[email protected]
Binary file added ...ntSelectionTests/[email protected]
Binary file added ...ntSelectionTests/[email protected]
Binary file added ...ntSelectionTests/[email protected]
Binary file added ...entSelectionTests/[email protected]
Binary file added ...entSelectionTests/[email protected]
Binary file added ...entSelectionTests/[email protected]
Binary file added ...SnapshotTests.LayoutTests/[email protected]
Binary file added ...SnapshotTests.LayoutTests/[email protected]
Binary file added ...4/SnapshotTests.ModalTests/[email protected]
Binary file added ...4/SnapshotTests.ModalTests/[email protected]
Binary file added ...tTests.SwitchControlsTests/[email protected]
Binary file added ...tTests.SwitchControlsTests/[email protected]
7 changes: 4 additions & 3 deletions Example/SnapshotTests/SnapshotTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class SnapshotTestCase: FBSnapshotTestCase {
// MARK: - Private Static Properties

private static let testedDevices = [
TestDeviceConfig(systemVersion: "14.2", screenSize: CGSize(width: 390, height: 844), screenScale: 3),
TestDeviceConfig(systemVersion: "13.3", screenSize: CGSize(width: 375, height: 812), screenScale: 3),
TestDeviceConfig(systemVersion: "15.2", screenSize: CGSize(width: 390, height: 844), screenScale: 3),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the tests locally and it looks like you're missing a bunch of reference images for 15.2. If we're going to add 15.2 support here, we need to have a matching CI build to verify it. This PR is getting quite large, though, so I think it's worth splitting out adding 15.2 into a separate change.

TestDeviceConfig(systemVersion: "14.5", screenSize: CGSize(width: 390, height: 844), screenScale: 3),
TestDeviceConfig(systemVersion: "13.7", screenSize: CGSize(width: 375, height: 812), screenScale: 3),
TestDeviceConfig(systemVersion: "12.4", screenSize: CGSize(width: 375, height: 812), screenScale: 3),
]

Expand All @@ -68,7 +69,7 @@ class SnapshotTestCase: FBSnapshotTestCase {

fileNameOptions = [.OS, .screenSize, .screenScale]

recordMode = false
recordMode = LocalTestsConstants.isRecordMode
}

}
8 changes: 4 additions & 4 deletions Example/SnapshotTests/SnapshotTestingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ final class SnapshotTestingTests: XCTestCase {

assertSnapshot(
matching: view,
as: .accessibilityImage(useMonochromeSnapshot: false),
as: .accessibilityImage(useMonochromeSnapshot: false, precision:0.98),
named: nameForDevice(baseName: "false")
)

assertSnapshot(
matching: view,
as: .accessibilityImage(useMonochromeSnapshot: true),
as: .accessibilityImage(useMonochromeSnapshot: true, precision:0.98),
named: nameForDevice(baseName: "true")
)
}
Expand All @@ -116,13 +116,13 @@ final class SnapshotTestingTests: XCTestCase {

assertSnapshot(
matching: container,
as: .accessibilityImage(drawHierarchyInKeyWindow: false),
as: .accessibilityImage(drawHierarchyInKeyWindow: false, precision:0.98),
named: nameForDevice(baseName: "false")
)

assertSnapshot(
matching: container,
as: .accessibilityImage(drawHierarchyInKeyWindow: true),
as: .accessibilityImage(drawHierarchyInKeyWindow: true, precision:0.98),
named: nameForDevice(baseName: "true")
)
}
Expand Down
15 changes: 10 additions & 5 deletions Example/SnapshotTests/SwitchControlsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ final class SwitchControlsTests: SnapshotTestCase {
let container = ContainerView(control: control)
container.frame.size = container.sizeThatFits(UIScreen.main.bounds.size)

SnapshotVerifyAccessibility(container)
SnapshotVerifyAccessibility(container,
perPixelTolerance: LocalTestsConstants.perPixelTolerance)
}

func testOff() {
Expand Down Expand Up @@ -58,7 +59,8 @@ final class SwitchControlsTests: SnapshotTestCase {
let container = ContainerView(control: control)
container.frame.size = container.sizeThatFits(UIScreen.main.bounds.size)

SnapshotVerifyAccessibility(container)
SnapshotVerifyAccessibility(container,
perPixelTolerance: LocalTestsConstants.perPixelTolerance)
}

func testOn_withLabelAndValue() {
Expand All @@ -70,7 +72,8 @@ final class SwitchControlsTests: SnapshotTestCase {
let container = ContainerView(control: control)
container.frame.size = container.sizeThatFits(UIScreen.main.bounds.size)

SnapshotVerifyAccessibility(container)
SnapshotVerifyAccessibility(container,
perPixelTolerance: LocalTestsConstants.perPixelTolerance)
}

func testOn_withLabelAndHint() {
Expand All @@ -82,7 +85,8 @@ final class SwitchControlsTests: SnapshotTestCase {
let container = ContainerView(control: control)
container.frame.size = container.sizeThatFits(UIScreen.main.bounds.size)

SnapshotVerifyAccessibility(container)
SnapshotVerifyAccessibility(container,
perPixelTolerance: LocalTestsConstants.perPixelTolerance)
}

func testOn_withLabelAndHintAndTraits() {
Expand All @@ -103,7 +107,8 @@ final class SwitchControlsTests: SnapshotTestCase {
let container = ContainerView(control: control)
container.frame.size = container.sizeThatFits(UIScreen.main.bounds.size)

SnapshotVerifyAccessibility(container)
SnapshotVerifyAccessibility(container,
perPixelTolerance: LocalTestsConstants.perPixelTolerance)
}

func testFakeSwitch() {
Expand Down
Loading