flick 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1416274c61ae0bf9e0ac1bb3d0a4d7ca830db636
4
- data.tar.gz: f2eab5fc3f3d4d6a7ce8b04fa9a14a3babc822ed
3
+ metadata.gz: 60d13cf15fcb434c0b80b607bb2c2738ccbb75bb
4
+ data.tar.gz: c42fade179a5c818b199265388bc2461c65fbc64
5
5
  SHA512:
6
- metadata.gz: 2351634c48f1212af1312623b58080a1d260b8e15f080047b6420dae84e4fde1ebd6d8ed55c24f11da56a017ffe4067ae15026962839086b7cae52c7ed3be46a
7
- data.tar.gz: b3aa9011da22783a3b2183f6db18afdfdbdc8b682cce1ef5dfc61e899029712f8efde62eba58929877c9046b855a327af2be4331835ace7a5194b699fd96554a
6
+ metadata.gz: 6cede6e57d25d167777303ca2e60b70b71407ffe98f7c436816999356fd562fef50426928e9a0c3cbea40a7486ef4b34c4bc7ec5291484da69c6debd568c8c59
7
+ data.tar.gz: 145947a4e3c90f17505c5a7ad88c5945c1dd76c6d5a7c1439a781bd6e83e0ffe4f5acc882d3e87d64cbbc345203494b8e4adb4136968c37694a6c4c5fd038d01
data/README.md CHANGED
@@ -90,7 +90,8 @@ Usage:
90
90
  manager Manage apps on devices
91
91
  screenshot Take a screenshot
92
92
  video Record video
93
- vitals Android Only! Get apps and device vitals - App Memory Used, App CPU %. System Stats: (User, System, IQW, IRQ)
93
+ vitals Android Only! Get apps and device vitals - App Memory Used, App CPU %. System Stats: (User, System, IQW, IRQ)
94
+ applitools Validte image with Applitools
94
95
 
95
96
  GLOBAL OPTIONS:
96
97
 
@@ -132,6 +133,9 @@ Usage:
132
133
  $ flick vitals --help
133
134
  $ flick vitals -p android -n com.awsome-package.name
134
135
 
136
+ $ flick applitools --help
137
+ $ flick flick applitools -p android --appName Twitter --testName Messages
138
+
135
139
  ##Demo
136
140
  <img src="https://www.dropbox.com/s/9be37gc1c2dlxa6/flick-demo.gif?raw=1" width="600">
137
141
 
data/bin/flick CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative '../lib/flick'
3
3
  require 'commander/import'
4
+ require 'digest'
4
5
 
5
- program :version, '0.4.3'
6
+ program :version, '0.4.4'
6
7
  program :description, 'A CLI to capture screenshots, video, logs, and device info for Android (Devices & Emulators) and iOS (Devices).'
7
8
 
8
9
  command :video do |c|
@@ -50,6 +51,62 @@ command :screenshot do |c|
50
51
  end
51
52
  end
52
53
 
54
+ command :applitools do |c|
55
+ c.syntax = 'flick applitools [options]'
56
+ c.summary = 'Validte image with Applitools'
57
+ c.description = c.summary
58
+ c.example 'description', "flick applitools -p android --appName Twitter --testName Messages"
59
+ c.option '-p', '--platform PLATFORM', String, 'Set platform: android or ios'
60
+ c.option '-u', '--udid UDID', String, 'Set device UDID.'
61
+ c.option '-o', '--outdir OUTDIR', String, "Set output directory. Default: #{Dir.pwd}"
62
+ c.option '-k', '--keep', "Keep image after capture. Default: false"
63
+ c.option '--appName appName', String, "Set your App Name. Example: --appName Twitter. Default is the platform value"
64
+ c.option '--testName testName', String, "Set Test Name. Example: --testName 'Home View'"
65
+ c.option '--autoSave autoSave', String, "Automatically save failed tests."
66
+ c.option '--apiKey apiKey', String, "Applitools API Key"
67
+ c.option '--showLogs showLogs', String, "Display Applitools Logs"
68
+ c.option '--matchLevel matchLevel', String, "Set match level to one of 'strict, layout, or content'. Default: strict"
69
+ c.option '--server Server', String, "Set Applitools server url. Default: https://eyes.applitools.com"
70
+ c.option '--proxy Proxy', String, "Set proxy address"
71
+ c.option '--baseline Baseline', String, "Set your baseline name"
72
+ c.option '--batchName BatchName', String, "Set your batch (folder) name"
73
+ c.option '--batchId BatchId', String, "Set a batch ID. Flick, by default creates a unique batch ID based on the platform and appName values"
74
+ #These will be added later...
75
+ # c.option '--hostApp', String, "Set Host-app identifier for the screens under test"
76
+ # c.option '--baseline', String, "Set baseline name"
77
+ # c.option '--branch', String, "Set branch name"
78
+ # c.option '--hostOs', String, "Set OS identifier for the screens under test"
79
+ # c.option '--parentBranch', String, "Set parent branch name, optional when working with branches"
80
+ c.action do |args, options|
81
+ options.default \
82
+ :outdir => Dir.pwd,
83
+ :keep => false,
84
+ :matchLevel => 'strict',
85
+ :server => 'https://eyes.applitools.com',
86
+ :showLogs => false,
87
+ :apiKey => ENV['APPLITOOLS_API_KEY'],
88
+ :appName => options.platform,
89
+ :baseline => nil,
90
+ :batchName => options.appName,
91
+ :batchId => Digest::MD5.hexdigest("#{options.platform.downcase}-#{options.appName.downcase}").scan(/\d/).join('')
92
+
93
+ [:testName, :apiKey].each do |o|
94
+ if options.default[o].nil?
95
+ puts "\n--#{o.to_s} is required... Please set it before running!\n".red
96
+ abort
97
+ end
98
+ end
99
+
100
+ match_levels = ['strict', 'layout', 'content']
101
+ unless match_levels.include? options.matchLevel
102
+ puts "You entered an incorrect match level. Please choose any of these: #{match_levels}"
103
+ abort
104
+ end
105
+
106
+ Applitoolz.new(options.default).upload_to_applitools
107
+ end
108
+ end
109
+
53
110
  command :log do |c|
54
111
  c.syntax = 'flick log [options]'
55
112
  c.summary = 'Get device log output'
@@ -30,12 +30,14 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "rspec", '~> 3.4', '>= 3.4.0'
31
31
  spec.add_dependency "parallel", '~> 1.6', '>= 1.6.2'
32
32
  spec.add_dependency "colorize", "~> 0.8.1"
33
- spec.add_dependency "commander", '~> 4.4', '>= 4.4.0'
34
- spec.add_dependency "json", '~> 1.8', '>= 1.8.3'
33
+ spec.add_dependency "commander"
34
+ spec.add_dependency "json"
35
35
  spec.add_dependency "wannabe_bool", "~> 0.5.0"
36
36
  spec.add_dependency "awesome_print", '~> 1.6', '>= 1.6.1'
37
37
  spec.add_dependency "os", "~> 0.9.6"
38
38
  spec.add_dependency "sys-proctable", '~> 1.1', '>= 1.1.1'
39
39
  spec.add_dependency "apktools", '~> 0.7.1', '>= 0.7.1'
40
40
  spec.add_dependency "ffi"
41
+ spec.add_dependency "eyes_images"
42
+ spec.add_dependency "pry"
41
43
  end
@@ -8,6 +8,13 @@ require 'tempfile'
8
8
  require 'sys/proctable'
9
9
  require 'apktools/apkxml'
10
10
  require 'open3'
11
+ require 'eyes_images'
12
+ require 'pry'
13
+ require 'openssl'
14
+ original_verbose = $VERBOSE
15
+ $VERBOSE = nil
16
+ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
17
+ $VERBOSE = original_verbose
11
18
 
12
19
  require "flick/version"
13
20
  require_relative "./flick/android"
@@ -20,4 +27,5 @@ require_relative "./flick/simple_daemon"
20
27
  require_relative "./flick/system"
21
28
  require_relative "./flick/video"
22
29
  require_relative "./flick/manager"
23
- require_relative "./flick/vitals"
30
+ require_relative "./flick/vitals"
31
+ require_relative "./flick/applitools"
@@ -0,0 +1,38 @@
1
+ require 'date'
2
+
3
+ class Applitoolz
4
+
5
+ attr_accessor :platform, :driver, :eyes, :app_name, :test_name, :keep
6
+
7
+ def initialize options
8
+ self.platform = options[:platform]
9
+ self.driver = Screenshot.new options
10
+ self.eyes = Applitools::Images::Eyes.new
11
+ eyes.api_key = options[:apiKey]
12
+ eyes.server_url = options[:server]
13
+ eyes.log_handler = Logger.new(STDOUT) if options[:showLogs]
14
+ eyes.proxy = Applitools::Connectivity::Proxy.new options[:proxy] if options[:proxy]
15
+ eyes.match_level = options[:matchLevel].downcase.to_sym
16
+ eyes.baseline_name = options[:baseline]
17
+ self.app_name = options[:appName]
18
+ self.test_name = options[:testName]
19
+ batch_info = Applitools::BatchInfo.new(options[:batchName])
20
+ batch_info.id = options[:batchId] #Date.today.to_time.to_i
21
+ eyes.batch = batch_info
22
+ self.keep = options[:keep]
23
+ end
24
+
25
+ def upload_to_applitools
26
+ image_info = driver.screenshot
27
+ eyes.test(app_name: app_name, test_name: test_name) do
28
+ eyes.check_image(image_path: image_info[:path], tag: image_info[:udid])
29
+ remove_image image_info[:path] unless keep
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def remove_image image
36
+ File.delete image if File.exists? image
37
+ end
38
+ end
@@ -5,7 +5,7 @@ class Screenshot
5
5
  def initialize options
