fastlane-plugin-snapshot_test 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 677b83e869da2e53021b30471eeb9ad5cf968cb827bd2b1ea74a7b87b94a8a15
4
- data.tar.gz: c735fc43fdfcd87bef3707d19347a8fe8e44282b485ab824ce8f86ff6ed6ee9c
3
+ metadata.gz: f1188ae451fe6c78b6970a1a5fa6c42671b48059e586a8acf11d4288a89b3e8b
4
+ data.tar.gz: 9604828f6e2a7c1698924af5b4aaada7dc9245334b981a0ad10bd4c4d288bfea
5
5
  SHA512:
6
- metadata.gz: ce859b31c9271be29b000512d1d4938636ac35b0d86b86702dacd4d54eeef9af110dc564fe30a1611cae088caf82f714f202dd3ea3f6be53de1c08532ae1021a
7
- data.tar.gz: 7a8ebd24adc7f168bff622945d6c557a1d27d11266f885cf74a2b66c1f51f927e05131cd6ebfec47ce9a18772c49039dd4b9b0f574293939e1a8ee51d487ff27
6
+ metadata.gz: 59978bdbdc886ea6afe9202064490ca43f12a401597f0df89c6ffd622f87e06e54c909fe1b3786326d78a5698d6b4976a2c89532bceb441d465b66694e06508e
7
+ data.tar.gz: 42e652f5cf57d497238a7fcb8ea39b0f44c1a5fc61b76c5b23d9dc4ef62a76ead3dfa3cb765543b768afde19de14eac610bbf15134836ec3dbad191715b18b0b
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Moyuru Aizawa <lvla0805@gmail.com>
3
+ Copyright (c) 2019 CyberAgent, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -20,6 +20,18 @@ compare screenshots with previous commit's screenshots.
20
20
 
21
21
  Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
22
 
23
+ In case of `screenshot_dir` like below,
24
+
25
+ ```
26
+ .screenshot
27
+ ├ Nexus6
28
+ | ├ MainPage.jpg
29
+ | └ SubPage.jpg
30
+ └ Nexus6P
31
+ ├ MainPage.jpg
32
+ └ SubPage.jpg
33
+ ```
34
+
23
35
  ## Run tests for this plugin
24
36
 
25
37
  To run both the tests, and code style validation, run
@@ -1,4 +1,5 @@
1
1
  require 'fastlane/action'
2
+
2
3
  require_relative '../../helper/helper'
3
4
 
4
5
  module Fastlane
@@ -160,6 +161,20 @@ module Fastlane
160
161
  def self.is_supported?(platform)
161
162
  platform == :android
162
163
  end
164
+
165
+ def self.example_code
166
+ ['screenshot_notifier(
167
+ gcloud_service_key_file: "fastlane/client-secret.json",
168
+ screenshot_bucket: "cats-firebase",
169
+ screenshot_dir: ".screenshot",
170
+ github_owner: "cats-oss",
171
+ github_repository: "android",
172
+ github_pr_number: ENV["CI_PULL_REQUEST"][/(?<=https:\/\/github.com\/cats-oss\/android\/pull\/)(.*)/],
173
+ github_api_token: ENV["DANGER_GITHUB_API_TOKEN"],
174
+ image_length: 100
175
+ )']
176
+ end
177
+
163
178
  end
164
179
  end
165
180
  end
@@ -49,17 +49,17 @@ module Fastlane
49
49
  bucket = params[:snapshot_bucket]
50
50
  commit_hash = Helper.get_current_commit_hash
51
51
 
52
- message = <<-EOS
53
- ## Snapshot Test Result
54
- Commit Hash: #{commit_hash}
52
+ message = <<~EOS
53
+ ## Snapshot Test Result
54
+ Commit Hash: #{commit_hash}
55
55
 
56
- #{summary_table(result[:new_items], result[:deleted_items], result[:changed_items], result[:passed_items])}
56
+ #{summary_table(result[:new_items], result[:deleted_items], result[:changed_items], result[:passed_items])}
57
57
 
58
- #{changed_items_table(result[:changed_items], bucket, commit_hash, params[:working_dir], params[:image_length])}
58
+ #{changed_items_table(result[:changed_items], bucket, commit_hash, params[:working_dir], params[:image_length])}
59
59
 
