snapshot 0.7.0 → 0.7.1
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 +4 -4
- data/README.md +6 -0
- data/bin/snapshot +14 -0
- data/lib/snapshot/runner.rb +13 -3
- data/lib/snapshot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea463f2f123b8e7855fb76d06144e2647e3264d
|
4
|
+
data.tar.gz: 9757d090c1785789e958c5a467fd311820220d36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5f48e3f0f7376fea696e58616d04e79da0eb494f9636eca63b4894f5d865b7cef230c3118e0af6d9a253141859d1e8e33bbde101729afa2fc139b4fe2ca6c5a
|
7
|
+
data.tar.gz: 05ec92c9955486462dc888b4b2f0fe6f1b347a30a8080164303da7fc3293978d4d52a21147873598b06f597007f2b1ad70fd6cc43e27be3e524a44db737e7258
|
data/README.md
CHANGED
@@ -157,6 +157,12 @@ To skip cleaning the project:
|
|
157
157
|
snapshot --noclean
|
158
158
|
```
|
159
159
|
|
160
|
+
To only run tests (i.e. don't actually take any screenshots):
|
161
|
+
```
|
162
|
+
snapshot test
|
163
|
+
```
|
164
|
+
|
165
|
+
|
160
166
|
By default, `snapshot`, will re-install the app, to make sure it's in a clean state. In case you don't want this run
|
161
167
|
|
162
168
|
```
|
data/bin/snapshot
CHANGED
@@ -42,6 +42,20 @@ class SnapshotApplication
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
command :test do |c|
|
46
|
+
c.syntax = 'snapshot test'
|
47
|
+
c.description = 'Runs the automated tests.'
|
48
|
+
|
49
|
+
c.action do |args, options|
|
50
|
+
path = (Snapshot::Helper.fastlane_enabled?? './fastlane' : '.')
|
51
|
+
Dir.chdir(path) do # switch the context
|
52
|
+
Snapshot::DependencyChecker.check_simulators
|
53
|
+
Snapshot::SnapshotConfig.shared_instance(options.snapfile)
|
54
|
+
Snapshot::Runner.new.work(clean: !options.noclean, build: !options.nobuild, take_snapshots: false)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
45
59
|
command :init do |c|
|
46
60
|
c.syntax = 'snapshot init'
|
47
61
|
c.description = "Creates a new Snapfile in the current directory"
|
data/lib/snapshot/runner.rb
CHANGED
@@ -5,7 +5,7 @@ module Snapshot
|
|
5
5
|
class Runner
|
6
6
|
TRACE_DIR = '/tmp/snapshot_traces'
|
7
7
|
|
8
|
-
def work(clean: true, build: true)
|
8
|
+
def work(clean: true, build: true, take_snapshots: true)
|
9
9
|
SnapshotConfig.shared_instance.js_file # to verify the file can be found earlier
|
10
10
|
|
11
11
|
Builder.new.build_app(clean: clean) if build
|
@@ -14,7 +14,7 @@ module Snapshot
|
|
14
14
|
counter = 0
|
15
15
|
errors = []
|
16
16
|
|
17
|
-
FileUtils.rm_rf SnapshotConfig.shared_instance.screenshots_path if SnapshotConfig.shared_instance.clear_previous_screenshots
|
17
|
+
FileUtils.rm_rf SnapshotConfig.shared_instance.screenshots_path if (SnapshotConfig.shared_instance.clear_previous_screenshots and take_snapshots)
|
18
18
|
|
19
19
|
SnapshotConfig.shared_instance.devices.each do |device|
|
20
20
|
SnapshotConfig.shared_instance.languages.each do |language_item|
|
@@ -32,7 +32,7 @@ module Snapshot
|
|
32
32
|
|
33
33
|
begin
|
34
34
|
errors.concat(run_tests(device, language, locale))
|
35
|
-
counter += copy_screenshots(language)
|
35
|
+
counter += copy_screenshots(language) if take_snapshots
|
36
36
|
rescue => ex
|
37
37
|
Helper.log.error(ex)
|
38
38
|
end
|
@@ -43,6 +43,8 @@ module Snapshot
|
|
43
43
|
|
44
44
|
`killall "iOS Simulator"` # close the simulator after the script is finished
|
45
45
|
|
46
|
+
return unless take_snapshots
|
47
|
+
|
46
48
|
ReportsGenerator.new.generate
|
47
49
|
|
48
50
|
if errors.count > 0
|
@@ -132,6 +134,10 @@ module Snapshot
|
|
132
134
|
retry_run = true
|
133
135
|
when :screenshot
|
134
136
|
Helper.log.info "Successfully took screenshot 📱"
|
137
|
+
when :pass
|
138
|
+
Helper.log.info line.strip.gsub("Pass:", "✓").green
|
139
|
+
when :fail
|
140
|
+
Helper.log.info line.strip.gsub("Fail:", "✗").red
|
135
141
|
when :need_permission
|
136
142
|
raise "Looks like you may need to grant permission for Instruments to analyze other processes.\nPlease Ctrc + C and run this command: \"#{command}\""
|
137
143
|
end
|
@@ -182,6 +188,10 @@ module Snapshot
|
|
182
188
|
return :screenshot
|
183
189
|
elsif line.include? "Instruments wants permission to analyze other processes"
|
184
190
|
return :need_permission
|
191
|
+
elsif line.include? "Pass: "
|
192
|
+
return :pass
|
193
|
+
elsif line.include? "Fail: "
|
194
|
+
return :fail
|
185
195
|
elsif line =~ /.*Error: (.*)/
|
186
196
|
raise "UIAutomation Error: #{$1}"
|
187
197
|
elsif line =~ /Instruments Usage Error :(.*)/
|
data/lib/snapshot/version.rb
CHANGED