webdrone 1.5.0 → 1.6.0

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: 9a6886483cc7bf3eeef28050d029da3565181361
4
- data.tar.gz: b37e7cfefcda6f08fcfb26191b4c4fc8fa197c83
3
+ metadata.gz: 5cdf62a2cce8db573d203579df27407f5667783e
4
+ data.tar.gz: 27db99313aad1c4f26b0f863cdd1be81d35f9170
5
5
  SHA512:
6
- metadata.gz: 878371a3882ce841051ade25fe9f2a9f3191a14cd0257201772a45c0bd9424571547494496a1e6c5c98ca522707af720f1ccc6d51bd51ab567e74f17956ccb3b
7
- data.tar.gz: 36cab00a6abba640a62f860433812e281e7ab0d897523c95e8267b89a592c9f8a9fc0a8a44220f10ca8f206855ac7e8fa77bd08862d3ddb9693b4a921f910cf9
6
+ metadata.gz: 140491cb3a032217fee14d222f1fc34301d045e84b1d0d8e9e3929644d61e908bbfdf1e73ec36b78c7a4b5556f0d75f163be8687a4263d7e38fb66cbac7880dc
7
+ data.tar.gz: a3bbd965994875b3f8b66f8b7464022f609ccefca77461a4e36ebb7a378ed0b92e1c7131a5976dd03f3aa8668873ee9738a18c82dc66e110783a9ee1c406e199
data/CHANGELOG.md CHANGED
@@ -4,6 +4,47 @@ New features are summarized here.
4
4
 
5
5
 
6
6
 
7
+ ## v1.6.0 - 2017-01-15
8
+ ### Added
9
+ - Added `mark:` an `shot:` parameters to `a0.clic`. The following code will mark the element, take a screenshot and then click the element.
10
+ ```
11
+ a0.clic.on 'something', mark: true, shot: true
12
+ ```
13
+ ### Changed
14
+ - Changed default to true for `quit_at_exit` in `Webdrone.create`.
15
+ - Setting default of 30 seconds to timeout parameter in `Webdrone.create`. This means the timeout is an optional parameter, for ex:
16
+ ```ruby
17
+ # Before
18
+ a0 = Webdrone.create # <= ArgumentError: missing keyword: timeout
19
+ a0 = Webdrone.create timeout: 10 # setting timeout to 10 seconds
20
+
21
+ # Now
22
+ a0 = Webdrone.create # default timeout of 30 seconds
23
+ a0 = Webdrone.create timeout: 10 # overriding timeout to 10 seconds
24
+ ```
25
+ - Renamed `sleep` to `delay` in `a0.mark`, for example:
26
+ ```ruby
27
+ # Before
28
+ export WEBDRONE_MARK_TIMES=1
29
+ export WEBDRONE_MARK_SLEEP=0
30
+ a0.mark.on 'something'
31
+
32
+ a0.mark.on 'something', times: 2, sleep: 1
33
+
34
+ # Now
35
+ export WEBDRONE_MARK_TIMES=1
36
+ export WEBDRONE_MARK_DELAY=0
37
+ a0.mark.on 'something'
38
+
39
+ a0.mark.on 'something', times: 2, delay: 1
40
+ ```
41
+ ### Fixed
42
+ - Firefox using geckodriver is not supporting window resizing/positioning :-(. The following error will be ignored in the meantime:
43
+ ```
44
+ Selenium::WebDriver::Error::UnsupportedOperationError: The W3C standard does not currently support setting the Window Position"
45
+ ```
46
+
47
+
7
48
  ## v1.5.0 - 2016-08-11
8
49
  ### Added
9
50
  - Added platform info for Webdrone (ruby) on a0_webdrone_trace.csv file
@@ -58,7 +58,7 @@ module Webdrone
58
58
  end
59
59
  end
60
60
 
61
- def initialize(browser: 'firefox', create_outdir: true, outdir: nil, timeout:, developer: false, logger: true, quit_at_exit: false, maximize: true, error: :raise_report, win_x: nil, win_y: nil, win_w: nil, win_h: nil, use_env: true, chrome_prefs: nil, firefox_profile: nil, remote_url: nil)
61
+ def initialize(browser: 'firefox', create_outdir: true, outdir: nil, timeout: 30, developer: false, logger: true, quit_at_exit: true, maximize: true, error: :raise_report, win_x: nil, win_y: nil, win_w: nil, win_h: nil, use_env: true, chrome_prefs: nil, firefox_profile: nil, remote_url: nil)
62
62
  env_update(Kernel.binding) if use_env
63
63
  if create_outdir or outdir
64
64
  outdir ||= File.join("webdrone_output", Time.new.strftime('%Y%m%d_%H%M%S'))
@@ -111,8 +111,12 @@ module Webdrone
111
111
  else
112
112
  win_h ||= h
113
113
  end
114
- @driver.manage.window.position= Selenium::WebDriver::Point.new win_x, win_y
115
- @driver.manage.window.resize_to(win_w, win_h)
114
+ begin
115
+ @driver.manage.window.position = Selenium::WebDriver::Point.new win_x, win_y
116
+ @driver.manage.window.resize_to(win_w, win_h)
117
+ rescue => e
118
+ puts "Ignoring error on window position/resize: #{e}"
119
+ end
116
120
  else
117
121
  self.maximize if maximize
118
122
  end
data/lib/webdrone/clic.rb CHANGED
@@ -12,8 +12,13 @@ module Webdrone
12
12
  @a0 = a0
13
13
  end
14
14
 
15
- def clic(text, n: 1, all: false, visible: true)
15
+ def clic(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil, mark: false)
16
16
  item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
17
+ if mark
18
+ @a0.mark.mark_item(item, color: color, times: times, delay: delay, shot: shot, text: text)
19
+ elsif shot
20
+ @a0.shot.screen shot.is_a?(String) ? shot : text
21
+ end
17
22
  if item.is_a? Array
18
23
  item.each(&:click)
19
24
  else
data/lib/webdrone/form.rb CHANGED
@@ -114,8 +114,8 @@ module Webdrone
114
114
  Webdrone.report_error(@a0, exception)
115
115
  end
116
116
 
117
- def mark(key, n: 1, visible: true, color: '#af1616', times: nil, sleep: nil, shot: nil)
118
- @a0.mark.mark_item self.find_item(key, n: n, visible: visible), color: color, times: times, sleep: sleep, shot: shot
117
+ def mark(key, n: 1, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil)
118
+ @a0.mark.mark_item self.find_item(key, n: n, visible: visible), color: color, times: times, delay: delay, shot: shot
119
119
  rescue => exception
120
120
  Webdrone.report_error(@a0, exception)
121
121
  end
data/lib/webdrone/mark.rb CHANGED
@@ -6,17 +6,17 @@ module Webdrone
6
6
  end
7
7
 
8
8
  class Mark
9
- attr_accessor :a0, :default_times, :default_sleep
9
+ attr_accessor :a0, :default_times, :default_delay
10
10
 
11
11
  def initialize(a0)
12
12
  @a0 = a0
13
13
  @default_times = ENV['WEBDRONE_MARK_TIMES'] || 3
14
- @default_sleep = ENV['WEBDRONE_MARK_SLEEP'] || 0.05
14
+ @default_delay = ENV['WEBDRONE_MARK_DELAY'] || 0.05
15
15
  end
16
16
 
17
- def mark(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, sleep: nil, shot: nil)
17
+ def mark(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil)
18
18
  item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
19
- mark_item item, color: color, times: times, sleep: sleep, shot: shot, text: text
19
+ mark_item item, color: color, times: times, delay: delay, shot: shot, text: text
20
20
  rescue => exception
21
21
  Webdrone.report_error(@a0, exception)
22
22
  end
@@ -29,16 +29,16 @@ module Webdrone
29
29
  alias_method :option, :mark
30
30
  alias_method :xpath, :mark
31
31
 
32
- def mark_item(item, color: '#af1616', times: nil, sleep: nil, shot: nil, text: nil)
32
+ def mark_item(item, color: '#af1616', times: nil, delay: nil, shot: nil, text: nil)
33
33
  times ||= @default_times
34
- sleep ||= @default_sleep
34
+ delay ||= @default_delay
35
35
  times.times do
36
36
  mark_item_border item, 'white'
37
- sleep sleep
37
+ sleep delay
38
38
  mark_item_border item, 'black'
39
- sleep sleep
39
+ sleep delay
40
40
  mark_item_border item, color
41
- sleep sleep
41
+ sleep delay
42
42
  end
43
43
  @a0.shot.screen shot.is_a?(String) ? shot : text if shot
44
44
  item
@@ -1,3 +1,3 @@
1
1
  module Webdrone
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdrone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldrin Martoq
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2017-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler