• Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
Sunday, March 15, 2026
No Result
View All Result
Subscribe Now
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    Headless victim in 1976 New York cold case identified through DNA: police

    Headless victim in 1976 New York cold case identified through DNA: police

    What’s Good? – The New York Times

    What’s Good? – The New York Times

    Israel’s Deadly Blockade Traps 7 U.S. Doctors in Gaza

    Israel’s Deadly Blockade Traps 7 U.S. Doctors in Gaza

    Carney announces billions for defense and infrastructure in Canada’s North

    Carney announces billions for defense and infrastructure in Canada’s North

    Right-wing media’s Mamdani outrage fuels GOP anti-Muslim rhetoric

    Right-wing media’s Mamdani outrage fuels GOP anti-Muslim rhetoric

    12-year-old girl dies days after collapsing following fight near school bus stop

    12-year-old girl dies days after collapsing following fight near school bus stop

    Speaker Mike Johnson Sketches ‘Course Correction’ in DHS Deportation Policy

    Speaker Mike Johnson Sketches ‘Course Correction’ in DHS Deportation Policy

    Where Was ‘War Machine’ Filmed? Discover the ‘War Machine’ 2026 Filming Locations for Alan Ritchson’s Netflix Movie

    Where Was ‘War Machine’ Filmed? Discover the ‘War Machine’ 2026 Filming Locations for Alan Ritchson’s Netflix Movie

    L.A. City Council candidate stays in race after report that he stabbed a boy at age 12

    L.A. City Council candidate stays in race after report that he stabbed a boy at age 12

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
The Insight Post
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    Headless victim in 1976 New York cold case identified through DNA: police

    Headless victim in 1976 New York cold case identified through DNA: police

    What’s Good? – The New York Times

    What’s Good? – The New York Times

    Israel’s Deadly Blockade Traps 7 U.S. Doctors in Gaza

    Israel’s Deadly Blockade Traps 7 U.S. Doctors in Gaza

    Carney announces billions for defense and infrastructure in Canada’s North

    Carney announces billions for defense and infrastructure in Canada’s North

    Right-wing media’s Mamdani outrage fuels GOP anti-Muslim rhetoric

    Right-wing media’s Mamdani outrage fuels GOP anti-Muslim rhetoric

    12-year-old girl dies days after collapsing following fight near school bus stop

    12-year-old girl dies days after collapsing following fight near school bus stop

    Speaker Mike Johnson Sketches ‘Course Correction’ in DHS Deportation Policy

    Speaker Mike Johnson Sketches ‘Course Correction’ in DHS Deportation Policy

    Where Was ‘War Machine’ Filmed? Discover the ‘War Machine’ 2026 Filming Locations for Alan Ritchson’s Netflix Movie

    Where Was ‘War Machine’ Filmed? Discover the ‘War Machine’ 2026 Filming Locations for Alan Ritchson’s Netflix Movie

    L.A. City Council candidate stays in race after report that he stabbed a boy at age 12

    L.A. City Council candidate stays in race after report that he stabbed a boy at age 12

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
No Result
View All Result
No Result
View All Result
Home Mobile

Automating screenshots for iOS apps using fastlane and Codemagic

by Theinsightpost
August 4, 2022
in Mobile
0 0
0
Automating screenshots for iOS apps using fastlane and Codemagic


Written by Rudrank Riyam.

As an Apple platforms developer, you have surely come across a scenario in which you have had to create new screenshots for App Store Connect while releasing a new version. The designer may have given you the screenshots beforehand, or maybe you have manually opened the corresponding simulators and taken the screenshots yourself.

You must upload a minimum of three screenshots for each of the four devices on App Store Connect. That is a minimum of 12 screenshots per release. These numbers compound when you add more screenshots per device and grow exponentially when you localize the screenshots. And if you are supporting macOS, tvOS, and watchOS in addition to iOS, then the number of screenshots becomes truly gigantic.

Furthermore, if you make any errors while taking the screenshots, you have to repeat the process again.

