automation_helpers 4.0 → 4.1
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/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/automation_helpers/drivers/v4/browserstack.rb +1 -3
- data/lib/automation_helpers/drivers/v4/capabilities.rb +1 -4
- data/lib/automation_helpers/drivers/v4/local.rb +0 -2
- data/lib/automation_helpers/drivers/v4/options.rb +4 -3
- data/lib/automation_helpers/drivers/v4/remote.rb +2 -4
- data/lib/automation_helpers/extensions/array.rb +17 -4
- data/lib/automation_helpers/extensions/string.rb +22 -7
- data/lib/automation_helpers/logger.rb +3 -0
- data/lib/automation_helpers/patches/base.rb +4 -1
- data/lib/automation_helpers/patches/capybara.rb +6 -0
- data/lib/automation_helpers/patches/parallel_cucumber.rb +5 -2
- data/lib/automation_helpers/patches/selenium_logger.rb +4 -0
- data/lib/automation_helpers/patches/selenium_manager.rb +8 -1
- data/lib/automation_helpers/patches/selenium_options.rb +9 -4
- data/lib/automation_helpers/version.rb +1 -1
- metadata +43 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a45b85e5e998a666514c866da1cc6639fa113ebe88232a70ceb979c4a2877a03
|
4
|
+
data.tar.gz: d66c6284158e939d8d268126e8fd98833316ca2cfa4a29c3afbdd8002c1aa61a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f4e92ba3f4a1bc6629d07b94e60de3b9c722f27feb0700b8fbaf9953a4177302584ec8700245a942b3a9a114ca007e05f976f0ccb34d46a3e55a20b0486856
|
7
|
+
data.tar.gz: 6039a2641fe43f4f46ac5befd0987bd259391a2da6f59e1e553de76b58ab6ad8c01bccafb0a8ae49079036290da4de0d8571a8fb83549fa36530ab8902da3bcd
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Either require all of the extensions required, or require individual bits and pi
|
|
34
34
|
```
|
35
35
|
$ bundle
|
36
36
|
# Code anything relevant - Add tests for each public method!
|
37
|
-
$
|
37
|
+
$ rspec && rubocop
|
38
38
|
# Ensure it's all green! Then commit and push
|
39
39
|
```
|
40
40
|
|
@@ -9,11 +9,9 @@ require 'automation_helpers/drivers/v4/options'
|
|
9
9
|
module AutomationHelpers
|
10
10
|
module Drivers
|
11
11
|
module V4
|
12
|
-
#
|
13
|
-
# {AutomationHelpers::Drivers::V4::Browserstack}
|
14
12
|
#
|
15
13
|
# The Browserstack Driver that will connect to a hosted grid
|
16
|
-
#
|
14
|
+
# This requires a series of pre-set values to be passed in
|
17
15
|
#
|
18
16
|
class Browserstack
|
19
17
|
attr_reader :browser, :browserstack_options, :device_options
|
@@ -6,10 +6,7 @@ module AutomationHelpers
|
|
6
6
|
module Drivers
|
7
7
|
module V4
|
8
8
|
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
# The Capabilities object that will be used to instantiate whatever driver you
|
12
|
-
# are configuring
|
9
|
+
# The Capabilities object that will be used to instantiate whatever driver you are configuring
|
13
10
|
#
|
14
11
|
class Capabilities
|
15
12
|
class << self
|
@@ -5,12 +5,13 @@ require 'selenium/webdriver'
|
|
5
5
|
module AutomationHelpers
|
6
6
|
module Drivers
|
7
7
|
module V4
|
8
|
-
#
|
9
|
-
# {AutomationHelpers::Drivers::V4::Options}
|
10
8
|
#
|
11
9
|
# The Options object that will be used to instantiate whatever driver you
|
12
10
|
# are configuring
|
13
11
|
#
|
12
|
+
# #### Initial setup options
|
13
|
+
#
|
14
|
+
# - **ENV["HEADLESS"]** (optional) - Whether you want your browser to run headless or not
|
14
15
|
class Options
|
15
16
|
class << self
|
16
17
|
# @return [Selenium::Webdriver::Options]
|
@@ -43,7 +44,7 @@ module AutomationHelpers
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def headless?
|
46
|
-
ENV
|
47
|
+
ENV.fetch('HEADLESS', 'false') == 'true'
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
@@ -6,11 +6,9 @@ require 'automation_helpers/drivers/v4/options'
|
|
6
6
|
module AutomationHelpers
|
7
7
|
module Drivers
|
8
8
|
module V4
|
9
|
-
#
|
10
|
-
# {AutomationHelpers::Drivers::V4::Remote}
|
11
9
|
#
|
12
10
|
# The Remote Driver that will connect to a dockerised self-hosted grid
|
13
|
-
#
|
11
|
+
# This expects the grid to be live **and** accepting node requests
|
14
12
|
#
|
15
13
|
class Remote
|
16
14
|
attr_reader :browser
|
@@ -52,7 +50,7 @@ module AutomationHelpers
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def hub_url
|
55
|
-
ENV
|
53
|
+
ENV.fetch('HUB_URL')
|
56
54
|
end
|
57
55
|
|
58
56
|
def supported_browser?
|
@@ -2,11 +2,17 @@
|
|
2
2
|
|
3
3
|
# Additional useful methods to extend the Array class with
|
4
4
|
class Array
|
5
|
-
# @return [
|
5
|
+
# @return [Array]
|
6
6
|
#
|
7
|
-
#
|
8
|
-
|
9
|
-
|
7
|
+
# Generates an array of the english alphabet
|
8
|
+
# Accepts an input to determine what case of alphabet you want
|
9
|
+
def self.alphabet(type = :upper)
|
10
|
+
case type
|
11
|
+
when :upper; then ('A'..'Z').to_a
|
12
|
+
when :lower; then ('a'..'z').to_a
|
13
|
+
when :both; then ('a'..'z').to_a + ('A'..'Z').to_a
|
14
|
+
else raise ArgumentError, 'Invalid alphabet type. Must be :upper (default), :lower or :both'
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
# @return [Array]
|
@@ -15,4 +21,11 @@ class Array
|
|
15
21
|
def non_uniq
|
16
22
|
tally.select { |_key, count| count > 1 }.map(&:first)
|
17
23
|
end
|
24
|
+
|
25
|
+
# @return [Boolean]
|
26
|
+
#
|
27
|
+
# Test whether an array is wholly unique
|
28
|
+
def uniq?
|
29
|
+
uniq == self
|
30
|
+
end
|
18
31
|
end
|
@@ -4,7 +4,15 @@
|
|
4
4
|
class String
|
5
5
|
# @return [String]
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# Generates a single random letter from an array of the english alphabet
|
8
|
+
# Accepts an input to determine what case of alphabet you want
|
9
|
+
def self.alphabet_char(type = :upper)
|
10
|
+
Array.alphabet(type).sample
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
#
|
15
|
+
# Converts a regular string name into it's pascalized format
|
8
16
|
# This can then be used to generate a ClassName
|
9
17
|
def pascalize
|
10
18
|
split('_').map(&:capitalize).join
|
@@ -12,7 +20,15 @@ class String
|
|
12
20
|
|
13
21
|
# @return [String]
|
14
22
|
#
|
15
|
-
#
|
23
|
+
# Sanitize and convert every individual whitespace character to
|
24
|
+
# a regular space character (Does not sanitize newlines)
|
25
|
+
def sanitize_whitespace
|
26
|
+
gsub(/[ \t\r\f\u00A0]/, ' ')
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
#
|
31
|
+
# Converts a regular string into a snake cased format
|
16
32
|
# Will sanitize out some characters (Designed for titles)
|
17
33
|
def snake_case
|
18
34
|
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
@@ -24,11 +40,10 @@ class String
|
|
24
40
|
.downcase
|
25
41
|
end
|
26
42
|
|
27
|
-
# @return [
|
43
|
+
# @return [Boolean]
|
28
44
|
#
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
gsub(/[ \t\r\f\u00A0]/, ' ')
|
45
|
+
# Cast any string to true or false
|
46
|
+
def to_bool
|
47
|
+
%w[yes on true].include?(downcase)
|
33
48
|
end
|
34
49
|
end
|
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
module AutomationHelpers
|
4
4
|
module Patches
|
5
|
+
#
|
6
|
+
# @api private
|
7
|
+
#
|
5
8
|
class Base
|
6
9
|
#
|
7
|
-
# api private (Not intended to be instantiated directly!)
|
10
|
+
# api private (Not intended to be instantiated directly! Use the child classes)
|
8
11
|
#
|
9
12
|
def patch!
|
10
13
|
raise 'This is no longer supported' if prevent_usage?
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module AutomationHelpers
|
4
4
|
module Patches
|
5
|
+
#
|
6
|
+
# Fix the issue where the `#text` method doesn't normalize whitespace (Only the matchers do)
|
7
|
+
#
|
5
8
|
class Capybara < Base
|
6
9
|
private
|
7
10
|
|
@@ -18,6 +21,9 @@ module AutomationHelpers
|
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
24
|
+
#
|
25
|
+
# @api private
|
26
|
+
#
|
21
27
|
module SafariTextPatch
|
22
28
|
def text(type = nil, normalize_ws: ::Capybara.default_normalize_ws)
|
23
29
|
super(type, normalize_ws: normalize_ws)
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module AutomationHelpers
|
4
4
|
module Patches
|
5
|
+
#
|
6
|
+
# Fix the issue where the parser for parallel_tests doesn't permit the --retry flag (Or other flags at the end)
|
7
|
+
#
|
5
8
|
class ParallelCucumber < Base
|
6
9
|
private
|
7
10
|
|
@@ -17,8 +20,8 @@ module AutomationHelpers
|
|
17
20
|
::ParallelTests::Gherkin::Runner.extend RetryFlagFix
|
18
21
|
end
|
19
22
|
|
20
|
-
def
|
21
|
-
|
23
|
+
def deprecate_from
|
24
|
+
'3.12.0'
|
22
25
|
end
|
23
26
|
|
24
27
|
def prevent_usage_from
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module AutomationHelpers
|
4
4
|
module Patches
|
5
|
+
#
|
6
|
+
# Fix the issue where the Selenium Logger isn't designed to parse characters that aren't standard ASCII
|
7
|
+
# (This is an issue in the parent Net-HTTP adapter that most loggers are built on)
|
8
|
+
#
|
5
9
|
class SeleniumLogger < Base
|
6
10
|
private
|
7
11
|
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module AutomationHelpers
|
4
4
|
module Patches
|
5
|
+
#
|
6
|
+
# Fix the issue where the `#convert_cookie` API private method in selenium-webdriver doesn't include the
|
7
|
+
# 'httpOnly' property in the returned cookie hash structure
|
8
|
+
#
|
5
9
|
class SeleniumManager < Base
|
6
10
|
private
|
7
11
|
|
@@ -21,7 +25,7 @@ module AutomationHelpers
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def prevent_usage_from
|
24
|
-
'4.0.0
|
28
|
+
'4.0.0'
|
25
29
|
end
|
26
30
|
|
27
31
|
def gem_version
|
@@ -29,6 +33,9 @@ module AutomationHelpers
|
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
36
|
+
#
|
37
|
+
# @api private
|
38
|
+
#
|
32
39
|
module CookieConverter
|
33
40
|
def convert_cookie(cookie)
|
34
41
|
super(cookie)
|
@@ -2,13 +2,16 @@
|
|
2
2
|
|
3
3
|
module AutomationHelpers
|
4
4
|
module Patches
|
5
|
+
#
|
6
|
+
# Fix the issue where for some drivers selenium doesn't camelize the browser name key 'browserName' correctly
|
7
|
+
#
|
5
8
|
class SeleniumOptions < Base
|
6
9
|
def initialize(browser)
|
7
10
|
@browser = browser
|
8
11
|
super()
|
9
12
|
end
|
10
13
|
|
11
|
-
# @return [
|
14
|
+
# @return [nil || true]
|
12
15
|
#
|
13
16
|
# For SeleniumOptions we only want to run the patch when
|
14
17
|
# we are on browsers without the relevant JSON fixes in upstream
|
@@ -30,7 +33,6 @@ module AutomationHelpers
|
|
30
33
|
The issue is the driver, which is now fully W3C conformant expects `browserName`
|
31
34
|
|
32
35
|
See: https://github.com/SeleniumHQ/selenium/pull/8834 for more details/discussion including this fix
|
33
|
-
LH - Nov 2020
|
34
36
|
DESCRIPTION
|
35
37
|
end
|
36
38
|
|
@@ -42,11 +44,11 @@ module AutomationHelpers
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def deprecate_from
|
45
|
-
'4.0.0
|
47
|
+
'4.0.0'
|
46
48
|
end
|
47
49
|
|
48
50
|
def prevent_usage_from
|
49
|
-
'4.0.
|
51
|
+
'4.0.3'
|
50
52
|
end
|
51
53
|
|
52
54
|
def gem_version
|
@@ -54,6 +56,9 @@ module AutomationHelpers
|
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
59
|
+
#
|
60
|
+
# @api private
|
61
|
+
#
|
57
62
|
module CapabilitiesAsJsonFix
|
58
63
|
private
|
59
64
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automation_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '4.
|
4
|
+
version: '4.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Hill
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capybara
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
20
|
+
version: '3.30'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '3.
|
27
|
+
version: '3.30'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: cucumber
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: '5.0'
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '9'
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,21 +44,21 @@ dependencies:
|
|
44
44
|
version: '5.0'
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '9'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: faraday
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.8'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.8'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: parallel_tests
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,48 +79,70 @@ dependencies:
|
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
82
|
+
version: '3.11'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.11'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: rubocop
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.38.0
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.38.0
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: rubocop-performance
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
111
|
-
|
110
|
+
version: 1.15.0
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.15.0
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rubocop-rspec
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
112
123
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
124
|
+
version: 2.14.2
|
114
125
|
type: :development
|
115
126
|
prerelease: false
|
116
127
|
version_requirements: !ruby/object:Gem::Requirement
|
117
128
|
requirements:
|
118
|
-
- - "
|
129
|
+
- - "~>"
|
119
130
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
121
|
-
|
131
|
+
version: 2.14.2
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: selenium-webdriver
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.0'
|
139
|
+
type: :development
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
122
144
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
145
|
+
version: '4.0'
|
124
146
|
- !ruby/object:Gem::Dependency
|
125
147
|
name: webdrivers
|
126
148
|
requirement: !ruby/object:Gem::Requirement
|