Slide 1

Slide 1 text

Automatiza tu flow en iOS Jorge Maroto García @patoroco

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Automatiza tu flow en iOS mobile Jorge Maroto García @patoroco

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

and more ... https://github.com/fastlane/

Slide 14

Slide 14 text

Install gem install fastlane

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

fastlane init

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Fastfile lane :test do xctest( destination: "name=iPad 2" ) end

Slide 21

Slide 21 text

DSL

Slide 22

Slide 22 text

actions fastlane actions

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Total 120 actions* 4 https://github.com/fastlane/fastlane/ blob/master/docs/Actions.md 4 https://github.com/fastlane/fastlane/ tree/master/lib/fastlane/actions * last visit 27/11/2015

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Example: crashlytics fastlane action crashlytics

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Example crashlytics lane :crashlytics do ipa( configuration: "Crashlytics" ) crashlytics({ ipa_path: Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH], groups: "Ticketea", notifications: "YES", notes_path: "./fastlane/crashlytics.txt" }) slack({ message: "Nueva versión de prueba de Box Office", channel: "@javiche", default_payloads: [] }) end

Slide 29

Slide 29 text

fastlane_version "1.41.1" default_platform :ios platform :ios do desc "Create app on iTunes Connect" lane :create_app do # be carefull with produce action, because apps created can't be deleted # from iTunes Connect (thanks Apple) produce( app_identifier: 'me.maroto.codemotion20152', app_name: 'prueba codemotion', language: 'Spanish', app_version: '1.0', sku: 'CODE20155', # if SKU is not specified, it will use a random one ) end desc "Update certificates and use it on provisioning profiles" lane :update_certs do cert sigh(force: true) end ... end https://github.com/patoroco/fastlane-talk/blob/master/fastlane/Fastfile

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Full flow

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Fastfile lane :create_app do # be carefull with produce action, because apps created # can't be deleted from iTunes Connect (thanks Apple) produce( app_identifier: 'me.maroto.codemotion20152', app_name: 'prueba codemotion', language: 'Spanish', app_version: '1.0', sku: 'CODE20155', ) # if SKU is not specified, it will use a random one end

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

Fastfile desc "Update certificates and use it on provisioning profiles" lane :update_certs do cert sigh(force: true) end desc "Enable push if is needed" lane :enable_push do pem sigh(force:true) end

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Gymfile clean true silent true buildlog_path './fastlane/logs/' output_directory "./fastlane/builds"

Slide 48

Slide 48 text

Fastfile desc "Create an ipa with Debug configuration" lane :ipa_debug do gym( configuration: 'Debug', output_name: 'codemotion-debug.ipa' ) end desc "Create an ipa with Release configuration" lane :ipa_release do gym( configuration: 'Release', output_name: 'codemotion-release.ipa' ) end

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

SnapshotHelper.swift import Foundation import XCTest var deviceLanguage = "" func setLanguage(app: XCUIApplication) { Snapshot.setLanguage(app) } func snapshot(name: String, waitForLoadingIndicator: Bool = false) { Snapshot.snapshot(name, waitForLoadingIndicator: waitForLoadingIndicator) } @objc class Snapshot: NSObject { class func setLanguage(app: XCUIApplication) { let path = "/tmp/language.txt" do { let locale = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String deviceLanguage = locale.substringToIndex(locale.startIndex.advancedBy(2, limit:locale.endIndex)) app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))", "-AppleLocale", "\"\(locale)\"","-ui_testing"] } catch { print("Couldn't detect/set language...") } } class func snapshot(name: String, waitForLoadingIndicator: Bool = false) { if (waitForLoadingIndicator) { waitForLoadingIndicatorToDisappear() } print("snapshot: \(name)") // more information about this, check out https://github.com/krausefx/snapshot sleep(1) // Waiting for the animation to be finished (kind of) XCUIDevice.sharedDevice().orientation = .Unknown } class func waitForLoadingIndicatorToDisappear() { let query = XCUIApplication().statusBars.childrenMatchingType(.Other).elementBoundByIndex(1).childrenMatchingType(.Other) while (query.count > 4) { sleep(1) print("Number of Elements in Status Bar: \(query.count)... waiting for status bar to disappear") } } }

Slide 51

Slide 51 text

Snapfile # A list of devices you want to take the screenshots from devices([ "iPhone 6", "iPhone 6 Plus", "iPhone 5", "iPhone 4s", ]) languages([ "en-US", "fr-FR", "es-ES" ]) # The name of the scheme which contains the UI Tests scheme "codemotion2015UI" # Where should the resulting screenshots be stored? output_directory "./fastlane/screenshots"

Slide 52

Slide 52 text

UITest import XCTest class codemotion2015UITests: XCTestCase { override func setUp() { super.setUp() let app = XCUIApplication() setLanguage(app) app.launch() } func testSnapshot() { snapshot("01Main") XCUIApplication().buttons.elementBoundByIndex(0).tap() snapshot("02Language") } }

Slide 53

Slide 53 text

Fastfile lane :generate_snapshots do snapshot( clear_previous_screenshots: true, ) end

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

$ frameit https://developer.apple.com/app-store/marketing/guidelines

Slide 57

Slide 57 text

Main window->English->iPhone 6 Plus

Slide 58

Slide 58 text

Second window->Spanish->iPhone 5

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Fastfile desc "Runs test with scan" lane :scan do scan( scheme: 'codemotion2015', device: 'iPhone 6' ) end

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

Demo

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Features 4 upload build 4 list builds 4 manage test users

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

How

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

Links 4 fastlane.tools/ 4 github.com/fastlane/*** 4 github.com/fastlane/fastlane/blob/ master/docs/Actions.md

Slide 75

Slide 75 text

Thanks! Jorge Maroto García @patoroco github.com/patoroco/fastlane-talk