Answers: <p>Please check in Fastlane docs Launch Arguments under Advanced Snapshot section <a href="https://docs.fastlane.tools/getting-started/ios/screenshots/" rel="nofollow noreferrer">https://docs.fastlane.tools/getting-started/ios/screenshots/</a> I think it can help</p>
  
  <blockquote>
    <p>Launch Arguments</p>
    
    <p>You can provide additional arguments to your app on launch. These
    strings will be available in your app (eg. not in the testing target)
    through <code>NSProcessInfo.processInfo().arguments</code>. Alternatively, use
    user-default syntax (<code>-key value</code>) and they will be available as
    key-value pairs in <code>NSUserDefaults.standardUserDefaults()</code>.</p>
  
  <pre><code>launch_arguments([
    "-firstName Felix -lastName Krause"
  ])
  
  name.text = NSUserDefaults.standardUserDefaults().stringForKey("firstName")
  // name.text = "Felix"
  </code></pre>
    
    <p><em>snapshot</em> includes <code>-FASTLANE_SNAPSHOT YES</code>, which will set a temporary user default for the key <code>FASTLANE_SNAPSHOT</code>, you may use
    this to detect when the app is run by <em>snapshot</em>.</p>
  
  <pre><code>if NSUserDefaults.standardUserDefaults().boolForKey("FASTLANE_SNAPSHOT")
  </code></pre>
    
    <p>{
            // runtime check that we are in snapshot mode
        }</p>
    
    <p>Specify multiple argument strings and snapshot will generate
    screenshots for each combination of arguments, devices, and languages.
    This is useful for comparing the same screenshots with different
    feature flags, dynamic text sizes, and different data sets.</p>
  
  <pre><code># Snapfile for A/B Test Comparison
  launch_arguments([
    "-secretFeatureEnabled YES",
    "-secretFeatureEnabled NO"
  ])
  </code></pre>
  </blockquote>
  
Answers: CC BY-SA 3.0
Answers: 2018-02-13T17:51:45.263Z
Answers: Thanks Sinisa. I was definitely wrong about how Fastlane takes screenshots. It seems that for Android (which I am working on now) Fastlane "piggybacks" off of Android's UI testing to capture screenshots. iOS behaves very similarly as well.
Answers: Preston Martin
Answers: CC BY-SA 3.0
Answers: 2018-02-09T15:05:15.490Z
Answers: 2018-02-09T16:59:41.607Z
Answers: 2018-02-09T16:59:41.607Z
Answers: Sinisa Bobic
Body: <p>I'm currently using Fastlane to capture screenshots of my application to be used in both the iOS and Android app store. My problem is that Fastlane is only able to capture the loading screen and the username/password authentication screen. Is there a way to pass credentials (possibly test creds with limited access) into Fastlane to allow it to capture other screenshots of my application? If not, what other methods could I use?</p>
  
Tags: <ios>
Title: Fastlane Screenshots with Authentication
UserDisplayName: Preston Martin
ThreadText: # Fastlane Screenshots with Authentication
  
  (Asked by: username_0 on 2018-02-08)
  
  I'm currently using Fastlane to capture screenshots of my application to be used in both the iOS and Android app store. My problem is that Fastlane is only able to capture the loading screen and the username/password authentication screen. Is there a way to pass credentials (possibly test creds with limited access) into Fastlane to allow it to capture other screenshots of my application? If not, what other methods could I use?
  
  **Tags:** ios
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-09. Score: 1 | Accepted answer
  
  Please check in Fastlane docs Launch Arguments under Advanced Snapshot section <https://docs.fastlane.tools/getting-started/ios/screenshots/> I think it can help
  
  > Launch Arguments
  >
  > You can provide additional arguments to your app on launch. These
  > strings will be available in your app (eg. not in the testing target)
  > through `NSProcessInfo.processInfo().arguments`. Alternatively, use
  > user-default syntax (`-key value`) and they will be available as
  > key-value pairs in `NSUserDefaults.standardUserDefaults()`.
  >
  > ```
  > launch_arguments([
  >   "-firstName Felix -lastName Krause"
  > ])
  >
  > name.text = NSUserDefaults.standardUserDefaults().stringForKey("firstName")
  > // name.text = "Felix"
  >
  > ```
  >
  > *snapshot* includes `-FASTLANE_SNAPSHOT YES`, which will set a temporary user default for the key `FASTLANE_SNAPSHOT`, you may use
  > this to detect when the app is run by *snapshot*.
  >
  > ```
  > if NSUserDefaults.standardUserDefaults().boolForKey("FASTLANE_SNAPSHOT")
  >
  > ```
  >
  > {
  > // runtime check that we are in snapshot mode
  > }
  >
  > Specify multiple argument strings and snapshot will generate
  > screenshots for each combination of arguments, devices, and languages.
  > This is useful for comparing the same screenshots with different
  > feature flags, dynamic text sizes, and different data sets.
  >
  > ```
  > # Snapfile for A/B Test Comparison
  > launch_arguments([
  >   "-secretFeatureEnabled YES",
  >   "-secretFeatureEnabled NO"
  > ])
  >
  > ```
  
  > **Comments:**
  > **username_0**: Thanks username_1. I was definitely wrong about how Fastlane takes screenshots. It seems that for Android (which I am working on now) Fastlane "piggybacks" off of Android's UI testing to capture screenshots. iOS behaves very similarly as well.  
  
  ---
  
  