Fastlane for iOS · Challenge: Adding Snapshot | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1259223-fastlane-for-ios/lessons/31

Hi, I have problem with capture screenshot for app.

I’m with login screen so i add some manual code in test file i.e.

let app = XCUIApplication()
app.launchArguments.append("--UITestWithLogin")
setupSnapshot(app)
app.launch()

With this code i add argument so i can add manually user name and password to continue.
I use this code in login controller to continue.

if ProcessInfo.processInfo.arguments.contains("--UITestWithLogin") {
            userNameTextField.text = "xxxxxxx"
            passwordTextField.text = "xxxxxxx"
}

I always stuck on login screen and it didn’t go through onto next screen. My test always got failed because simulation unable to find next button.

Whenever i record in snapshot file output always change every time and maybe because of this it can’t process further.

How can i fix this error or you can say stop changing output in test function?

@brian_bee Can you please help with this when you get a chance? Thank you - much appreciated! :]

Sorry I missed your question earlier…

Since this isn’t from our course itself, I of course can’t know everything that might be involved here. But I’d suggest starting with a review of the Launch Arguments section of the Advanced snapshot section of this fastlane document. You may want to provide both an argument key and value (likely a Bool), and then test if the Boolean evaluates to true.

Let me know if that helps, and if not, we can dig a bit deeper on this. Good luck!

Sorry for late reply. I’m stuck on other work.
Actually problem is within my login screen. There is Pod my junior used which messes up with login screen so every time it press key, login button key changed due to scrollview pod. It is fixed now and the above mentioned code is working if you want to bypass login screen.

I thought maybe someone has problem with that kind of question, they can used this piece of code to achieve it. :slightly_smiling_face:

Thanks for letting me know… and glad to hear you got it fixed :+1:

Hello. When I run fastlane snapshot, or fastlane release to use lane, on my MacMini with M1 processor, next error appears: “Reason: Cannot test target “FastlaneSnapshots” on “iPhone 8”: FastlaneSnapshots does not support any of iPhone 8’s architectures: x86_64”. Can you help me? It repeats for all simulators and function does not take screenshots. I followed all steps and tried from beginning few times, no results.