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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b7ef10f6e12380310c76e6ced44550c9ae5a2c2
4
- data.tar.gz: 120e6691fd0afa1ef2d0adbed6ce688e7ee9c723
3
+ metadata.gz: 8ea463f2f123b8e7855fb76d06144e2647e3264d
4
+ data.tar.gz: 9757d090c1785789e958c5a467fd311820220d36
5
5
  SHA512:
6
- metadata.gz: c2fb55b160f240f56c9ea8ca8ffc9328e025c25d1a7a43ac1fb11d78a362590128b6e7a8f71e8036b097e3c6491eea98854fbe90948bc5a939095cb1a966d1ff
7
- data.tar.gz: bd014a18b50266f83502bf9eb8eeb5e0cc4ecc641b5630529c14957bccb0cefa7af7c8d4ef10a0680c79f578e1125487c666c4e4d39c8c66fc79e1aaae15e1d9
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"
@@ -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 :(.*)/
@@ -1,3 +1,3 @@
1
1
  module Snapshot
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause