automation_helpers 4.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b76d24db41e2d9211d253fe3985f632bf3ac56c6f2053a0932622eff9fab3dd
4
- data.tar.gz: 794c1192df35048a0e7f8d06b0a4043a3f7a207ad5ed00cf4039ebcd389c8219
3
+ metadata.gz: a45b85e5e998a666514c866da1cc6639fa113ebe88232a70ceb979c4a2877a03
4
+ data.tar.gz: d66c6284158e939d8d268126e8fd98833316ca2cfa4a29c3afbdd8002c1aa61a
5
5
  SHA512:
6
- metadata.gz: 5eda215013852802b916764ff564844bb336f39d363fa241de875c1199f07e09b46860273741fead783abb068fefd8e734e10cd004c12720465b3719109313c5
7
- data.tar.gz: f875ff9b0c007eb72f3282222ff9fff1276561c82d3f0061bb0644b8ded894e6b8d466e127b26094379030300f080a11577e8baf96de58c3b0bf07fa9c03b0e8
6
+ metadata.gz: 97f4e92ba3f4a1bc6629d07b94e60de3b9c722f27feb0700b8fbaf9953a4177302584ec8700245a942b3a9a114ca007e05f976f0ccb34d46a3e55a20b0486856
7
+ data.tar.gz: 6039a2641fe43f4f46ac5befd0987bd259391a2da6f59e1e553de76b58ab6ad8c01bccafb0a8ae49079036290da4de0d8571a8fb83549fa36530ab8902da3bcd
@@ -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
- # Requires a series of pre-set values to be passed in
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
- # {AutomationHelpers::Drivers::V4::Capabilities}
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
@@ -7,8 +7,6 @@ require 'automation_helpers/drivers/v4/options'
7
7
  module AutomationHelpers
8
8
  module Drivers
9
9
  module V4
10
- #
11
- # {AutomationHelpers::Drivers::V4::Local}
12
10
  #
13
11
  # The Local Driver that will spin up and run on your machine (Without connecting to any grid)
14
12
  #
@@ -5,8 +5,6 @@ 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
@@ -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
- # Expects the grid to be live and accepting node requests
11
+ # This expects the grid to be live **and** accepting node requests
14
12
  #
15
13
  class Remote
16
14
  attr_reader :browser
@@ -2,11 +2,17 @@
2
2
 
3
3
  # Additional useful methods to extend the Array class with
4
4
  class Array
5
- # @return [Boolean]
5
+ # @return [Array]
6
6
  #
7
- # Test whether an array is wholly unique
8
- def uniq?
9
- uniq == self
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
- # Convert's a regular string name into it's pascalized format
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
- # Convert's a regular string into a snake cased format
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 [String]
43
+ # @return [Boolean]
28
44
  #
29
- # Sanitize and convert every individual whitespace character to
30
- # a regular space character (Does not sanitize newlines)
31
- def sanitize_whitespace
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
@@ -7,6 +7,9 @@ module AutomationHelpers
7
7
  # @api private
8
8
  #
9
9
  class Logger
10
+ #
11
+ # Generate the Logger used in the gem
12
+ #
10
13
  def self.create(output = $stdout)
11
14
  logger = ::Logger.new(output)
12
15
  logger.progname = 'Automation Helpers'
@@ -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
 
@@ -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
 
@@ -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,6 +2,9 @@
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
@@ -53,6 +56,9 @@ module AutomationHelpers
53
56
  end
54
57
  end
55
58
 
59
+ #
60
+ # @api private
61
+ #
56
62
  module CapabilitiesAsJsonFix
57
63
  private
58
64
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutomationHelpers
4
- VERSION = '4.0.1'
4
+ VERSION = '4.1'
5
5
  end
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.0.1
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: 2022-08-22 00:00:00.000000000 Z
12
+ date: 2022-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
@@ -79,76 +79,70 @@ dependencies:
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.10'
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.10'
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.35.0
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.35.0
103
+ version: 1.38.0
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rubocop-performance
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.14.3
110
+ version: 1.15.0
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.14.3
117
+ version: 1.15.0
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rubocop-rspec
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 2.11.1
124
+ version: 2.14.2
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.11.1
131
+ version: 2.14.2
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: selenium-webdriver
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: 4.0.0.beta2
139
- - - "<"
136
+ - - "~>"
140
137
  - !ruby/object:Gem::Version
141
- version: '5'
138
+ version: '4.0'
142
139
  type: :development
143
140
  prerelease: false
144
141
  version_requirements: !ruby/object:Gem::Requirement
145
142
  requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- version: 4.0.0.beta2
149
- - - "<"
143
+ - - "~>"
150
144
  - !ruby/object:Gem::Version
151
- version: '5'
145
+ version: '4.0'
152
146
  - !ruby/object:Gem::Dependency
153
147
  name: webdrivers
154
148
  requirement: !ruby/object:Gem::Requirement