saucer 1.0.0.beta2 → 1.0.0.beta3
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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +7 -14
- data/lib/saucer/asset_management.rb +4 -4
- data/lib/saucer/data_collection.rb +2 -2
- data/lib/saucer/options.rb +13 -10
- data/lib/saucer/session.rb +5 -8
- data/lib/saucer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69978c50790a42b9d2c2356767dfcde881f5782d
|
4
|
+
data.tar.gz: 3f308c2b10d311ec80a87a8575103d0dca27aafe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbfadc23496f459b2d553a79b75a69c77880322006b7318454190e953c07218af5307928533be5bac64d83fc7359e641a1fbab192ff22de506f4a522d548d4ea
|
7
|
+
data.tar.gz: 547fbf2c14eda5c642d4cd621d2eacfc4948a0f90368dcdc21ff76a030cb9601090250c609159ef576fc2781dd1f4e78a30613249965a0fc79caf8d5fa72149f
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
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
|
23
|
+
Use Saucer to start your session on Sauce Labs
|
24
24
|
```ruby
|
25
|
-
@session = Saucer::Session.
|
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.
|
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.
|
33
|
+
@session = Saucer::Session.start(options)
|
34
34
|
@driver = @session.driver
|
35
35
|
```
|
36
36
|
|
37
37
|
#### Finishing the session
|
38
|
-
|
38
|
+
Stopping the session will automatically quit the driver and send updated data to Sauce Labs
|
39
39
|
```ruby
|
40
|
-
@
|
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.
|
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
|
40
|
-
hash.map
|
39
|
+
JSON.parse(response).map { |hash|
|
40
|
+
hash.map { |key, value|
|
41
41
|
"#{key}: #{value}"
|
42
|
-
|
43
|
-
|
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
|
data/lib/saucer/options.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
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}")
|
data/lib/saucer/session.rb
CHANGED
@@ -15,7 +15,7 @@ module Saucer
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
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
|
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
|
-
|
108
|
-
|
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
|
data/lib/saucer/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|