Fortunately, you can use fastlane snapshot to automate the process of creating the screenshots for the App Store using UI testing. You can also combine it with Codemagic to get a flawless pipeline to upload the screenshots to the App Store while you go and grab a coffee. This helps you release new versions faster and make sure screenshots are up to date without any human intervention or errors.

This article covers the process of:

  • Setting up a UI test bundle for screenshots
  • Adding UI tests
  • Integrating fastlane
  • Adding different screenshot configurations
  • Creating a codemagic.yaml file and using it to integrate fastlane

So, let’s get started!

Setting up a UI test bundle for screenshots

You can automate the screenshots by writing UI tests for your project and fastlane’s screenshot helper method. This helps you navigate to a specific screen in your app and take a screenshot of it.

We will add a separate UI testing bundle for writing tests for screenshots. This separates the methods from your normal UI tests. Select File, then click New and select Target. Search for UI Testing Bundle and name it accordingly. For example, you can enter “ScreenshotTests” after the name of your target.

Next, we will add a new Xcode scheme for the test target we created. Go to the current scheme and select New Scheme:

Select the newly created UI target for screenshots. In this case, it is CodemagicianScreenshotTests.

Edit the scheme, select the Build option from the sidebar, and enable the checkbox under your target’s “Run” column. Also, enable the scheme’s Shared box.

Adding UI tests

The sample app contains an onboarding screen that you can swipe through:

struct ContentView: View {
  var body: some View {
    TabView {
      ForEach(OnboardingModel.demo, id: .title) { model in
        OnboardingView(model: model)
      }
    }
    .tabViewStyle(.page(indexDisplayMode: .always))
  }
}

struct OnboardingView: View {
  var model: OnboardingModel

  var body: some View {
    VStack {
      Text(model.title)
        .font(.system(.title, design: .rounded))
        .bold()
        .multilineTextAlignment(.center)

      Spacer()

      Text(model.description)
        .font(.system(.body, design: .rounded))
        .lineSpacing(2)

      Spacer()

      Image(model.image)
        .resizable()
        .scaledToFit()

      Spacer()
    }
    .padding()
  }
}

struct OnboardingModel {
  var title: String
  var description: String
  var image: String
}

extension OnboardingModel {
  static var demo = [
  ///content
  ]
}

In the CodemagicianScreenshotTests.swift file, you can create a single method for all your screenshots or multiple different methods, depending on whether or not you need to reset the app.

In the next section, we will integrate fastlane, add its snapshot helper to the project, and add methods to take the screenshot.

Integrating fastlane

There are many ways to install fastlane on your machine. For this post, we will use Bundler. You can find more information about getting started with fastlane here.

In this post, we’re installing fastlane for demo purposes. However, fastlane is already preinstalled on Codemagic machines.

To install fastlane, run the following command in the root directory in the terminal:

fastlane will generate two files in your project:

  • SnapshotHelper.swift
  • Snapfile

SnapshotHelper.swift helps us take screenshots with a single method for each screenshot. Move SnapshotHelper.swift to the ScreenshotTest folder.

In turn, fastlane gives us two methods to get started to take screenshots. First, we need to get set up by using the setupSnapshot(_:waitForAnimations:) method. So, in the ScreenshotTest class, add the following in the setupWithError() method:

class CodemagicianScreenshotTests: XCTestCase {
  var app: XCUIApplication!

  override func setUpWithError() throws {
    continueAfterFailure = false

    app = XCUIApplication()
    setupSnapshot(app)
    app.launch()
  }
}  

Additionally, fastlane gives us the snapshot(_:waitForLoadingIndicator:) method, which takes a screenshot with a particular name that you provide and can wait for the loading indicator. We will create a test for taking the screenshots after opening the screen and snapshotting after each swipe:

