gless 1.6.1 → 2.0.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: df25d32ad9e354c810d6a689936098b9888bbea0
4
- data.tar.gz: fcc4e33ba6276cdd29222f8a538ff82950371b1a
3
+ metadata.gz: 8b15a2376bbf1adff76a9ac467fee021e9f05e85
4
+ data.tar.gz: 3dc288ba9043ca99d99d434a1602364c4ed243e3
5
5
  SHA512:
6
- metadata.gz: 253e1f0db170c8c6a583aec787c844b579de50b06e4ee1b49679b1c7984bbad8a46a5eb1ed98002e237ea2431b7b777d6dcc8917bf98243cac7eade88d65ffb4
7
- data.tar.gz: 4d8b8a4029fe9ce45262c4eb3317e2750b2f53cbaf367b331c2cda8fd324ee13f378a3bc2f0c64f192df2a4a024121a5e59f8766b9797dbf834935bed28f8544
6
+ metadata.gz: a9b8e9ce610408ddd67b669ec47c44a6b1340b5ab01ce886bcaa168cf64b29c3edc2306894daf5041708ee225ff4695f6e20b6edcb9351d76c35979f891d8216
7
+ data.tar.gz: 75169a727bdbe88082f88b4bebf8c1263765fc36bc6145095c4bf9f42710999fa3103544402f75a81e3d43a3dced7ccd92f3662651eb957869fd7935751e1c4b
data/Changelog.txt CHANGED
@@ -1,9 +1,27 @@
1
1
  - 1.1.0: 29 Jan 2013: By default, "element"s now ignore non-visible
2
- elements on the page; use { :invisible => true } to get the old
3
- behaviour.
2
+ elements on the page; use { :invisible => true } to get the
3
+ old behaviour.
4
4
  - 1.2.0: 10 Jun 2013: Changes by bairyn. Added caching, finding
5
- based on parent element, and block validators.
5
+ based on parent element, and block validators.
6
6
  - 1.3.0: 8 Aug 2013: Detect and work around errors caused by incorrect caching,
7
- and add support for element arguments, evaluating elements under new parents,
8
- finding based on children, and the :unique option to ensure only one element
9
- matches a specification.
7
+ and add support for element arguments, evaluating elements
8
+ under new parents, finding based on children, and the
9
+ :unique option to ensure only one element matches a
10
+ specification.
11
+ - 1.3.1: 19 Aug 2013: Typo fix.
12
+ - 1.4.0: 9 Sep 2013: Support for Sauce Labs related browser
13
+ capabilities via options under the :browser option in the
14
+ config file.
15
+ - 1.4.1: 11 Sep 2013: More Sauce-specific options.
16
+ - 1.4.2: 13 Sep 2013: Specified a license.
17
+ - 1.5.0: 21 Sep 2013: Better error reporting, deep_merge, click_once
18
+ with change_pages
19
+ - 1.5.1: 25 Oct 2013: Support for no config file.
20
+ - 1.5.2: 23 Feb 2014: Don't depend on Ruby's class creation order.
21
+ - 1.6.0: 3 Mar 2014: Allow the replay log to be completely disabled.
22
+ - 1.6.1: 3 Mar 2014: Let the logger decide want to log, instead of
23
+ always checking the config state.
24
+ - 2.0.0: 27 Mar 2014: Non-backwards-compatible changes to handling
25
+ of both extra browser capabilities and tags. The former is
26
+ now under :browser => :extras in the config file, and the
27
+ latter under :tag in the config file.
@@ -7,8 +7,7 @@ World(RSpec::Expectations)
7
7
  Before do
8
8
  require 'gless'
9
9
 
10
- # FIXME: the tag entry here will have to change for parallel runs.
11
- @logger, @config, @browser = Gless.setup( :test )
10
+ @logger, @config, @browser = Gless.setup()
12
11
 
13
12
  if @config.get :global, :debug
14
13
  require 'debugger'
@@ -6,13 +6,20 @@
6
6
  :type: remote # Local or remote
7
7
  :browser: chrome # Which browser to use; "ie", "chrome", and "firefox" are definitely valid, there may be others
8
8
  :port: 4444 # If remote, port to connect to the selenium server, otherwise ignored
9
- # These options would normally only be used with something like
10
- # SauceLabs
9
+ # These options would normally only be used with something like SauceLabs
10
+ #
11
11
  # :url: "http://rlpowell:[snip]@ondemand.saucelabs.com:80/wd/hub" # The URL Sauce gives you
12
- # :version: 27 # The browser version to use
13
- # :platform: 'Windows 7' # The OS to use
14
- # :idle_timeout: 600 # Sauce specific
15
- # :max_duration: 5400 # Sauce specific
12
+ #
13
+ # "extras" is where special things are defined to add to the
14
+ # browser capabilities list; used for stuff like Sauce
15
+ # parameters.
16
+ #
17
+ # :extras:
18
+ # :version: 27 # The browser version to use
19
+ # :platform: 'Windows 7' # The OS to use
20
+ # :"idle-timeout": 600 # Sauce specific
21
+ # :"max-duration": 5400 # Sauce specific
22
+ # :name: "default job name" # Sauce specific
16
23
  :verbose: false # Whether to engage in more verbose/info level logging
