snapshot 0.3.1 → 0.3.2
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 +13 -3
- data/bin/snapshot +4 -0
- data/lib/assets/SnapshotHelper.js +10 -8
- data/lib/snapshot.rb +0 -1
- data/lib/snapshot/runner.rb +6 -3
- data/lib/snapshot/snapshot_config.rb +12 -4
- data/lib/snapshot/snapshot_file.rb +3 -11
- data/lib/snapshot/version.rb +1 -1
- metadata +2 -3
- data/lib/snapshot/languages.rb +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28f9044173c73c9227c4e372ca91977e262a3166
|
|
4
|
+
data.tar.gz: 93c57e0423a893e5cb97ef1e3e7198cdeedb72c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c98f7667067c7ab9e0daee297868b1c9938668152de527ecd63752db9a510a35b77f73e97f87faff5adc7f0f84eba82e164d8673808b9fb4a2f138fbc8df2bf1
|
|
7
|
+
data.tar.gz: fb94311fe51e3f1f62e284fa46689797931e0f0cbc66d3f39d6b01420a8a4ea74487dff559063bbd8a9b57467fa176bde992f3b97ec77b758b096ffd4d9087e5
|
data/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://github.com/KrauseFx/deliver">Deliver</a> •
|
|
3
3
|
<b>Snapshot</b> •
|
|
4
|
-
<a href="https://github.com/KrauseFx/frameit">FrameIt</a>
|
|
4
|
+
<a href="https://github.com/KrauseFx/frameit">FrameIt</a> •
|
|
5
|
+
<a href="https://github.com/KrauseFx/PEM">PEM</a>
|
|
5
6
|
</p>
|
|
6
7
|
-------
|
|
7
8
|
|
|
@@ -91,7 +92,7 @@ Make sure, you have the latest version of the Xcode command line tools installed
|
|
|
91
92
|
|
|
92
93
|
# UI Automation
|
|
93
94
|
|
|
94
|
-
##
|
|
95
|
+
## Getting started
|
|
95
96
|
This project uses Apple's ```UI Automation``` under the hood. I will not go into detail on how to write scripts.
|
|
96
97
|
|
|
97
98
|
Here a few links to get started:
|
|
@@ -233,7 +234,16 @@ teardown_device do |device|
|
|
|
233
234
|
end
|
|
234
235
|
```
|
|
235
236
|
|
|
237
|
+
### Skip alpha removal from screenshots
|
|
238
|
+
In case you want to skip this process, just add ```skip_alpha_removal``` to your ```Snapfile```.
|
|
239
|
+
|
|
236
240
|
# Tips
|
|
241
|
+
## Specify a custom ```Snapfile```
|
|
242
|
+
|
|
243
|
+
snapshot --snapfile ./SpecialSnapfile
|
|
244
|
+
|
|
245
|
+
Be aware: The file will be executed from the current directory, not the location of the ```Snapfile```. That means: ```./screenshots``` will export the screenshots to the current directory of your terminal session.
|
|
246
|
+
|
|
237
247
|
## Available language codes
|
|
238
248
|
```ruby
|
|
239
249
|
["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "zh_CN", "cmn-Hant"]
|
|
@@ -246,7 +256,7 @@ You can use [SimulatorStatusMagic](https://github.com/shinydevelopment/Simulator
|
|
|
246
256
|
Change syntax highlighting to *Ruby*.
|
|
247
257
|
|
|
248
258
|
## Instruments is not responding
|
|
249
|
-
Unfortunately
|
|
259
|
+
Unfortunately ```Instruments``` sometimes decides, to not respond to anything. Which means, neither the ```Instruments``` application, nor the ```instruments``` command line work. Killing the process doesn't help.
|
|
250
260
|
|
|
251
261
|
The only way to fix this, is a restart of the Mac.
|
|
252
262
|
|
data/bin/snapshot
CHANGED
|
@@ -7,6 +7,7 @@ require 'commander/import'
|
|
|
7
7
|
require 'snapshot/update_checker'
|
|
8
8
|
require 'snapshot/dependency_checker'
|
|
9
9
|
require 'snapshot/snapfile_creator'
|
|
10
|
+
require 'snapshot/snapshot_config'
|
|
10
11
|
|
|
11
12
|
HighLine.track_eof = false
|
|
12
13
|
|
|
@@ -29,7 +30,10 @@ default_command :run
|
|
|
29
30
|
command :run do |c|
|
|
30
31
|
c.syntax = 'snapshot'
|
|
31
32
|
c.description = 'Run the script, to take all the screenshots'
|
|
33
|
+
c.option '--snapfile STRING', String, 'Custom path for your Snapfile'
|
|
34
|
+
|
|
32
35
|
c.action do |args, options|
|
|
36
|
+
Snapshot::SnapshotConfig.shared_instance(options.snapfile) if options.snapfile # to set the custom Snapfile path if given
|
|
33
37
|
Snapshot::Runner.new.work
|
|
34
38
|
end
|
|
35
39
|
end
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
function wait_for_loading_indicator_to_be_finished()
|
|
2
2
|
{
|
|
3
|
-
|
|
4
|
-
re2 = UIATarget.localTarget().frontMostApp().statusBar().elements()[3].rect()
|
|
5
|
-
while ((re['size']['width'] == 10 && re['size']['height'] == 20) ||
|
|
6
|
-
(re2['size']['width'] == 10 && re2['size']['height'] == 20))
|
|
7
|
-
{
|
|
8
|
-
UIALogger.logMessage("Loading indicator is visible... waiting")
|
|
9
|
-
UIATarget.localTarget().delay(1)
|
|
3
|
+
try {
|
|
10
4
|
re = UIATarget.localTarget().frontMostApp().statusBar().elements()[2].rect()
|
|
11
5
|
re2 = UIATarget.localTarget().frontMostApp().statusBar().elements()[3].rect()
|
|
12
|
-
|
|
6
|
+
while ((re['size']['width'] == 10 && re['size']['height'] == 20) ||
|
|
7
|
+
(re2['size']['width'] == 10 && re2['size']['height'] == 20))
|
|
8
|
+
{
|
|
9
|
+
UIALogger.logMessage("Loading indicator is visible... waiting")
|
|
10
|
+
UIATarget.localTarget().delay(1)
|
|
11
|
+
re = UIATarget.localTarget().frontMostApp().statusBar().elements()[2].rect()
|
|
12
|
+
re2 = UIATarget.localTarget().frontMostApp().statusBar().elements()[3].rect()
|
|
13
|
+
}
|
|
14
|
+
} catch (e) {}
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
function captureLocalizedScreenshot(name) {
|
data/lib/snapshot.rb
CHANGED
|
@@ -5,7 +5,6 @@ require 'snapshot/snapshot_config'
|
|
|
5
5
|
require 'snapshot/runner'
|
|
6
6
|
require 'snapshot/builder'
|
|
7
7
|
require 'snapshot/snapshot_file'
|
|
8
|
-
require 'snapshot/languages'
|
|
9
8
|
require 'snapshot/reports_generator'
|
|
10
9
|
require 'snapshot/screenshot_flatten'
|
|
11
10
|
require 'snapshot/simulators'
|
data/lib/snapshot/runner.rb
CHANGED
|
@@ -26,7 +26,7 @@ module Snapshot
|
|
|
26
26
|
errors.concat(run_tests(device, language))
|
|
27
27
|
counter += copy_screenshots(language)
|
|
28
28
|
rescue SystemExit, Interrupt => ex
|
|
29
|
-
raise ex # system interrupted exception (
|
|
29
|
+
raise ex # system interrupted exception (ctrl + C)
|
|
30
30
|
rescue StandardError => ex
|
|
31
31
|
Helper.log.error(ex)
|
|
32
32
|
end
|
|
@@ -45,8 +45,6 @@ module Snapshot
|
|
|
45
45
|
else
|
|
46
46
|
Helper.log.info "Successfully finished generating #{counter} screenshots.".green
|
|
47
47
|
end
|
|
48
|
-
|
|
49
|
-
ScreenshotFlatten.new.run(SnapshotConfig.shared_instance.screenshots_path)
|
|
50
48
|
|
|
51
49
|
Helper.log.info "Check it out here: #{SnapshotConfig.shared_instance.screenshots_path}".green
|
|
52
50
|
end
|
|
@@ -65,6 +63,7 @@ module Snapshot
|
|
|
65
63
|
|
|
66
64
|
ENV['SNAPSHOT_LANGUAGE'] = language
|
|
67
65
|
command = generate_test_command(device, language, app_path)
|
|
66
|
+
Helper.log.debug command.yellow
|
|
68
67
|
|
|
69
68
|
retry_run = false
|
|
70
69
|
|
|
@@ -118,6 +117,10 @@ module Snapshot
|
|
|
118
117
|
|
|
119
118
|
FileUtils.mkdir_p resulting_path
|
|
120
119
|
|
|
120
|
+
unless SnapshotConfig.shared_instance.skip_alpha_removal
|
|
121
|
+
ScreenshotFlatten.new.run(TRACE_DIR)
|
|
122
|
+
end
|
|
123
|
+
|
|
121
124
|
Dir.glob("#{TRACE_DIR}/**/*.png") do |file|
|
|
122
125
|
FileUtils.cp_r(file, resulting_path + '/')
|
|
123
126
|
end
|
|
@@ -31,23 +31,31 @@ module Snapshot
|
|
|
31
31
|
# @return (String) The build command, wich should build the app to '/tmp/snapshot'
|
|
32
32
|
attr_accessor :build_command
|
|
33
33
|
|
|
34
|
+
# @return (BOOl) Skip the removal of the alpha channel from the screenshots
|
|
35
|
+
attr_accessor :skip_alpha_removal
|
|
36
|
+
|
|
34
37
|
# @return (Hash) All the blocks, which are called on specific actions
|
|
35
38
|
attr_accessor :blocks
|
|
36
39
|
|
|
37
40
|
|
|
38
41
|
# A shared singleton
|
|
39
|
-
def self.shared_instance
|
|
40
|
-
@@instance ||= SnapshotConfig.new
|
|
42
|
+
def self.shared_instance(path = nil)
|
|
43
|
+
@@instance ||= SnapshotConfig.new(path)
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
# @param path (String) the path to the config file to use (including the file name)
|
|
44
|
-
def initialize(path =
|
|
47
|
+
def initialize(path = nil)
|
|
48
|
+
path ||= './Snapfile'
|
|
45
49
|
set_defaults
|
|
46
50
|
|
|
47
51
|
if path and File.exists?path
|
|
48
52
|
self.snapshot_file = SnapshotFile.new(path, self)
|
|
49
53
|
else
|
|
50
|
-
|
|
54
|
+
if path != './Snapfile'
|
|
55
|
+
raise "Could not find Snapfile at path '#{path}'. Make sure you pass the full path, including 'Snapfile'".red
|
|
56
|
+
else
|
|
57
|
+
Helper.log.error "Could not find './Snapfile'. It is recommended to create a file using 'snapshot init' into the current directory. Using the defaults now.".red
|
|
58
|
+
end
|
|
51
59
|
end
|
|
52
60
|
|
|
53
61
|
load_env
|
|
@@ -26,7 +26,7 @@ module Snapshot
|
|
|
26
26
|
when :devices
|
|
27
27
|
self.verify_devices(value)
|
|
28
28
|
when :languages
|
|
29
|
-
|
|
29
|
+
@config.languages = value
|
|
30
30
|
when :ios_version
|
|
31
31
|
raise "ios_version has to be an String".red unless value.kind_of?String
|
|
32
32
|
@config.ios_version = value
|
|
@@ -47,6 +47,8 @@ module Snapshot
|
|
|
47
47
|
when :build_command
|
|
48
48
|
raise "build_command has to be an String".red unless value.kind_of?String
|
|
49
49
|
@config.build_command = value
|
|
50
|
+
when :skip_alpha_removal
|
|
51
|
+
@config.skip_alpha_removal = true
|
|
50
52
|
when :project_path
|
|
51
53
|
raise "project_path has to be an String".red unless value.kind_of?String
|
|
52
54
|
|
|
@@ -78,15 +80,5 @@ module Snapshot
|
|
|
78
80
|
end
|
|
79
81
|
end
|
|
80
82
|
end
|
|
81
|
-
|
|
82
|
-
def verify_languages(value)
|
|
83
|
-
raise "Languages has to be an array".red unless value.kind_of?Array
|
|
84
|
-
value.each do |current|
|
|
85
|
-
unless Languages::ALL_LANGUAGES.include?current
|
|
86
|
-
raise "Language '#{current}' not found. Available languages: #{Languages::ALL_LANGUAGES}".red
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
@config.languages = value
|
|
90
|
-
end
|
|
91
83
|
end
|
|
92
84
|
end
|
data/lib/snapshot/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snapshot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Felix Krause
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-11-
|
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -182,7 +182,6 @@ files:
|
|
|
182
182
|
- lib/snapshot/builder.rb
|
|
183
183
|
- lib/snapshot/dependency_checker.rb
|
|
184
184
|
- lib/snapshot/helper.rb
|
|
185
|
-
- lib/snapshot/languages.rb
|
|
186
185
|
- lib/snapshot/page.html.erb
|
|
187
186
|
- lib/snapshot/reports_generator.rb
|
|
188
187
|
- lib/snapshot/runner.rb
|
data/lib/snapshot/languages.rb
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
module Snapshot
|
|
2
|
-
module Languages
|
|
3
|
-
# These are all the languages which are available to choose for the simulator
|
|
4
|
-
ALL_LANGUAGES = ["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "zh_CN", "cmn-Hant"]
|
|
5
|
-
end
|
|
6
|
-
end
|