ruby_raider 0.4.3 → 0.4.4
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/lib/commands/utility_commands.rb +1 -1
- data/lib/generators/helper_generator.rb +1 -1
- data/lib/generators/templates/automation/abstract_page.tt +6 -7
- data/lib/generators/templates/automation/home_page.tt +1 -1
- data/lib/generators/templates/automation/partials/home_page_selector.tt +8 -8
- data/lib/generators/templates/automation/partials/pdp_page_selector.tt +8 -8
- data/lib/generators/templates/automation/partials/require_raider.tt +3 -3
- data/lib/generators/templates/automation/pdp_page.tt +1 -1
- data/lib/generators/templates/helpers/appium_helper.tt +1 -1
- data/lib/generators/templates/helpers/driver_helper.tt +4 -3
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +25 -25
- data/lib/utilities/utilities.rb +1 -1
- data/ruby_raider.gemspec +1 -1
- data/spec/automation_generator_spec.rb +0 -4
- data/spec/common_generator_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36188ec04973b3250dce20a65362ad77cd87c6f5aa255977f66d024ebdf40d65
|
4
|
+
data.tar.gz: d7c704bf859d9ac8e73fd76260565545a65eb48d483c9766a2b7daa5aa2a1050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d684f51de9dec607f6ce7e53fc95451f56bca9025e278d77e466c0030dfd7544be756260037cd99a80bd5969e941b4e0ec1c19c174cb9d4a841ddd25674ea0
|
7
|
+
data.tar.gz: 2c6edaf85dc0084a817e619c28fc5147d346178a7ab9d9bb359774a3cefc4b6180fabeb5e4eb41f513f07a81379c74270374f5aab3737aac0b488528be12aca9
|
@@ -55,7 +55,7 @@ class UtilityCommands < Thor
|
|
55
55
|
option :parallel,
|
56
56
|
type: :boolean, required: false, desc: 'It runs the tests in parallel', aliases: '-p'
|
57
57
|
option :opts,
|
58
|
-
type: :array, required: false, desc: 'The options
|
58
|
+
type: :array, required: false, desc: 'The options that your run will run with', aliases: '-o'
|
59
59
|
|
60
60
|
def raid
|
61
61
|
if options[:parallel]
|
@@ -32,7 +32,7 @@ class HelpersGenerator < Generator
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def generate_pdp_page
|
35
|
-
return unless
|
35
|
+
return unless @_initializer.first.include?('cross_platform')
|
36
36
|
|
37
37
|
template('helpers/appium_helper.tt', "#{name}/helpers/appium_helper.rb")
|
38
38
|
end
|
@@ -1,11 +1,10 @@
|
|
1
|
-
<%= ERB.new(File.read(File.expand_path('./partials/require_raider.tt', __dir__)),
|
1
|
+
<%= ERB.new(File.read(File.expand_path('./partials/require_raider.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
2
2
|
|
3
3
|
class AbstractPage
|
4
|
-
<% if automation == 'cross_platform'
|
4
|
+
<% if automation == 'cross_platform' -%>
|
5
5
|
include Raider::AppiumHelper
|
6
|
-
<% end
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<%= ERB.new(File.read(File.expand_path('./partials/url_methods.tt', __dir__))).result(binding) -%>
|
6
|
+
<% end -%>
|
7
|
+
<%= ERB.new(File.read(File.expand_path('./partials/initialize_selector.tt', __dir__))).result(binding) -%>
|
8
|
+
<%= ERB.new(File.read(File.expand_path('./partials/visit_method.tt', __dir__))).result(binding) -%>
|
9
|
+
<%= ERB.new(File.read(File.expand_path('./partials/url_methods.tt', __dir__))).result(binding) -%>
|
11
10
|
end
|
@@ -15,6 +15,6 @@ class HomePage < AbstractPage
|
|
15
15
|
# Elements
|
16
16
|
|
17
17
|
def backpack_image
|
18
|
-
<%= ERB.new(File.read(File.expand_path('./partials/home_page_selector.tt', __dir__))).result(binding) %>
|
18
|
+
<%= ERB.new(File.read(File.expand_path('./partials/home_page_selector.tt', __dir__)), trim_mode: '-').result(binding) %>
|
19
19
|
end
|
20
20
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<% if automation == 'ios'
|
2
|
-
|
3
|
-
<% elsif automation == 'android'
|
4
|
-
|
5
|
-
<% else
|
6
|
-
|
7
|
-
|
8
|
-
<% end
|
1
|
+
<% if automation == 'ios' -%>
|
2
|
+
driver.find_element(predicate: 'label == "Sauce Labs Backpack"')
|
3
|
+
<% elsif automation == 'android' -%>
|
4
|
+
driver.find_element(xpath: '(//android.view.ViewGroup[@content-desc="store item"])[1]/android.view.ViewGroup[1]')
|
5
|
+
<% else -%>
|
6
|
+
element(ios: { predicate: 'label == "Sauce Labs Backpack"' },
|
7
|
+
android: { xpath: '(//android.view.ViewGroup[@content-desc="store item"])[1]/android.view.ViewGroup[1]' })
|
8
|
+
<% end -%>
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<% if automation == 'ios'
|
2
|
-
|
3
|
-
<% elsif automation == 'android'
|
4
|
-
|
5
|
-
<% else
|
6
|
-
|
7
|
-
|
8
|
-
<% end
|
1
|
+
<% if automation == 'ios' -%>
|
2
|
+
driver.find_element(accessibility_id: 'Add To Cart button')
|
3
|
+
<% elsif automation == 'android' -%>
|
4
|
+
driver.find_element(xpath: '//android.view.ViewGroup[@content-desc="Add To Cart button"]/android.widget.TextView')
|
5
|
+
<% else -%>
|
6
|
+
element(ios: { accessibility_id: 'Add To Cart button' },
|
7
|
+
android: { xpath: '//android.view.ViewGroup[@content-desc="Add To Cart button"]/android.widget.TextView' })
|
8
|
+
<% end -%>
|
@@ -13,6 +13,6 @@ class PdpPage < AbstractPage
|
|
13
13
|
# Elements
|
14
14
|
|
15
15
|
def add_to_cart_button
|
16
|
-
<%= ERB.new(File.read(File.expand_path('./partials/pdp_page_selector.tt', __dir__))).result(binding) %>
|
16
|
+
<%= ERB.new(File.read(File.expand_path('./partials/pdp_page_selector.tt', __dir__)), trim_mode: '-').result(binding) %>
|
17
17
|
end
|
18
18
|
end
|
@@ -11,7 +11,7 @@ module Raider
|
|
11
11
|
module DriverHelper
|
12
12
|
attr_reader :driver
|
13
13
|
|
14
|
-
|
14
|
+
<%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
15
15
|
|
16
16
|
<% if automation == 'cross_platform' -%>
|
17
17
|
private
|
@@ -21,9 +21,10 @@ module Raider
|
|
21
21
|
end
|
22
22
|
<% end -%>
|
23
23
|
<% if automation != 'selenium' -%>
|
24
|
+
|
24
25
|
def caps
|
25
26
|
YAML.load_file('config/capabilities.yml')
|
26
27
|
end
|
27
|
-
|
28
|
-
|
28
|
+
<% end -%>
|
29
|
+
end
|
29
30
|
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
<% if automation == 'selenium'
|
1
|
+
<% if automation == 'selenium' -%>
|
2
2
|
def new_driver(*opts)
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
@config = YAML.load_file('config/config.yml')
|
4
|
+
browser = @config['browser'].to_sym
|
5
|
+
@driver = Selenium::WebDriver.for(browser, capabilities: browser_options(*opts))
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def browser_options(*opts)
|
9
|
+
opts = opts.empty? ? @config['browser_options'] : opts
|
10
|
+
create_options(*opts)
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<% elsif automation == 'cross_platform'
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<% else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
<% end
|
13
|
+
def create_options(*opts)
|
14
|
+
browser = @config['browser'] == :ie ? @config['browser'].to_s.upcase : @config['browser'].to_s.capitalize
|
15
|
+
caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
|
16
|
+
opts.each { |option| caps.add_argument(option) }
|
17
|
+
caps
|
18
|
+
end
|
19
|
+
<% elsif automation == 'cross_platform' -%>
|
20
|
+
def new_driver
|
21
|
+
platform = config['platform'].to_s
|
22
|
+
@driver = Appium::Driver.new({ caps: caps[platform] })
|
23
|
+
end
|
24
|
+
<% else -%>
|
25
|
+
def new_driver
|
26
|
+
@driver = Appium::Driver.new({ caps: caps })
|
27
|
+
end
|
28
|
+
<% end -%>
|
data/lib/utilities/utilities.rb
CHANGED
@@ -58,7 +58,7 @@ class Utilities
|
|
58
58
|
system "#{command} #{opts}"
|
59
59
|
end
|
60
60
|
|
61
|
-
def parallel_run(opts = nil)
|
61
|
+
def parallel_run(opts = nil, _settings = nil)
|
62
62
|
command = File.directory?('spec') ? 'parallel_rspec spec/' : 'parallel_cucumber features'
|
63
63
|
system "#{command} #{opts}"
|
64
64
|
end
|
data/ruby_raider.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ruby_raider'
|
5
|
-
s.version = '0.4.
|
5
|
+
s.version = '0.4.4'
|
6
6
|
s.summary = 'A gem to make setup and start of UI automation projects easier'
|
7
7
|
s.description = 'This gem has everything you need to start working with test automation'
|
8
8
|
s.authors = ['Agustin Pequeno']
|
@@ -71,8 +71,4 @@ describe AutomationGenerator do
|
|
71
71
|
context 'with cucumber and appium cross platform' do
|
72
72
|
include_examples 'creates mobile automation files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
73
73
|
end
|
74
|
-
|
75
|
-
context 'with cucumber and appium cross platform' do
|
76
|
-
include_examples 'creates mobile automation files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
77
|
-
end
|
78
74
|
end
|
@@ -32,7 +32,7 @@ describe CommonGenerator do
|
|
32
32
|
|
33
33
|
shared_examples "doesn't create a config file" do |name|
|
34
34
|
it "doesn't create a config file" do
|
35
|
-
expect(File).
|
35
|
+
expect(File).not_to exist("#{name}/config/config.yml")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_raider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|