saucer 1.0.0.beta2 → 1.0.0.beta3

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: c494261378e343b7a57914f25f848304a16fbafd
4
- data.tar.gz: fa40d7449b7a56cca8c34cdd831c381964333a0a
3
+ metadata.gz: 69978c50790a42b9d2c2356767dfcde881f5782d
4
+ data.tar.gz: 3f308c2b10d311ec80a87a8575103d0dca27aafe
5
5
  SHA512:
6
- metadata.gz: b4ee9737d38eda08c7fc76af6b56e83a32860ec9c7a12a96da49937ff04eaf90384d0e548a947478a25604e686967e328359bef3c113285f05ee4c5f5f1f69fa
7
- data.tar.gz: 5ec274b43b22d3eaeba0291c2389f81875ec5e80eb7184b07f73574887280fb656046a3ffd939081fa2f15941c83152819e808b3ab4ee50bab313a814358e6b3
6
+ metadata.gz: dbfadc23496f459b2d553a79b75a69c77880322006b7318454190e953c07218af5307928533be5bac64d83fc7359e641a1fbab192ff22de506f4a522d548d4ea
7
+ data.tar.gz: 547fbf2c14eda5c642d4cd621d2eacfc4948a0f90368dcdc21ff76a030cb9601090250c609159ef576fc2781dd1f4e78a30613249965a0fc79caf8d5fa72149f
data/.rubocop.yml CHANGED
@@ -22,6 +22,9 @@ Metrics/BlockLength:
22
22
  Style/Documentation:
23
23
  Enabled: false
24
24
 
25
+ Style/BlockDelimiters:
26
+ EnforcedStyle: braces_for_chaining
27
+
25
28
  RSpec/ExampleLength:
26
29
  Enabled: false
27
30
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 1.0.0.beta3 (2019-07-15)
2
+ * Fixed Bundler namespace
3
+ * Changed Session #begin and #end to #start and #stop
4
+
1
5
  ### 1.0.0.beta2 (2019-05-16)
2
6
  * Add iedriver version by default
3
7
 
data/README.md CHANGED
@@ -20,28 +20,24 @@ require 'saucer'
20
20
  ## Usage
21
21
 
22
22
  #### Starting the Driver
23
- Use Saucer to start your sessions
23
+ Use Saucer to start your session on Sauce Labs
24
24
  ```ruby
25
- @session = Saucer::Session.begin
25
+ @session = Saucer::Session.start
26
26
  @driver = @session.driver
27
27
  ```
28
- Optionally you can create options with various parameters to pass into `Session.begin`
28
+ Optionally you can create options with various parameters to pass into `Session.start`
29
29
  ```ruby
30
30
  options = Saucer::Options.new(browser_name: 'Safari',
31
31
  browser_version: '12.0',
32
32
  platform_name: 'macOS 10.14')
33
- @session = Saucer::Session.begin(options)
33
+ @session = Saucer::Session.start(options)
34
34
  @driver = @session.driver
35
35
  ```
36
36
 
37
37
  #### Finishing the session
38
- You can still quit the driver yourself if you'd like
38
+ Stopping the session will automatically quit the driver and send updated data to Sauce Labs
39
39
  ```ruby
40
- @driver.quit
41
- ```
42
- You get some automatic data population if you end the Session
43
- ```ruby
44
- @session.end
40
+ @session.stop
45
41
  ```
46
42
 
47
43
  #### Automatic Data Population
@@ -51,7 +47,7 @@ in the `env.rb` or `hooks.rb` file.
51
47
  ```ruby
52
48
  Before do |scenario|
53
49
  options = Saucer::Options.new(scenario: scenario)
54
- session = Saucer::Session.begin(options)
50
+ session = Saucer::Session.start(options)
55
51
  @driver = session.driver
56
52
  end
57
53
  ```
@@ -77,9 +73,6 @@ Saucer provides a number of custom methods as part of the session instance:
77
73
  @session.start_network
78
74
  @session.breakpoint
79
75
 
80
- # This will cause an error, but is available as an option
81
- session.stop
82
-
83
76
  # These things can be done after the session has ended
84
77
  @session.save_screenshots
85
78
  @session.save_log(log_type: :selenium)
@@ -36,11 +36,11 @@ module Saucer
36
36
  raise APIError, "Can not retrieve log: #{response['message']}" if JSON.parse(response).key?('message')
37
37
  rescue NoMethodError
38
38
  # Sauce Log is Special
39
- JSON.parse(response).map do |hash|
40
- hash.map do |key, value|
39
+ JSON.parse(response).map { |hash|
40
+ hash.map { |key, value|
41
41
  "#{key}: #{value}"
42
- end.join("\n")
43
- end.join("\n\n")
42
+ }.join("\n")
43
+ }.join("\n\n")
44
44
  rescue JSON::ParserError, NoMethodError
45
45
  response
46
46
  rescue APIError
@@ -5,8 +5,8 @@ module Saucer
5
5
  PAGE_OBJECTS = %w[site_prism page-object watirsome watir_drops].freeze
6
6
 
7
7
  def gems
8
- Bundler.definition.specs.map(&:name).each_with_object({}) do |gem_name, hash|
9
- name = Bundler.environment.specs.to_hash[gem_name]
8
+ ::Bundler.definition.specs.map(&:name).each_with_object({}) do |gem_name, hash|
9
+ name = ::Bundler.environment.specs.to_hash[gem_name]
10
10
  next if name.empty?
11
11
 
12
12
  hash[gem_name] = name.first.version
@@ -8,7 +8,7 @@ module Saucer
8
8
  SAUCE = %i[access_key appium_version avoid_proxy build capture_html chromedriver_version command_timeout
9
9
  crmuxdriver_version custom_data disable_popup_handler extended_debugging firefox_adapter_version
10
10
  firefox_profile_url idle_timeout iedriver_version max_duration name parent_tunnel passed prerun
11
- prevent_Requeue priority proxy_host public record_logs record_screenshots record_video
11
+ prevent_requeue priority proxy_host public record_logs record_screenshots record_video
12
12
  restricted_public_info screen_resolution selenium_version source tags time_zone tunnel_identifier
13
13
  username video_upload_on_pass].freeze
14
14
 
@@ -17,13 +17,8 @@ module Saucer
17
17
  attr_accessor :url, :scenario
18
18
  attr_reader :data_center, :remaining
19
19
 
20
- def initialize(opts)
21
- VALID.each do |option|
22
- self.class.__send__(:attr_accessor, option)
23
- next unless opts.key?(option)
24
-
25
- instance_variable_set("@#{option}", opts.delete(option))
26
- end
20
+ def initialize(opts = {})
21
+ create_instance_variables(opts)
27
22
 
28
23
  validate_credentials
29
24
  @browser_name ||= 'firefox'
@@ -33,12 +28,20 @@ module Saucer
33
28
  @iedriver_version ||= '3.141.59' if @browser_name == 'internet explorer'
34
29
 
35
30
  opts.key?(:url) ? @url = opts[:url] : self.data_center = :US_WEST
36
- @scenario = opts[:scenario] if opts.key?(:scenario)
31
+ @scenario = opts.delete(:scenario)
37
32
 
38
- # TODO: - validate that these all include `:`
39
33
  @remaining = opts
40
34
  end
41
35
 
36
+ def create_instance_variables(opts)
37
+ VALID.each do |option|
38
+ self.class.__send__(:attr_accessor, option)
39
+ next unless opts.key?(option)
40
+
41
+ instance_variable_set("@#{option}", opts.delete(option))
42
+ end
43
+ end
44
+
42
45
  def capabilities
43
46
  w3c = W3C.each_with_object({}) do |option, hash|
44
47
  value = instance_variable_get("@#{option}")
@@ -15,7 +15,7 @@ module Saucer
15
15
  end
16
16
  end
17
17
 
18
- def begin(options = nil, scenario: nil)
18
+ def start(options = nil, scenario: nil)
19
19
  options ||= Options.new(scenario: scenario)
20
20
  options.name ||= test_name if test_name
21
21
  options.build ||= build_name
@@ -57,7 +57,7 @@ module Saucer
57
57
  @options = options
58
58
  @job_id = driver.session_id
59
59
  @tags = []
60
- @scenario = options.scenario
60
+ @scenario = options.scenario if options.scenario
61
61
  @runner = self.class.runner
62
62
  @data = generate_data
63
63
 
@@ -77,7 +77,7 @@ module Saucer
77
77
  opt
78
78
  end
79
79
 
80
- def end
80
+ def stop
81
81
  self.result = runner.result unless runner.result.nil?
82
82
 
83
83
  if runner.exception
@@ -104,11 +104,8 @@ module Saucer
104
104
  end
105
105
 
106
106
  def result=(res)
107
- SauceWhisk::Jobs.change_status(@job_id, res)
108
- end
109
-
110
- def stop
111
- SauceWhisk::Jobs.stop(@job_id)
107
+ result = res == true || res.to_s.match?(/pass/i)
108
+ SauceWhisk::Jobs.change_status(@job_id, result)
112
109
  end
113
110
 
114
111
  def delete
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Saucer
4
- VERSION = '1.0.0.beta2'
4
+ VERSION = '1.0.0.beta3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-16 00:00:00.000000000 Z
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake