xcode-select --install
brew install fastlane
xcrun instruments -s devices
xcrun simctl boot <SIMULATOR-ID>
xcrun simctl install <SIMULATOR-ID> <path\to\App>
xcrun simctl shutdown <SIMULATOR-ID>
fastlane snapshot init
modify Snapfile to select which devices you want to use, in my case only iPhone 11, my laptop is a pretty old MBP 2012, can't support multiple simulators :(
devices([
"iPhone 11",
# "iPhone 8 Plus",
# "iPhone SE",
# "iPhone X",
# "iPad Pro (12.9-inch)",
# "iPad Pro (9.7-inch)",
# "Apple TV 1080p"
])
target SnapshotHelper.swift to FastlaneSnapshotXamarinTestUITests (my folder name for XCode UI test)
no terminal command needed, just select the SnapshotHelper.swift then under "Add to targets" section, select FastlaneSnapshotXamarinTestUITests
let deviceWidth = app.windows.firstMatch.frame.width
let deviceWidth = XCUIApplication(bundleIdentifier: "com.<PACKAGENAME>.<APPNAME>").windows.firstMatch.frame.width
let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element
let networkLoadingIndicator = XCUIApplication(bundleIdentifier: "com.<PACKAGENAME>.<APPNAME>").otherElements.deviceStatusBars.networkLoadingIndicators.element
import XCTest
class FastlaneSnapshotXamarinTestUITests: XCTestCase {
func testExample() {
let app = XCUIApplication(bundleIdentifier: "com.bohdanhrybach.FastlaneSnapshotXamarin")
setupSnapshot(app)
app.activate()
let chipCountTextField = app.textFields["reverseText"]
chipCountTextField.tap()
chipCountTextField.typeText("Fastlane snapshot with Xamarin")
snapshot("01UserEntry")
app.buttons["reverseButton"].tap()
snapshot("02Alert")
}
}
fastlane snapshot