Skip to content

Commit 52d797e

Browse files
KM-13356 Ignore PIADesignSystem snapshots tests when running on Xcode Cloud
1 parent 2fde668 commit 52d797e

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

LocalPackages/PIADesignSystem/Tests/PIADesignSystemTests/SnapshotTests/ColorSnapshotTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ struct ColorSnapshotTests {
3131

3232
@MainActor
3333
@Test func colorPreviewLight() {
34+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
35+
3436
let view = ColorPreview()
3537
.environment(\.colorScheme, .light)
3638
.frame(width: 1024)
@@ -44,6 +46,8 @@ struct ColorSnapshotTests {
4446

4547
@MainActor
4648
@Test func colorPreviewDark() {
49+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
50+
4751
let view = ColorPreview()
4852
.environment(\.colorScheme, .dark)
4953
.frame(width: 1024)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// SnapshotTestHelpers.swift
3+
// PIADesignSystem
4+
//
5+
// Created by snapshot testing on 12.12.25.
6+
// Copyright © 2025 Private Internet Access, Inc.
7+
//
8+
// This file is part of the Private Internet Access iOS Client.
9+
//
10+
// The Private Internet Access iOS Client is free software: you can redistribute it and/or
11+
// modify it under the terms of the GNU General Public License as published by the Free
12+
// Software Foundation, either version 3 of the License, or (at your option) any later version.
13+
//
14+
// The Private Internet Access iOS Client is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17+
// details.
18+
//
19+
// You should have received a copy of the GNU General Public License along with the Private
20+
// Internet Access iOS Client. If not, see <https://www.gnu.org/licenses/>.
21+
//
22+
23+
import Foundation
24+
25+
/// Shared utilities for snapshot testing
26+
enum SnapshotTestHelpers {
27+
/// Checks if tests are running on Xcode Cloud
28+
/// - Returns: `true` if running on Xcode Cloud, `false` otherwise
29+
static var isRunningOnXcodeCloud: Bool {
30+
// Xcode Cloud sets specific environment variables
31+
ProcessInfo.processInfo.environment["CI_XCODE_PROJECT"] != nil ||
32+
ProcessInfo.processInfo.environment["CI_XCODEBUILD_ACTION"] != nil
33+
}
34+
}

LocalPackages/PIADesignSystem/Tests/PIADesignSystemTests/SnapshotTests/TypographySnapshotTests.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ struct TypographySnapshotTests {
3131

3232
@MainActor
3333
@Test func typographyPreview() {
34+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
35+
3436
let view = TypographyPreview()
3537
.environment(\.colorScheme, .light)
3638
.frame(width: 1024)
@@ -47,6 +49,8 @@ struct TypographySnapshotTests {
4749
@MainActor
4850
@Test("Typography with Extra Small accessibility size")
4951
func typographyAccessibilityExtraSmall() {
52+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
53+
5054
let view = TypographyPreview()
5155
.environment(\.colorScheme, .light)
5256
.environment(\.sizeCategory, .extraSmall)
@@ -62,6 +66,8 @@ struct TypographySnapshotTests {
6266
@MainActor
6367
@Test("Typography with Small accessibility size")
6468
func typographyAccessibilitySmall() {
69+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
70+
6571
let view = TypographyPreview()
6672
.environment(\.colorScheme, .light)
6773
.environment(\.sizeCategory, .small)
@@ -77,6 +83,8 @@ struct TypographySnapshotTests {
7783
@MainActor
7884
@Test("Typography with Medium (default) accessibility size")
7985
func typographyAccessibilityMedium() {
86+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
87+
8088
let view = TypographyPreview()
8189
.environment(\.colorScheme, .light)
8290
.environment(\.sizeCategory, .medium)
@@ -92,6 +100,8 @@ struct TypographySnapshotTests {
92100
@MainActor
93101
@Test("Typography with Large accessibility size")
94102
func typographyAccessibilityLarge() {
103+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
104+
95105
let view = TypographyPreview()
96106
.environment(\.colorScheme, .light)
97107
.environment(\.sizeCategory, .large)
@@ -107,6 +117,8 @@ struct TypographySnapshotTests {
107117
@MainActor
108118
@Test("Typography with Extra Large accessibility size")
109119
func typographyAccessibilityExtraLarge() {
120+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
121+
110122
let view = TypographyPreview()
111123
.environment(\.colorScheme, .light)
112124
.environment(\.sizeCategory, .extraLarge)
@@ -122,6 +134,8 @@ struct TypographySnapshotTests {
122134
@MainActor
123135
@Test("Typography with Extra Extra Large accessibility size")
124136
func typographyAccessibilityExtraExtraLarge() {
137+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
138+
125139
let view = TypographyPreview()
126140
.environment(\.colorScheme, .light)
127141
.environment(\.sizeCategory, .extraExtraLarge)
@@ -137,6 +151,8 @@ struct TypographySnapshotTests {
137151
@MainActor
138152
@Test("Typography with Extra Extra Extra Large accessibility size")
139153
func typographyAccessibilityExtraExtraExtraLarge() {
154+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
155+
140156
let view = TypographyPreview()
141157
.environment(\.colorScheme, .light)
142158
.environment(\.sizeCategory, .extraExtraExtraLarge)
@@ -152,6 +168,8 @@ struct TypographySnapshotTests {
152168
@MainActor
153169
@Test("Typography with Accessibility Medium accessibility size")
154170
func typographyAccessibilityMediumSize() {
171+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
172+
155173
let view = TypographyPreview()
156174
.environment(\.colorScheme, .light)
157175
.environment(\.sizeCategory, .accessibilityMedium)
@@ -167,6 +185,8 @@ struct TypographySnapshotTests {
167185
@MainActor
168186
@Test("Typography with Accessibility Large accessibility size")
169187
func typographyAccessibilityLargeSize() {
188+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
189+
170190
let view = TypographyPreview()
171191
.environment(\.colorScheme, .light)
172192
.environment(\.sizeCategory, .accessibilityLarge)
@@ -182,6 +202,8 @@ struct TypographySnapshotTests {
182202
@MainActor
183203
@Test("Typography with Accessibility Extra Large accessibility size")
184204
func typographyAccessibilityExtraLargeSize() {
205+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
206+
185207
let view = TypographyPreview()
186208
.environment(\.colorScheme, .light)
187209
.environment(\.sizeCategory, .accessibilityExtraLarge)
@@ -197,6 +219,8 @@ struct TypographySnapshotTests {
197219
@MainActor
198220
@Test("Typography with Accessibility Extra Extra Large accessibility size")
199221
func typographyAccessibilityExtraExtraLargeSize() {
222+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
223+
200224
let view = TypographyPreview()
201225
.environment(\.colorScheme, .light)
202226
.environment(\.sizeCategory, .accessibilityExtraExtraLarge)
@@ -212,6 +236,8 @@ struct TypographySnapshotTests {
212236
@MainActor
213237
@Test("Typography with Accessibility Extra Extra Extra Large accessibility size")
214238
func typographyAccessibilityExtraExtraExtraLargeSize() {
239+
guard !SnapshotTestHelpers.isRunningOnXcodeCloud else { return }
240+
215241
let view = TypographyPreview()
216242
.environment(\.colorScheme, .light)
217243
.environment(\.sizeCategory, .accessibilityExtraExtraExtraLarge)

0 commit comments

Comments
 (0)