func testTakeScreenshots() {
  let scrollView = app.scrollViews.element(boundBy: 0)

  snapshot("01-CICDWithCodemagicScreen")

  scrollView.swipeLeft()

  snapshot("02-AutomatedTestsScreen")

  scrollView.swipeLeft()

  snapshot("03-CLIToolsScreen")

  scrollView.swipeLeft()

  snapshot("04-PostProcessingActionsScreen")

  scrollView.swipeLeft()

  snapshot("05-ContinuousDeliveryScreen")
}

Run the UI test to ensure that it passes successfully. In the next section, we will add the configuration of the screenshot to upload to the App Store.

Adding screenshot configuration

At the time of writing this post, App Store Connect requires you to take screenshots for the following four screen sizes:

  • iPhone 5.5-inch display
  • iPhone 6.5-inch display
  • iPad Pro 2nd Gen 12.9-inch display
  • iPad Pro 3rd/4th Gen 12.9-inch display

To allow us to store all the configuration parameters related to screenshots, fastlane provides us with a Snapfile. You can add different devices in the Snapfile to create screenshots for those screen sizes. Open the Snapfile and update the content for the following devices:

devices([
   "iPhone 8 Plus",
   "iPhone 13 Pro Max",
   "iPad Pro (12.9-inch) (2nd generation)",
   "iPad Pro (12.9-inch) (5th generation)"
])

languages([
   "en-US"
])

scheme("CodemagicianScreenshotTests")

output_directory("./screenshots")

override_status_bar(true)

clear_previous_screenshots true

This configures fastlane to capture screenshots on four devices with the English-US language. We specify the CodemagicianScreenshotTests scheme and clean previous screenshots whenever we run the command.

And that’s it! We are ready to automate the screenshot process.

To test how the screenshot looks, run the following command to generate the screenshots using fastlane:

bundle exec fastlane snapshot

After a few minutes, if everything is successful, this should open an HTML file with all the screenshots. The screenshots are categorized by language and device.

Creating a codemagic.yaml file to automate making screenshots with fastlane in CI/CD

While you can run fastlane locally on your own machine, you can also take advantage of the ability to create the screenshots on a remote machine using Codemagic and integrate them with your existing CI/CD pipeline for publishing on the App Store. So, if you want to follow these steps and don’t have an account, sign up here.

Sign up

Here’s a sample template for creating the screenshots and fetching the artifact after a successful workflow.

workflows:
  ios-screenshots-fastlane:
    name: iOS Screenshots Fastlane
    environment:
      xcode: latest
      cocoapods: default
    triggering:
      events:                   
        - tag
    scripts:
      - bundle install
      - name: Add 12.9 2nd Gen iPad
        script: xcrun simctl create "iPad Pro (12.9-inch) (2nd generation)" "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-" "com.apple.CoreSimulator.SimRuntime.iOS-15-2"
      - bundle exec fastlane snapshot
    artifacts:
      - ./screenshots

Xcode 13 and above do not have the iPad 12.9-inch 2nd generation simulator preinstalled, although Apple requires you to take a screenshot of this particular device. So, we manually create the simulator on the virtual machine before executing the command to take the screenshots.

Finally, we run the command for fastlane to take screenshots:

bundle exec fastlane snapshot

After running it on Codemagic, you get an artifact that you can download containing the screenshots and an HTML file that allows you to see the screenshots in one place:

You can combine it with fastlane deliver to upload screenshots, metadata, and binaries to App Store Connect and submit your app for App Store review!

Conclusion

Creating screenshots manually is a task that is very prone to human error. But you can automate this task and let tools like fastlane combined with Codemagic handle it so that you can focus on providing the best user experience.

You can find this project with a starter workflow and Snapfile template here.

We hope this post helped you automate your screenshots using fastlane and Codemagic. If you have any questions or suggestions, join our Slack community. Our team would love to hear about your experience automating your screenshots for iOS, tvOS, and watchOS apps!

.


About the author: Rudrank is an aspiring technical author and Apple platforms developer. You can mostly find him on Twitter (@rudrankriyam) or on his personal blog (rudrank.blog).





Source link

ShareTweetSend
Previous Post

