Search code examples
iosios-simulatorfastlanefastlane-snapshot

Fastlane, screenshot custom action before simulator is launched?


I'm trying to launch quick time player to record video and audio from the iOS simulator.

I figure I can create a shell script with arrays for each of the the languages and each device. And loop around and run a fastlane lane, passing in there parameters.

I've seen that you can use before_each in your fastfile, but this will launch well before the simulator launches, however I need to launch quick time player just as the simulator launches.


Solution

  • fastlane has no integrated support for QuickTime, so you'd need to do this yourself using shell scripts. Because the launch times for both QuickTime and Simulator are likely to vary, I think it will be difficult and error-prone to time this correctly.

    If you want to continue exploring this approach, I would avoid using before_each and instead rely on a lane's ability to call another lane, e.g.:

    lane :record_qt_video do
        my_languages = [] # some array of options
        # launch quicktime
        # launch simulator
        my_languages.each do |lang|
            launch_localized_app(language: lang)
            # save video and reset quicktime state
        end
    end
    
    private_lane :launch_localized_app do |options|
        lang = options[:language]
        # run whatever you want in the simulator
    end
    

    I see you're working on a fastlane pull request that uses the integrated simulator recording option instead of QuickTime. I think this is likely to be a better approach because it will remove the timing issues from the equation.