Created
June 16, 2025 09:24
-
-
Save sowenjub/03e426788e97af47c89f0e0670ace9e0 to your computer and use it in GitHub Desktop.
AspirinShot QuickStart
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 | |
extension XCTestCase { | |
@discardableResult | |
func launchApp(extraArguments: [String] = [], environment: [String: String] = [:]) -> XCUIApplication { | |
let app = XCUIApplication() | |
app.launchArguments = [ | |
"-isAspirinShot" | |
] | |
app.launchArguments += extraArguments | |
app.launchEnvironment = environment | |
app.launch() | |
return app | |
} | |
func takeScreenshot(_ name: String) { | |
let screenshot = XCUIScreen.main.screenshot() | |
let attachment = XCTAttachment( | |
screenshot: screenshot, | |
quality: .original | |
) | |
attachment.name = name | |
attachment.lifetime = .keepAlways | |
add(attachment) | |
} | |
} | |
func testScreenshot() { | |
let app = launchApp( | |
extraArguments: extraArguments, | |
environment: ["SelectedTab": "home", "SeedSetup": "free-content"] | |
) | |
if app.buttons["ToggleSidebar"].exists { | |
app.buttons["ToggleSidebar"].tap() | |
} | |
XCTAssertTrue(app.buttons["AllItems"].waitForExistence(timeout: 2)) | |
app.buttons["AllItems"].tap() | |
takeScreenshot("02_FreeContent") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testflight: testflight.apple.com/join/yG86VgAX