6
6
  Flick::Checker.platform options[:platform]
7
7
  self.platform = options[:platform]
8
- case @platform
8
+ case platform
9
9
  when "ios"
10
10
  options[:todir] = options[:outdir]
11
11
  self.driver = Flick::Ios.new options
@@ -16,9 +16,15 @@ class Screenshot
16
16
  end
17
17
 
18
18
  def screenshot
19
- puts "Saving to #{driver.outdir}/#{driver.name}.png"
20
19
  driver.screenshot driver.name
21
20
  driver.pull_file "#{driver.dir_name}/#{driver.name}.png", driver.outdir if android
21
+ if File.exists? "#{driver.outdir}/#{driver.name}.png"
22
+ puts "Saved image to: #{driver.outdir}/#{driver.name}.png"
23
+ return { path: "#{driver.outdir}/#{driver.name}.png", udid: driver.udid }
24
+ else
25
+ puts "\nThere appears to be an issue capturing the #{platform} image. Run flick with --trace for more details.\n".red
26
+ abort
27
+ end
22
28
  end
23
29
 
24
30
  private
@@ -1,3 +1,3 @@
1
1
  module Flick
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-30 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,42 +96,30 @@ dependencies:
96
96
  name: commander
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
100
- - !ruby/object:Gem::Version
101
- version: '4.4'
102
99
  - - ">="
103
100
  - !ruby/object:Gem::Version
104
- version: 4.4.0
101
+ version: '0'
105
102
  type: :runtime
106
103
  prerelease: false
107
104
  version_requirements: !ruby/object:Gem::Requirement
108
105
  requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '4.4'
112
106
  - - ">="
113
107
  - !ruby/object:Gem::Version
114
- version: 4.4.0
108
+ version: '0'
115
109
  - !ruby/object:Gem::Dependency
116
110
  name: json
117
111
  requirement: !ruby/object:Gem::Requirement
118
112
  requirements:
119
- - - "~>"
120
- - !ruby/object:Gem::Version
121
- version: '1.8'
122
113
  - - ">="
123
114
  - !ruby/object:Gem::Version
124
- version: 1.8.3
115
+ version: '0'
125
116
  type: :runtime
126
117
  prerelease: false
127
118
  version_requirements: !ruby/object:Gem::Requirement
128
119
  requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '1.8'
132
120
  - - ">="
133
121
  - !ruby/object:Gem::Version
134
- version: 1.8.3
122
+ version: '0'
135
123
  - !ruby/object:Gem::Dependency
136
124
  name: wannabe_bool
137
125
  requirement: !ruby/object:Gem::Requirement
@@ -234,6 +222,34 @@ dependencies:
234
222
  - - ">="
235
223
  - !ruby/object:Gem::Version
236
224
  version: '0'
225
+ - !ruby/object:Gem::Dependency
226
+ name: eyes_images
227
+ requirement: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ version: '0'
232
+ type: :runtime
233
+ prerelease: false
234
+ version_requirements: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - ">="
237
+ - !ruby/object:Gem::Version
238
+ version: '0'
239
+ - !ruby/object:Gem::Dependency
240
+ name: pry
241
+ requirement: !ruby/object:Gem::Requirement
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :runtime
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: '0'
237
253
  description: A CLI with helpful QA tools for iOS and Android from the command line
238
254
  email:
239
255
  - justin.ison@gmail.com
@@ -256,6 +272,7 @@ files:
256
272
  - flick.gemspec
257
273
  - lib/flick.rb
258
274
  - lib/flick/android.rb
275
+ - lib/flick/applitools.rb
259
276
  - lib/flick/checker.rb
260
277
  - lib/flick/info.rb
261
278
  - lib/flick/ios.rb