Reputation: 1812
I wonder is it possible to get screenshots with snapshot from real ios devices(iPhones). I've found some outdated stuff but maybe something changed since 2016.... I have an app with 15 languages, that mostly working with cameras (so simulator doesnt fit) and i need to make a lot screenshots of screens for our documentation.
if i change Snapfile
and add there my real device, i've got an error
fastlane snapshot
So its even didn't offer me an option to use real device, not simulator
Upvotes: 2
Views: 610
Reputation: 36620
An issue you will encounter is that you will have inconsistent screenshots, which may or may not be an issue. Additionally, there can be other problems such as poor contrast, blurry photos, etc.
With that said, a better approach is to utilize the launch arguments for fastlane snapshots and inject an image of your choice to mock the screens. This way, you can fully control the environment and ensure consistent results.
To begin with, something like this in your setupUp function can get you started:
class Screenshot: XCTestCase {
var app: XCUIApplication!
override func setUp() {
super.setUp()
app = XCUIApplication()
app.launchArguments = ["isUITest"]
setupSnapshot(app)
app.launch()
}
}
To check for this within your app:
let isUITesting = ProcessInfo.processInfo.arguments.contains("isUITest")
Now, whenever your app is launched via the UI Test for your snapshots, you can know about it. Given this information, just manage a UIImageView
that inserts your test image, allowing you to simulate the camera effect. This will give you a consistent look across all your screenshots now.
Upvotes: 2