60
- #{new_items_table(result[:new_items], bucket, commit_hash, params[:working_dir], params[:image_length])}
60
+ #{new_items_table(result[:new_items], bucket, commit_hash, params[:working_dir], params[:image_length])}
61
61
 
62
- #{deleted_items_list(result[:deleted_items])}
62
+ #{deleted_items_list(result[:deleted_items])}
63
63
  EOS
64
64
 
65
65
  GitHubNotifier.fold_comments(
@@ -80,14 +80,14 @@ Commit Hash: #{commit_hash}
80
80
  end
81
81
 
82
82
  def self.summary_table(new_items, deleted_items, changed_items, passed_items)
83
- <<-EOS
84
- ### Summary
85
- | | Count |
86
- | --- | --- |
87
- | New Screenshots | #{new_items.size} |
88
- | Deleted Screenshots | #{deleted_items.size} |
89
- | Changed Screenshots | #{changed_items.size} |
90
- | Passed Screenshots | #{passed_items.size} |
83
+ <<~EOS
84
+ ### Summary
85
+ | | Count |
86
+ | --- | --- |
87
+ | New Screenshots | #{new_items.size} |
88
+ | Deleted Screenshots | #{deleted_items.size} |
89
+ | Changed Screenshots | #{changed_items.size} |
90
+ | Passed Screenshots | #{passed_items.size} |
91
91
  EOS
92
92
  end
93
93
 
@@ -222,6 +222,22 @@ Commit Hash: #{commit_hash}
222
222
  def self.is_supported?(platform)
223
223
  true
224
224
  end
225
+
226
+ def self.example_code
227
+ ['pr_number = ENV["CI_PULL_REQUEST"] != nil ? ENV["CI_PULL_REQUEST"][/(?<=https:\/\/github.com\/cats-oss\/android\/pull\/)(.*)/] : nil
228
+ compare_snapshot(
229
+ gcloud_service_key_file: "fastlane/client-secret.json",
230
+ snapshot_bucket: "cats-android-snapshot",
231
+ working_dir: ".snapshot_test",
232
+ screenshot_dir: ".screenshot/shamu-22-ja_JP-portrait",
233
+ github_owner: "cats-oss",
234
+ github_repository: "android",
235
+ github_pr_number: pr_number,
236
+ github_api_token: ENV["DANGER_GITHUB_API_TOKEN"],
237
+ image_length: 100
238
+ )']
239
+ end
240
+
225
241
  end
226
242
  end
227
243
  end
@@ -58,6 +58,16 @@ module Fastlane
58
58
  def self.is_supported?(platform)
59
59
  true
60
60
  end
61
+
62
+ def self.example_code
63
+ ['upload_snapshot(
64
+ gcloud_service_key_file: "fastlane/client-secret.json",
65
+ snapshot_bucket: "cats-android-snapshot",
66
+ working_dir: ".snapshot_test",
67
+ screenshot_dir: ".screenshot/shamu-22-ja_JP-portrait"
68
+ )']
69
+ end
70
+
61
71
  end
62
72
  end
63
73
  end
@@ -116,6 +116,31 @@ module Fastlane
116
116
  hash_obj[property] = default
117
117
  end
118
118
  end
119
+
120
+ def self.example_code
121
+ ['take_screenshot(
122
+ project_id: "cats-firebase",
123
+ gcloud_service_key_file: "fastlane/client-secret.json",
124
+ devices: [
125
+ {
126
+ model: "shamu",
127
+ version: "22",
128
+ locale: "ja_JP",
129
+ orientation: "portrait"
130
+ },
131
+ {
132
+ model: "Pixel2",
133
+ version: "28"
134
+ }
135
+ ],
136
+ app_apk: "tools/app-snapshot-debug.apk",
137
+ app_test_apk: "app/build/outputs/apk/androidTest/snapshot/debug/installedapp-snapshot-debug-androidTest.apk",
138
+ firebase_test_lab_results_bucket: "cats-android-firebase-instrumented-test",
139
+ timeout: "10m",
140
+ download_dir: ".screenshot"
141
+ )']
142
+ end
143
+
119
144
  end
120
145
  end
121
146
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SnapshotTest
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-snapshot_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moyuru Aizawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-09 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry