iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 26
0
Mobile Development

IOS 基本元件運用和套件運用系列 第 26

(Day26)Fastlane 截圖

這篇文章會介紹Fastlane的截圖功能

安裝fastlane

Fastlane是用Ruby寫的一個工具。在terminal輸入

sudo gem install fastlane -NV

設定Fastlane

在terminal切到目標專案目錄底下,然後執行

fastlane snapshot init

https://ithelp.ithome.com.tw/upload/images/20201009/20129678mTNYeRLyCR.png

在專案裡新增UI Test

Editor > add target
https://ithelp.ithome.com.tw/upload/images/20201009/20129678hxOK0SsPhl.png

把剛剛fastlane新增的swift file 加入UI Test
https://ithelp.ithome.com.tw/upload/images/20201009/201296783Fz8MoodHv.png
https://ithelp.ithome.com.tw/upload/images/20201009/201296785n9WBxN8C6.png

新增一個scheme
https://ithelp.ithome.com.tw/upload/images/20201009/20129678jGUmCwYXOH.png
https://ithelp.ithome.com.tw/upload/images/20201009/201296781a6gUS9zTk.png

設定scheme
https://ithelp.ithome.com.tw/upload/images/20201009/20129678uMtDyxJi0M.png

在run欄把最下面的shared 打勾
https://ithelp.ithome.com.tw/upload/images/20201009/201296788MahySTty4.png

在UI Test裡加上這段程式碼

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

錄製動作

https://ithelp.ithome.com.tw/upload/images/20201009/20129678hnKU9cG7eV.png

錄製完後在想要截圖的動作後加入

snapshot("01LoginScreen")

掛號裡的名字可以自己取。

然後在terminal執行

fastlane snapshot

上一篇
(Day25) Fastlane UI Test/unit test
下一篇
(Day27)Xcode 11 UI PickerView
系列文
IOS 基本元件運用和套件運用30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言