Kenya on Path to Establish New Mountain Bongo and Black Rhino Sanctuary on Mt. Kenya

Next Post

Big interest rate hike in UK as Bank of England predicts recession

Related News

10 Best Apps Like QooApp: QooApp Alternatives in 2024
Mobile

10 Best Apps Like QooApp: QooApp Alternatives in 2024

March 15, 2026
ROI of AI in Manufacturing: Costs, Speed & Accuracy
Mobile

ROI of AI in Manufacturing: Costs, Speed & Accuracy

March 14, 2026
Avocado Health introduces AI-Powered text coaching for parents
Mobile

Avocado Health introduces AI-Powered text coaching for parents

March 13, 2026
India AI Impact Summit 2026: The Global South Takes Centre Stage in Shaping the Future of AI — Mobile App Development | Design
Mobile

India AI Impact Summit 2026: The Global South Takes Centre Stage in Shaping the Future of AI — Mobile App Development | Design

March 12, 2026
Next Post
Big interest rate hike in UK as Bank of England predicts recession

Big interest rate hike in UK as Bank of England predicts recession

Discussion about this post

Subscribe To Our Newsletters

    Customer Support


    1251 Wilcrest Drive
    Houston, Texas
    77042 USA
    Call-832.795.1420
    e-mail – news@theinsightpost.com

    Subscribe To Our Newsletters

      Categories

      • Africa
      • Africa-East
      • African Sports
      • American Sports
      • Arts
      • Asia
      • Australia
      • Business
      • Business Asia
      • Business- Africa
      • Canada
      • Defense
      • Education
      • Egypt
      • Energy
      • Entertainment
      • Europe
      • European Soccer
      • Finance
      • Germany
      • Ghana
      • Health
      • Insight
      • International
      • Investing
      • Japan
      • Latest Headlines
      • Life & Living
      • Markets
      • Mobile
      • Movies
      • New Zealand
      • Nigeria
      • Politics
      • Scholarships
      • Science
      • South Africa
      • South America
      • Sports
      • Tech
      • Travel
      • Travel-Africa
      • UK
      • USA
      • Weather
      • World
      No Result
      View All Result

      Recent News

      10 Best Apps Like QooApp: QooApp Alternatives in 2024

      10 Best Apps Like QooApp: QooApp Alternatives in 2024

      March 15, 2026
      Ancient Dogs Started Diversifying 11,000 Years Ago, Long Before the Modern Breeds We Know Today

      Ancient Dogs Started Diversifying 11,000 Years Ago, Long Before the Modern Breeds We Know Today

      March 15, 2026
      Another 3 members of Iran’s women’s soccer team decide against staying in Australia as refugees

      Another 3 members of Iran’s women’s soccer team decide against staying in Australia as refugees

      March 15, 2026
      Crown Prince Reza Pahlavi ready to lead Iran transition government

      Crown Prince Reza Pahlavi ready to lead Iran transition government

      March 15, 2026
      • Home
      • Advertise With Us
      • About Us
      • Corporate
      • Consumer Rewards
      • Forum
      • Privacy Policy
      • Social Trends

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      Welcome Back!

      Login to your account below

      Forgotten Password?

      Retrieve your password

      Please enter your username or email address to reset your password.

      Log In

      Add New Playlist

      We are using cookies to give you the best experience on our website.

      You can find out more about which cookies we are using or switch them off in .

      No Result
      View All Result
      • Home
      • Insight
      • Blog
      • Business
      • Entertainment
      • Health
      • Politics
      • Shop
        • Gift Shop
        • Value Shop
        • Store
        • Bargain Shop
        • Discount
      • Sports
      • Tech
      • Travel
      • USA
      • Video
      • World
        • Asia
        • Africa
        • South America
        • North America
        • Europe
        • Oceania

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      The Insight Post
      Powered by  GDPR Cookie Compliance
      Privacy Overview

      This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

      Strictly Necessary Cookies

      Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

      Cookie Policy

      More information about our Cookie Policy