{"action":"closed","issue":{"url":"https://api.github.com/repos/fastlane/fastlane/issues/1650","repository_url":"https://api.github.com/repos/fastlane/fastlane","labels_url":"https://api.github.com/repos/fastlane/fastlane/issues/1650/labels{/name}","comments_url":"https://api.github.com/repos/fastlane/fastlane/issues/1650/comments","events_url":"https://api.github.com/repos/fastlane/fastlane/issues/1650/events","html_url":"https://github.com/fastlane/fastlane/issues/1650","id":139057617,"number":1650,"title":"snapshot crashes during \"Collecting screenshots…\" phase","user":{"login":"fastlane-bot","id":17056452,"avatar_url":"https://avatars.githubusercontent.com/u/17056452?v=3","gravatar_id":"","url":"https://api.github.com/users/fastlane-bot","html_url":"https://github.com/fastlane-bot","followers_url":"https://api.github.com/users/fastlane-bot/followers","following_url":"https://api.github.com/users/fastlane-bot/following{/other_user}","gists_url":"https://api.github.com/users/fastlane-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/fastlane-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastlane-bot/subscriptions","organizations_url":"https://api.github.com/users/fastlane-bot/orgs","repos_url":"https://api.github.com/users/fastlane-bot/repos","events_url":"https://api.github.com/users/fastlane-bot/events{/privacy}","received_events_url":"https://api.github.com/users/fastlane-bot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fastlane/fastlane/labels/snapshot","name":"snapshot","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-02-02T21:42:16Z","updated_at":"2016-03-22T19:38:29Z","closed_at":"2016-03-22T19:38:29Z","body":"<table>\n      <tr>\n        <td>\n          <img src='https://avatars0.githubusercontent.com/u/3238096?v=3&s=70' width='35'>\n        </td>\n        <td>\n          Original issue by @ashur - Imported from <a href='https://github.com/fastlane/snapshot/issues/419'>fastlane/snapshot#419</a>\n        </td>\n      </tr>\n    </table>\n\n## Description\r\n\r\nWhether running `snapshot` directly or as a `fastlane` action, snapshot crashes with `undefined method 'last' for nil:NilClass` after successfully executing the single test and starting the \"Collecting screenshots…\" phase:\r\n\r\n```\r\n▸ Test Succeeded\r\n▸ Selected tests\r\n▸ Test Suite UITests.xctest started\r\n▸ ScreenshotTests\r\n▸ ✓ testiPhoneScreenshots (8.353 seconds)\r\n▸ \t Executed 1 test, with 0 failures (0 unexpected) in 8.353 (8.355) seconds\r\n▸ \r\nCollecting screenshots...\r\nundefined method `last' for nil:NilClass\r\nBacktrace:\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:59:in `block (6 levels) in attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:56:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:56:in `block (5 levels) in attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:55:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:55:in `block (4 levels) in attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:54:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:54:in `block (3 levels) in attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:53:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:53:in `block (2 levels) in attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:52:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:52:in `block in attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:51:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:51:in `attachments'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/collector.rb:9:in `fetch_screenshots'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:140:in `launch'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:35:in `block (3 levels) in work'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:31:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:31:in `block (2 levels) in work'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:30:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:30:in `block in work'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:29:in `each'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/lib/snapshot/runner.rb:29:in `work'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/bin/snapshot:37:in `block (2 levels) in run'\r\n\t/Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'\r\n\t/Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'\r\n\t/Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:153:in `run'\r\n\t/Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/runner.rb:428:in `run_active_command'\r\n\t/Library/Ruby/Gems/2.0.0/gems/fastlane_core-0.36.1/lib/fastlane_core/ui/fastlane_runner.rb:23:in `run!'\r\n\t/Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/bin/snapshot:78:in `run'\r\n\t/Library/Ruby/Gems/2.0.0/gems/snapshot-1.6.0/bin/snapshot:84:in `<top (required)>'\r\n\t/usr/local/bin/snapshot:23:in `load'\r\n\t/usr/local/bin/snapshot:23:in `<main>'\r\n```\r\n\r\n## Configuration\r\n\r\n### fastlane\r\n\r\n| Version |\r\n| :-: |\r\n| 1.57.0 |\r\n\r\n**Fastfile**:\r\n```\r\ndefault_platform :ios\r\n\r\nplatform :ios do\r\n\tdesc \"Sets up and takes screenshots\"\r\n\tlane :screenshots do\r\n\t\tsnapshot(\r\n\t\t\tscheme: \"Snapshot\",\r\n\t\t\tios_version: \"9.2\",\r\n\t\t\tdevices: [\"iPhone 6\"],\r\n\t\t\tlanguages: [\"en-US\"]\r\n\t\t)\r\n\tend\r\nend\r\n```\r\n\r\n### snapshot\r\n\r\n| Version |\r\n| :-: |\r\n| 1.6.0 |\r\n\r\n**Snapfile**:\r\n```\r\ndevices([\r\n\t\"iPhone 6\"\r\n])\r\n\r\nlanguages([\r\n\t\"en-US\"\r\n])\r\n\r\nscheme \"Snapshot\"\r\n```\r\n\r\n## Test File\r\n\r\nAn incredibly barebones test: launch and take a screenshot...\r\n\r\n```Swift\r\nimport XCTest\r\n\r\nclass ScreenshotTests: XCTestCase\r\n{\r\n\toverride func setUp()\r\n\t{\r\n\t\tsuper.setUp()\r\n\t\tcontinueAfterFailure = false\r\n\r\n\t\t// for snapshot https://github.com/fastlane/snapshot\r\n\t\tlet app = XCUIApplication()\r\n\t\tsetupSnapshot(app)\r\n\t\tapp.launch()\r\n\t}\r\n\r\n\toverride func tearDown()\r\n\t{\r\n\t\tsuper.tearDown()\r\n\t}\r\n\r\n\tfunc testiPhoneScreenshots()\r\n\t{\r\n\t\tsnapshot(\"01Servers\")\r\n\t}\r\n}\r\n```\r\n\r\nNote: the `SnapshotHelper.swift` file _has_ already been added to the UITests target"}}