Converge on same naming convention for snapshots in the preview tests as in the UI tests.

This commit is contained in:
Stefan Ceriu
2025-03-04 18:33:39 +02:00
committed by Stefan Ceriu
parent ffafca6d64
commit fb8a1f33d8
2286 changed files with 2932 additions and 3029 deletions
@@ -4,8 +4,7 @@
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
runPostActionsOnFailure = "NO">
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
@@ -30,12 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES">
<TestPlans>
<TestPlanReference
default = "YES"
reference = "container:UnitTests/SupportingFiles/UnitTests.xctestplan">
</TestPlanReference>
</TestPlans>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -45,10 +38,6 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
<CommandLineArguments>
</CommandLineArguments>
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
@@ -58,6 +47,12 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</CodeCoverageTargets>
<TestPlans>
<TestPlanReference
reference = "container:UnitTests/SupportingFiles/UnitTests.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -79,8 +74,6 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "HTTPS_PROXY"
@@ -115,8 +108,6 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
</CommandLineArguments>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
@@ -4,8 +4,7 @@
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
runPostActionsOnFailure = "NO">
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
@@ -30,12 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES">
<TestPlans>
<TestPlanReference
default = "YES"
reference = "container:PreviewTests/SupportingFiles/PreviewTests.xctestplan">
</TestPlanReference>
</TestPlans>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -45,10 +38,6 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
<CommandLineArguments>
</CommandLineArguments>
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
@@ -58,6 +47,12 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</CodeCoverageTargets>
<TestPlans>
<TestPlanReference
reference = "container:PreviewTests/SupportingFiles/PreviewTests.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -78,8 +73,6 @@
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -87,8 +80,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<CommandLineArguments>
</CommandLineArguments>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -137,7 +137,7 @@ struct BugReportScreen: View {
// MARK: - Previews
struct BugReport_Previews: PreviewProvider, TestablePreview {
struct BugReportScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
NavigationStack {
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
@@ -145,8 +145,8 @@ struct BugReport_Previews: PreviewProvider, TestablePreview {
clientProxy: clientProxy,
screenshot: nil,
isModallyPresented: false).context)
.previewDisplayName("Without Screenshot")
}
.previewDisplayName("Without Screenshot")
NavigationStack {
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
@@ -154,7 +154,7 @@ struct BugReport_Previews: PreviewProvider, TestablePreview {
clientProxy: clientProxy,
screenshot: Asset.Images.appLogo.image,
isModallyPresented: false).context)
.previewDisplayName("With Screenshot")
}
.previewDisplayName("With Screenshot")
}
}
File diff suppressed because it is too large Load Diff
+14 -3
View File
@@ -51,7 +51,7 @@ class PreviewTests: XCTestCase {
// MARK: - Snapshots
func assertSnapshots(matching preview: _Preview, testName: String = #function) async throws {
func assertSnapshots(matching preview: _Preview, testName: String = #function, step: Int) async throws {
let preferences = SnapshotPreferences()
let preferenceReadingView = preview.content
@@ -68,6 +68,9 @@ class PreviewTests: XCTestCase {
try await deferred.fulfill()
}
var sanitizedSuiteName = String(testName.suffix(testName.count - "test".count).dropLast(2))
sanitizedSuiteName = sanitizedSuiteName.prefix(1).lowercased() + sanitizedSuiteName.dropFirst()
for deviceName in snapshotDevices {
guard var device = PreviewDevice(rawValue: deviceName).snapshotDevice() else {
fatalError("Unknown device name: \(deviceName)")
@@ -76,11 +79,19 @@ class PreviewTests: XCTestCase {
device.safeArea = .one
// Ignore specific device display scale
let traits = UITraitCollection(displayScale: 2.0)
var testName = ""
if let displayName = preview.displayName {
testName = "\(displayName)-\(deviceName)-\(localeCode)"
} else {
testName = "\(deviceName)-\(localeCode)-\(step)"
}
if let failure = assertSnapshots(matching: preview.content,
name: preview.displayName,
name: testName,
isScreen: preview.layout == .device,
device: device,
testName: testName + deviceName + "-" + localeCode,
testName: sanitizedSuiteName,
traits: traits,
preferences: preferences) {
XCTFail(failure)
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ad3f04fa5b8ca966c6104eb720e41a307a122ed6388a687e2b30ff80f2507d9
size 516292
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4042061b97bb697c4e04993d9318c2e73e762117751c2e9df2dc11500c19d396
size 542539
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f9dd600626b00f981dd9b17204b458efafc4acdcb7da60aa10185ffc6b44215d
size 320313
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d895cd7bf8a89eb49970e244d8c15c9a66b209744bb3253fc7b1305498e33cd
size 331263
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6926210d9a615c7c9d73a4dc5af08fed7c8a88da2de49bee8b9930495be8cc27
size 98462
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bb82fb5fa35be8896780ec5744a7e5cf8298806b8f0a1e83d7328282c6165309
size 104971
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:330ee2e7a3f8ee055400f00d4db60c7410338539ed1df9a36605e05bcb781561
size 51483
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f00ea9dff06560ad9b8c40f249a5bc88112e3e506c8bb584c4081340953d830b
size 66262
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:996a32b10db3a4a6ee9f36f192f63145ccc3a54ea9d2c8f0bfa98f5a9cb36b03
size 116463
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:45d96feb16b63ecc48ad877b664a13c0c7b7116ecafb9092853156fc992f28eb
size 125122
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aaae47440df3d834c1e8068fb6001666df4aa73d59caa5771b377cd75b0eeca2
size 70693
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:26bcfecb638c4baf22dfb48a8e422e88f9c5fde8d10ebb471e8e7a9db9d05f1a
size 77683
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce949cfade01de7bf73533a4834318c4addda10147a3efb4d4a06c6043661813
size 64668
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:69f74917d392a9d7636118feac3223ac0ec6221596f7d3b599f55d9e2407cced
size 81140
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:daae123d06561d684d445bcaf9f5f104eec1af653bc24a7b2d4195eaef126e45
size 101717
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:46bd40d4dc8f6f7b4c64227ec7ae65aa40b5ff1ae11f975b5ded8c5946db749f
size 120398
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:191d11a81234b2a499944760d3e0ef38a5580ec25b2861224f63e5e9ef1cfe52
size 58319
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcb718048645668f99ee153f25cf55ac9b9b21d9e34b71cc68e497a273b5b6a5
size 78998
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:11fb2a522a336ed3f833f6eadc358d2145c0aa6992904f2f03e3ea1836876b79
size 102039
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34469ae2881094edbd4d1c1f33175482fa4947eb83211f06a69d1974213fa1d6
size 120643
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc297fa29d248010fe61dcbb9bb9e3ec9691565b384bdc0ba603ccba25787163
size 58617
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1197ab62fa24d79753faf9563ce42bbdda2ec31c913048652151dfc95f1daac4
size 79281
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bac2ec44792700a5fe96fd1b33f0a3e7625ad934b4aa73e0f202a56d455d9b43
size 92227
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:56b3fc6ea7c9fd3c99bce318419ecf2b015e90fcb1ee6da72fd5449c60f4ef73
size 93704
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5c24a741c1fe627c91f349f1b47ecbce2718b64c137682207c1c72ed2f49cc7
size 49120
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:344d64491b1a3ff8deef0832abf8a6921445dacae2b8a82730ec71fc8fab07a4
size 51680
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3daadc8da3e490a89f2c0ff8562ff1a226decdc80d837135297472e89c8367d2
size 90767
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f0f9d93f2ff8e369118b70000abbad11f85976ee7746d70594fad93911207cb
size 93336
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b539396e05e63f0b3462538657733be4fb4d717a2b246827bb50b836bf4795d
size 47719
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:935aa66dd96cebdb25e87c6553f45d79864b837c2e9bab1101ef50595de22d52
size 51464
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb04e0fe5ea0927e4d5c6cf4106fc2701c82339b58e2e06ebe5cd98543075bd8
size 511373
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:50ee33846226e8d5ad192d544c4566cb6e7e92ff1f2b1181eb77d907f18e92c1
size 534890
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:707929d4797eb225028ebcbd4e1c51eda00c72e3f738eb19d7f55e940b24a821
size 155107
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cd245e575e2e9f820bf1fc520b88c5c27ace5fd643fa7332cc04aa1c0ef1fa5b
size 155448
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ce40b37d2dead120a4da878e360f9abec2fdb0fa4eba3dbea0b6ceae36fa27f
size 99741
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:862bc236e1da06d72f06f3041fb852e9804e19a84fca162af6f496b2b33c6ec9
size 101330
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:493c41850095be08f435a4a1bb4e18ae68cfadf994066264e0f44ad70af13b55
size 106299
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c2c396e83a94d4472e83af14fcd4eaca68c3176506a0f6a215c20ae31f23d2d1
size 106514
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:67f92db441777a68375348385b108cdb60d7b3e8ffc677e1630ac7dcdf258369
size 64745
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93b2adaf1e0eb5c05bce99d59497f17b48b575f46667e649171702d760d6eaf9
size 64989
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1aae2519f669484990559209c3cfeaa9e0980cb69588a145c1d600b2cffcc368
size 174462
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8986ac7b673981a7daeda3e9b81ae1e783697aa7f5c1481b04ed0bfd26ee227c
size 175785
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:da7f99999b75e929c0f097f936763bc16c6287604506b13ac079952f1f6e7f85
size 115043
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:71c9301cf503e1cd39f889a85f635ddfdab8b49bf34f19af5ca4805e42b9a7b3
size 119564
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e7c9aa052f8f318d33134c119d9fc58fba2fdd3b4ecc56008ff5dc06afdfbdb
size 75502
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e7c9aa052f8f318d33134c119d9fc58fba2fdd3b4ecc56008ff5dc06afdfbdb
size 75502
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e466f58bcb1f50a430e7f1baeeb62e297c9c25d9c9133caf9a61d4c43aa91ccd
size 34524
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e466f58bcb1f50a430e7f1baeeb62e297c9c25d9c9133caf9a61d4c43aa91ccd
size 34524
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:521c3f78b534dfe2f97b09d756e1ecbd482658243c237002a46e2a7bd0a7e84c
size 86830
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:521c3f78b534dfe2f97b09d756e1ecbd482658243c237002a46e2a7bd0a7e84c
size 86830
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c28eda1e4566f734bdbed8d6582237b2d3c2c37eab26d5e056080622e0c2697d
size 45905
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c28eda1e4566f734bdbed8d6582237b2d3c2c37eab26d5e056080622e0c2697d
size 45905

Some files were not shown because too many files have changed in this diff Show More