Created
October 24, 2025 00:47
-
-
Save bannzai/b2b8b5e8a284115af1e568b492899302 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import XCTest | |
| import SwiftUI | |
| final class RetryPageSnapshotUITest: XCTestCase { | |
| override class var runsForEachTargetApplicationUIConfiguration: Bool { | |
| false | |
| } | |
| override func setUpWithError() throws { | |
| continueAfterFailure = false | |
| } | |
| let previewType = "RetryPage_Previews" | |
| let previewCount = 1 | |
| func testSnapshot() throws { | |
| XCUIDevice.shared.appearance = .dark | |
| let fileName = URL(fileURLWithPath: #file).deletingPathExtension().lastPathComponent | |
| let functionName = #function.replacingOccurrences(of: "()", with: "") | |
| filteredLanguages().forEach { (language, languageWithRegion) in | |
| debugPrint("Start: ", #file, #function, language) | |
| let app = XCUIApplication.instantiate() | |
| app.launchArguments += ["-AppleLanguages", "(\(language))"] | |
| app.launch() | |
| for index in (0..<previewCount) { | |
| app.buttons["\(previewType)_\(index)"].firstMatch.tap() | |
| sleep(1) | |
| let attachment = XCTAttachment(screenshot: app.screenshot()) | |
| attachment.name = "\(fileName)---\(functionName)---\(language)---\(index)" | |
| attachment.lifetime = .keepAlways | |
| add(attachment) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment