fastlane: Snapshot is not saving any screenshots until all the tests passed

New Issue Checklist

Issue Description

Snapshot is not saving any screenshots until all the tests passed.

Complete output when running fastlane, including the stack trace and command used

You can use: --capture_output as the last commandline argument to get that collected for you

Environment

Please run fastlane env and copy the output below. This will help us help you 👍 If you used --capture_output option please remove this block - as it is already included there.

đźš« fastlane environment đźš«

Stack

Key Value
OS 10.12.2
Ruby 2.0.0
Bundler? false
Git git version 2.10.1 (Apple Git-78)
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.12.2 (16C67)
Ruby Lib Dir /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
OpenSSL Version OpenSSL 0.9.8zc 19 Mar 2015
Is contained false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 8.2.1

System Locale

Error
No Locale with UTF8 found đźš«

fastlane files:

`./fastlane/Fastfile`
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.8.0"

default_platform :ios

platform :ios do
  before_all do
    # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
    cocoapods
    increment_build_no
  end

  desc "Runs all the tests"
  lane :test do
    scan
  end

  desc "Submit a new Beta Build to Apple TestFlight"
  desc "This will also make sure the profile is up to date"
  lane :beta do
    # match(type: "appstore") # more information: https://codesigning.guide
    just_build
    pilot

    # sh "your_script.sh"
    # You can also use other beta testing services here (run `fastlane actions`)
  end

  lane :just_build do
    # match(type: "appstore") # more information: https://codesigning.guide
    build_time = Time.new.strftime("%Y.%m.%d-%H.%M.%S")
    gym(
      scheme: "xxx",
      clean: true,
      include_bitcode: false,
      output_directory: "build/#{build_time}"
    ) # Build your app - more options available
  end

  lane :increment_build_no do
    build_number = get_build_number.to_i
    increment_build_number(
      build_number: "#{(build_number+1)}"
    )    
  end

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    # slack(
    #   message: "Successfully deployed new App Update."
    # )
    notification(
      title: "SUCCESS :)", 
      subtitle: "-> #{lane_context[:LANE_NAME]}", 
      message: "Congrats!!!",
      app_icon: "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarFavoritesIcon.icns",
      sound: "Glass"
    )
  end

  error do |lane, exception|
    # slack(
    #   message: exception.message,
    #   success: false
    # )
    notification(
      title: "ERROR :(", 
      subtitle: "-> #{lane_context[:LANE_NAME]}", 
      message: exception.message,
      app_icon: "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns",
      sound: "Submarine"
    )
  end
end


# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://docs.fastlane.tools/actions

# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer
`./fastlane/Appfile`
app_identifier "xxx" # The bundle identifier of your app
apple_id "xxx" # Your Apple email address

team_id "xxx"  # Developer Portal Team ID

# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

fastlane gems

Gem Version Update-Status
fastlane 2.11.0 âś… Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
slack-notifier 1.5.1
i18n 0.7.0
json 1.7.7
thread_safe 0.3.5
tzinfo 1.2.2
minitest 5.10.1
activesupport 4.2.7.1
CFPropertyList 2.3.4
claide 1.0.1
colored 1.2
nanaimo 0.2.3
xcodeproj 1.4.2
rouge 1.11.1
xcpretty 0.2.4
terminal-notifier 1.7.1
unicode-display_width 1.1.2
terminal-table 1.7.3
plist 3.2.0
public_suffix 2.0.5
addressable 2.5.0
multipart-post 2.0.0
word_wrap 1.0.0
babosa 1.0.2
highline 1.7.8
commander 4.4.3
excon 0.54.0
faraday 0.10.1
unf_ext 0.0.7.2
unf 0.1.4
domain_name 0.5.20161129
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
fastimage 2.0.1
gh_inspector 1.0.3
uber 0.0.15
representable 2.3.0
retriable 2.1.0
mime-types-data 3.2016.0521
mime-types 3.1
hurley 0.2
little-plugger 1.1.4
multi_json 1.12.1
logging 2.1.0
jwt 1.5.6
memoist 0.15.0
os 0.9.6
signet 0.7.3
googleauth 0.5.1
httpclient 2.8.3
google-api-client 0.9.20
mini_magick 4.5.1
multi_xml 0.6.0
rubyzip 1.2.0
security 0.1.3
xcpretty-travis-formatter 0.0.4
dotenv 2.1.1
bundler 1.13.7
faraday_middleware 0.10.1

generated on: 2017-01-26

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Hey everyone, I understand why this feature is useful. If you have some extra time, feel free to submit a PR to fastlane, as this would probably help many others too.

The reason why snapshot only copies the screenshots after the test runs finishes, is that I didn’t want to overwrite the previously generated screenshots if the new ones didn’t succeed.

Hi fastlane team,

I was about to create a new issue/feature request but found this. I do think it would be a useful feature for snapshot to have, and am wondering if you guys have had any further discussion about this?

In my case, we do use snapshot for taking screenshots to upload to the store, but we would also like to use it to do nightly UI test runs and it would be great to have the screenshots along with those test results, regardless of whether the tests passed or not.

So if this were implemented, I’d imagine it to work like this: Tests pass -> no change in behaviour Tests fail & new option turned off or not set -> snapshot fails, no report, no screenshots Tests fail & new option turned on -> snapshot fails, report is generated along with screenshots

Let me know what you think of this, or if you’d like me to create a new issue to discuss it!

Haha, yeah, that’s our bot 👍 It helps us a lot actually.

Currently it isn’t planned to update snapshot to behave differently. I’d have to look into if it would even be easy to update snapshot to work differently in that aspect. Mostly because we’re parsing the output at the same time as the attachments.

Let’s mark this as a feature and see if other people need this as well.