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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b58e8fd157ff12dbc901782576a6c6712dbff0b
4
- data.tar.gz: f2f11543cbf0490454a7237a36d6060e1068859b
3
+ metadata.gz: ae2f95fd7f77548345f830f2648e3cc539d4e14c
4
+ data.tar.gz: c376aa9408cd1742d7bfd0776cc5d9177ccab08f
5
5
  SHA512:
6
- metadata.gz: f8b03d49e871bb584525fa755ee0e73399eafef017c780292c623d557b807c3525ea2085825fdca66576fa31cfea2f83eca532052878d761816f808aa75549f1
7
- data.tar.gz: 4b5f096c624c6ce67ccec04d3c7f05e5b0704719679ec4be00ce923beee9ef5f360b0fe3449cd9def43050b0c548f544c862960199fb5d3c515fb04c63f5a378
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
- This is currently beta and implemented for android only. iOs is work in progress
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
 
@@ -6,14 +6,9 @@ module Nakal
6
6
 
7
7
  def initialize file_name, mode = :load, image = nil
8
8
  @name = file_name
9
- if mode.eql?(:capture)
10
- capture
11
- load_image_from_file
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
@@ -10,7 +10,6 @@ module Nakal
10
10
  if diff_metric==0
11
11
  current_screen.delete!
12
12
  else
13
- p "difference = #{diff_metric}"
14
13
  diff_screen.save
15
14
  Nakal.diff_screens << image_file_name
16
15
  embed_screenshots image_file_name if Nakal.embed_screenshot == true
@@ -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
- raise "******** please implement me! ********"
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
@@ -1,3 +1,3 @@
1
1
  module Nakal
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-23 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rmagick