17
24
  :debug: false # Whether to engage in debug logging
18
25
  :replay: false # Whether to create a replay log, which shows html for each step of operations
@@ -21,3 +28,8 @@
21
28
  :screenshots: false # Whether, if debugging is on, to create screenshots as part of the replay log
22
29
  :thumbnails: false # Whether, if screenshots are on, to create small-ish "thumbnail" pictures on the replay page; requires the imagemagick system package and the mini_magick gem
23
30
  :cache: false # Whether, by default, to cache elements, significantly improving performance. For individual elements, caching can be disabled by adding ":cache => false" to the element specifier.
31
+
32
+ # A short name used in creating log lines and writing out the
33
+ # replay log and so on. Only really relevant if multiple runs are
34
+ # happening at once.
35
+ :tag: "notag"
data/lib/gless.rb CHANGED
@@ -6,17 +6,13 @@
6
6
  # project.
7
7
  module Gless
8
8
  # The current version number.
9
- VERSION = '1.6.1'
9
+ VERSION = '2.0.0'
10
10
 
11
11
  # Sets up the config, logger and browser instances, the ordering
12
12
  # of which is slightly tricky. If a block is given, the config, after being
13
13
  # initialized from the config file, is passed to the block, which should
14
14
  # return the new, updated config.
15
15
  #
16
- # @param [String] tag A short name used in creating log lines and
17
- # writing out the replay log and so on. Only really relevant if
18
- # multiple runs are happening at once.
19
- #
20
16
  # @param [Hash] hash Defaults to +nil+, which is ignored. If
21
17
  # present, this hash is used intead of reading a config file; the
22
18
  # config file is totally ignored in this case.
@@ -25,13 +21,13 @@ module Gless
25
21
  # optional block should return an updated config if given.
26
22
  #
27
23
  # @return [Gless::Logger, Gless::EnvConfig, Gless::Browser] logger, config, browser (in that order)
28
- def self.setup( tag, hash = nil )
24
+ def self.setup( hash = nil )
29
25
  # Create the config reading/storage object
30
26
  config = Gless::EnvConfig.new( hash )
31
27
  config = yield config if block_given?
32
28
 
33
29
  logger = Gless::Logger.new(
34
- tag,
30
+ config.get_default( "notag", :global, :tag ),
35
31
  config.get_default( false, :global, :replay ),
36
32
  config.get_default( '%{home}/public_html/watir_replay/%{tag}', :global, :replay_path )
37
33
  )
data/lib/gless/browser.rb CHANGED
@@ -19,14 +19,17 @@ module Gless
19
19
  def initialize( config, logger )
20
20
  @config = config
21
21
  @logger = logger
22
+
23
+ @logger.debug "Requested browser config: #{@config.get :global, :browser }"
24
+
22
25
  type=@config.get :global, :browser, :type
23
26
  browser=@config.get :global, :browser, :browser
24
27
  port=@config.get :global, :browser, :port
25
28
  url=@config.get_default false, :global, :browser, :url
26
- browser_version=@config.get_default '', :global, :browser, :version
27
- platform=@config.get_default :any, :global, :browser, :platform
28
- max_duration=@config.get_default 1800, :global, :browser, :max_duration
29
- idle_timeout=@config.get_default 90, :global, :browser, :idle_timeout
29
+ extra_capabilities=@config.get_default false, :global, :browser, :extras
30
+ if ! extra_capabilities
31
+ extra_capabilities = Hash.new
32
+ end
30
33
 
31
34
  if browser =~ %r{^\s*ie\s*$} or browser =~ %r{^\s*internet\s*_?\s*explorer\s*$}
32
35
  browser = 'internet explorer'
@@ -41,11 +44,13 @@ module Gless
41
44
  :javascript_enabled=>true,
42
45
  :css_selectors_enabled=>true,
43
46
  :takes_screenshot=>true,
44
- :'max-duration' => max_duration,
45
- :'idle-timeout' => idle_timeout,
46
- :version => browser_version,
47
- :platform => platform
48
47
  )
48
+ # Load in any other stuff the user asked for
49
+ @logger.debug "Requested extra capabilities: #{extra_capabilities.inspect}"
50
+ extra_capabilities.each do |key, value|
51
+ @logger.debug "Adding capability #{key} with value #{value}"
52
+ capabilities[key] = value
53
+ end
49
54
 
50
55
  if url
51
56
  @logger.debug "Launching with custom url #{url}"
data/lib/gless/config.rb CHANGED
@@ -103,6 +103,9 @@ module Gless
103
103
  private
104
104
 
105
105
  def set_root root, value, *indices
106
+ if root[indices[0]] == nil
107
+ root[indices[0]] = Hash.new
108
+ end
106
109
  if indices.length > 1
107
110
  set_root root[indices[0]], value, *indices[1..-1]
108
111
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Lee Powell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-03 00:00:00.000000000 Z
12
+ date: 2014-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec