Skip to content

Instantly share code, notes, and snippets.

@sowenjub
Created June 16, 2025 09:24
Show Gist options
  • Save sowenjub/03e426788e97af47c89f0e0670ace9e0 to your computer and use it in GitHub Desktop.
Save sowenjub/03e426788e97af47c89f0e0670ace9e0 to your computer and use it in GitHub Desktop.
AspirinShot QuickStart
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")
}
@sowenjub
Copy link
Author

Testflight: testflight.apple.com/join/yG86VgAX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment