nakal 0.0.1 → 0.0.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 +31 -3
- data/lib/nakal/base_screen.rb +3 -14
- data/lib/nakal/dsl.rb +0 -1
- data/lib/nakal/ios/screen.rb +14 -2
- data/lib/nakal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae2f95fd7f77548345f830f2648e3cc539d4e14c
|
4
|
+
data.tar.gz: c376aa9408cd1742d7bfd0776cc5d9177ccab08f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6943f113f416613f5b58a79415bbfb289e7b53f0c66bd4eef4e519682bbaef8fd47f2e312ac9c302eca0f1b0a737e331632ca1173cfee70f8ace4b1f2eaa63b7
|
7
|
+
data.tar.gz: f0c10353e4748936c40b132571ff6876d89c8aa452c8b11896378b8a75409c8045ca2534172f95a2ffb88bd4b23c667582e2edc73c001042722672d63714f162
|
data/README.md
CHANGED
@@ -23,19 +23,47 @@ If you are using cucumber, include following Lines in your env.rb
|
|
23
23
|
require "nakal/cucumber"
|
24
24
|
|
25
25
|
Nakal.platform = :android
|
26
|
+
|
26
27
|
Nakal.directory= "baseline_images/droid"
|
28
|
+
|
27
29
|
Nakal.device_name = "samsung_galaxy_s3"
|
28
30
|
|
29
31
|
and then put this line in your code where you want comparison to begin:
|
30
32
|
|
31
|
-
nakal_execute("current_screen_name")
|
33
|
+
diff = nakal_execute("current_screen_name")
|
32
34
|
|
33
35
|
|
34
|
-
While executing, pass env variable NAKAL_MODE=build to build the baseline images
|
36
|
+
While executing first time, pass env variable NAKAL_MODE=build to build the baseline images
|
35
37
|
|
36
38
|
once baseline is built, next execution onwards, start using environment variable NAKAL_MODE=compare to compare against baseline
|
37
39
|
|
38
|
-
|
40
|
+
|
41
|
+
For cropping the notification bar OR scroll bar, create a config/nakal.yml file in execution directory
|
42
|
+
|
43
|
+
eg:
|
44
|
+
|
45
|
+
put these contents in your nakal.yml file inside config/nakal.yml
|
46
|
+
|
47
|
+
samsung_galaxy_s3:
|
48
|
+
|
49
|
+
top: 50
|
50
|
+
|
51
|
+
right: 18
|
52
|
+
|
53
|
+
left: 0
|
54
|
+
|
55
|
+
bottom: 0
|
56
|
+
|
57
|
+
nexus7:
|
58
|
+
|
59
|
+
top: 74
|
60
|
+
|
61
|
+
right: 20
|
62
|
+
|
63
|
+
left: 0
|
64
|
+
|
65
|
+
bottom: 0
|
66
|
+
|
39
67
|
|
40
68
|
## Contributing
|
41
69
|
|
data/lib/nakal/base_screen.rb
CHANGED
@@ -6,14 +6,9 @@ module Nakal
|
|
6
6
|
|
7
7
|
def initialize file_name, mode = :load, image = nil
|
8
8
|
@name = file_name
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
elsif mode.eql?(:load)
|
13
|
-
load_image_from_file
|
14
|
-
else
|
15
|
-
@image=image
|
16
|
-
end
|
9
|
+
@image = image
|
10
|
+
capture if mode.eql?(:capture)
|
11
|
+
image.nil? ? @image = Magick::Image.read("#{Nakal.image_location}/#{@name}.png")[0] : @image=image
|
17
12
|
end
|
18
13
|
|
19
14
|
def strip
|
@@ -45,12 +40,6 @@ module Nakal
|
|
45
40
|
@image.write("#{Nakal.image_location}/#{@name}.png")
|
46
41
|
end
|
47
42
|
|
48
|
-
private
|
49
|
-
|
50
|
-
def load_image_from_file
|
51
|
-
@image = Magick::Image.read("#{Nakal.image_location}/#{@name}.png")[0]
|
52
|
-
end
|
53
|
-
|
54
43
|
end
|
55
44
|
end
|
56
45
|
end
|
data/lib/nakal/dsl.rb
CHANGED
data/lib/nakal/ios/screen.rb
CHANGED
@@ -4,10 +4,22 @@ module Nakal
|
|
4
4
|
|
5
5
|
private
|
6
6
|
|
7
|
+
CAPTURE_SCRIPT = 'osascript <<EOF
|
8
|
+
tell application "iOS Simulator"
|
9
|
+
activate
|
10
|
+
delay 1
|
11
|
+
tell application "System Events" to keystroke "s" using {command down}
|
12
|
+
end tell
|
13
|
+
EOF'
|
14
|
+
|
7
15
|
def capture
|
8
|
-
|
16
|
+
`#{CAPTURE_SCRIPT}`
|
17
|
+
sleep 0.5
|
18
|
+
latest_file = Dir.glob(File.expand_path('~/Desktop/iOS\\ Simulator\\ Screen\\ Shot*')).max_by { |f| File.mtime(f) }
|
19
|
+
`mv #{Shellwords.shellescape(latest_file)} #{Nakal.image_location}`
|
20
|
+
`mv #{Nakal.image_location}/iOS\\ Simulator\\ Screen\\ Shot* #{Nakal.image_location}/#{@name}.png`
|
9
21
|
end
|
10
22
|
|
11
23
|
end
|
12
24
|
end
|
13
|
-
end
|
25
|
+
end
|
data/lib/nakal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nakal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajdeep
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|