ruby_raider 0.7.3 → 0.7.5
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/.reek.yml +0 -4
- data/README.md +1 -1
- data/Rakefile +0 -6
- data/lib/generators/automation/automation_generator.rb +48 -1
- data/lib/generators/automation/templates/abstract_page.tt +4 -2
- data/lib/generators/automation/templates/partials/android_caps.tt +6 -4
- data/lib/generators/automation/templates/partials/cross_platform_caps.tt +11 -10
- data/lib/generators/automation/templates/partials/ios_caps.tt +7 -5
- data/lib/generators/common_generator.rb +1 -1
- data/lib/generators/cucumber/cucumber_generator.rb +16 -0
- data/lib/generators/cucumber/templates/partials/appium_env.tt +3 -4
- data/lib/generators/cucumber/templates/partials/driver_world.tt +2 -2
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +12 -10
- data/lib/generators/cucumber/templates/partials/watir_env.tt +4 -32
- data/lib/generators/cucumber/templates/partials/watir_world.tt +1 -1
- data/lib/generators/generator.rb +4 -0
- data/lib/generators/helper_generator.rb +0 -5
- data/lib/generators/invoke_generators.rb +0 -14
- data/lib/generators/menu_generator.rb +9 -23
- data/lib/generators/rspec/rspec_generator.rb +10 -2
- data/lib/generators/rspec/templates/spec.tt +3 -3
- data/lib/generators/templates/common/read_me.tt +1 -1
- data/lib/generators/templates/helpers/allure_helper.tt +19 -21
- data/lib/generators/templates/helpers/appium_helper.tt +19 -21
- data/lib/generators/templates/helpers/browser_helper.tt +12 -9
- data/lib/generators/templates/helpers/driver_helper.tt +16 -15
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +24 -19
- data/lib/generators/templates/helpers/spec_helper.tt +18 -18
- data/lib/generators/templates/helpers/visual_helper.tt +1 -3
- data/lib/generators/templates/helpers/visual_spec_helper.tt +2 -4
- data/lib/ruby_raider.rb +1 -8
- data/ruby_raider.gemspec +1 -2
- data/spec/automation_generator_spec.rb +14 -70
- data/spec/common_generator_spec.rb +2 -2
- data/spec/cucumber_generator_spec.rb +0 -32
- data/spec/helpers_generator_spec.rb +0 -8
- data/spec/rspec_generator_spec.rb +12 -31
- data/spec/spec_helper.rb +4 -4
- data/spec/support/settings_helper.rb +1 -3
- metadata +2 -26
- data/lib/desktop/components/base_component.rb +0 -18
- data/lib/desktop/components/runner_components.rb +0 -196
- data/lib/desktop/screens/runner_screen.rb +0 -20
- data/lib/generators/automation/automation_examples_generator.rb +0 -48
- data/lib/generators/automation/templates/partials/require_raider.tt +0 -5
- data/lib/generators/cucumber/cucumber_examples_generator.rb +0 -21
- data/lib/generators/rspec/rspec_examples_generator.rb +0 -17
- data/lib/generators/rspec/templates/base_spec.tt +0 -7
- data/lib/generators/templates/helpers/partials/select_driver.tt +0 -9
- data/lib/generators/templates/helpers/raider_helper.tt +0 -19
@@ -5,15 +5,18 @@ require 'selenium-webdriver'
|
|
5
5
|
require 'watir'
|
6
6
|
require 'webdrivers'
|
7
7
|
|
8
|
-
module
|
9
|
-
module BrowserHelper
|
10
|
-
attr_reader :browser
|
8
|
+
module BrowserHelper
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
def browser(*args)
|
11
|
+
@browser ||= create_browser(*args)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def create_browser(*args)
|
17
|
+
@config = YAML.load_file('config/config.yml')
|
18
|
+
browser = @config['browser'].to_sym
|
19
|
+
args = args.empty? ? @config['browser_options'] : args
|
20
|
+
@browser = Watir::Browser.new(browser, options: { args: args })
|
18
21
|
end
|
19
22
|
end
|
@@ -7,24 +7,25 @@ require 'webdrivers'
|
|
7
7
|
require 'appium_lib'
|
8
8
|
<% end -%>
|
9
9
|
|
10
|
-
module
|
11
|
-
|
12
|
-
|
10
|
+
module DriverHelper
|
11
|
+
<% if automation == 'selenium' -%>
|
12
|
+
def driver(*opts)
|
13
|
+
@driver ||= create_driver(*opts)
|
14
|
+
end
|
15
|
+
<% else -%>
|
16
|
+
def driver
|
17
|
+
@driver ||= create_driver
|
18
|
+
end
|
19
|
+
<%- end -%>
|
13
20
|
|
14
|
-
<%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
15
|
-
|
16
|
-
<% if automation == 'cross_platform' -%>
|
17
21
|
private
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
<% end -%>
|
23
|
+
<%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
24
|
+
|
23
25
|
<%- if automation != 'selenium' -%>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
# :reek:UtilityFunction
|
27
|
+
def caps
|
28
|
+
YAML.load_file('config/capabilities.yml')
|
29
|
+
end
|
28
30
|
<%- end -%>
|
29
31
|
end
|
30
|
-
end
|
@@ -1,30 +1,35 @@
|
|
1
1
|
<% if automation == 'selenium' -%>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
def create_driver(*opts)
|
3
|
+
@config = YAML.load_file('config/config.yml')
|
4
|
+
browser = @config['browser'].to_sym
|
5
|
+
Selenium::WebDriver.for(browser, capabilities: browser_options(*opts))
|
6
|
+
end
|
7
|
+
|
8
|
+
def browser_options(*opts)
|
9
|
+
opts = opts.empty? ? @config['browser_options'] : opts
|
10
|
+
create_options(*opts)
|
11
|
+
end
|
7
12
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
13
|
+
# :reek:FeatureEnvy
|
14
|
+
def create_options(*opts)
|
15
|
+
load_browser = @config['browser'].to_s
|
16
|
+
browser = load_browser == 'ie' ? load_browser.upcase : load_browser.capitalize
|
17
|
+
caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
|
18
|
+
opts.each { |option| caps.add_argument(option) }
|
19
|
+
caps
|
20
|
+
end
|
12
21
|
|
13
|
-
# :reek:FeatureEnvy
|
14
|
-
def create_options(*opts)
|
15
|
-
load_browser = @config['browser'].to_s
|
16
|
-
browser = load_browser == 'ie' ? load_browser.upcase : load_browser.capitalize
|
17
|
-
caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
|
18
|
-
opts.each { |option| caps.add_argument(option) }
|
19
|
-
caps
|
20
|
-
end
|
21
22
|
<% elsif automation == 'cross_platform' -%>
|
22
|
-
def
|
23
|
+
def create_driver
|
23
24
|
platform = config['platform'].to_s
|
24
25
|
@driver = Appium::Driver.new({ caps: caps[platform] })
|
25
26
|
end
|
27
|
+
|
28
|
+
def config
|
29
|
+
YAML.load_file('config/config.yml')
|
30
|
+
end
|
26
31
|
<% else -%>
|
27
|
-
def
|
32
|
+
def create_driver
|
28
33
|
@driver = Appium::Driver.new({ caps: caps })
|
29
34
|
end
|
30
35
|
<% end -%>
|
@@ -2,29 +2,29 @@
|
|
2
2
|
|
3
3
|
require 'rspec'
|
4
4
|
require_relative 'allure_helper'
|
5
|
-
|
5
|
+
<%- if automation == 'watir' -%>
|
6
6
|
require_relative 'browser_helper'
|
7
|
-
|
7
|
+
<%- else -%>
|
8
8
|
require_relative 'driver_helper'
|
9
|
-
|
9
|
+
<%- end -%>
|
10
10
|
|
11
|
-
module
|
12
|
-
module SpecHelper
|
11
|
+
module SpecHelper
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
AllureHelper.configure
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.formatter = AllureHelper.formatter
|
16
|
+
<% if automation == 'watir' %>config.include(BrowserHelper)<% else %>config.include(DriverHelper)<% end %>
|
17
|
+
<%- if %w[android ios cross_platform].include? automation -%>
|
18
|
+
config.before(:each) do
|
19
|
+
driver.start_driver
|
20
|
+
end
|
21
|
+
<%- end -%>
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
23
|
+
config.after(:each) do
|
24
|
+
example_name = self.class.descendant_filtered_examples.first.description
|
25
|
+
<%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
26
|
+
AllureHelper.add_screenshot example_name
|
27
|
+
<%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -4,8 +4,7 @@ require 'active_support/inflector'
|
|
4
4
|
require 'eyes_selenium'
|
5
5
|
require 'yaml'
|
6
6
|
|
7
|
-
module
|
8
|
-
module VisualHelper
|
7
|
+
module VisualHelper
|
9
8
|
attr_reader :eyes
|
10
9
|
|
11
10
|
SELENIUM = Applitools::Selenium
|
@@ -63,5 +62,4 @@ module Raider
|
|
63
62
|
conf.test_name = options[:test_name]
|
64
63
|
conf.viewport_size = REGTANGLE_SIZE.new(options[:viewport_size][:height], options[:viewport_size][:width])
|
65
64
|
end
|
66
|
-
end
|
67
65
|
end
|
@@ -6,8 +6,7 @@ require_relative 'allure_helper'
|
|
6
6
|
require_relative 'driver_helper'
|
7
7
|
require_relative 'visual_helper'
|
8
8
|
|
9
|
-
module
|
10
|
-
module SpecHelper
|
9
|
+
module SpecHelper
|
11
10
|
RSpec.configure do |config|
|
12
11
|
config.include(DriverHelper)
|
13
12
|
config.include(VisualHelper)
|
@@ -16,7 +15,7 @@ module Raider
|
|
16
15
|
@grid_runner = create_grid_runner
|
17
16
|
@eyes = create_eyes(@grid_runner)
|
18
17
|
configure_eyes @eyes
|
19
|
-
@driver = @eyes.open(driver:
|
18
|
+
@driver = @eyes.open(driver: driver)
|
20
19
|
end
|
21
20
|
|
22
21
|
config.after(:each) do
|
@@ -29,6 +28,5 @@ module Raider
|
|
29
28
|
results = @grid_runner.get_all_test_results
|
30
29
|
puts results
|
31
30
|
end
|
32
|
-
end
|
33
31
|
end
|
34
32
|
end
|
data/lib/ruby_raider.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require_relative '../lib/commands/open_ai_commands'
|
4
4
|
require_relative '../lib/commands/scaffolding_commands'
|
5
5
|
require_relative '../lib/commands/utility_commands'
|
6
|
-
require_relative '../lib/desktop/screens/runner_screen'
|
7
6
|
|
8
7
|
# :reek:FeatureEnvy { enabled: false }
|
9
8
|
# :reek:UtilityFunction { enabled: false }
|
@@ -17,16 +16,10 @@ module RubyRaider
|
|
17
16
|
|
18
17
|
map '-n' => 'new'
|
19
18
|
|
20
|
-
desc 'open', 'It opens the Ruby Raider desktop app'
|
21
|
-
|
22
|
-
def open
|
23
|
-
RunnerScreen.new.launch
|
24
|
-
end
|
25
|
-
|
26
19
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
27
20
|
|
28
21
|
def version
|
29
|
-
puts 'The Ruby Raider version is 0.7.
|
22
|
+
puts 'The Ruby Raider version is 0.7.4, Happy testing!'
|
30
23
|
end
|
31
24
|
|
32
25
|
map 'v' => 'version'
|
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.7.
|
5
|
+
s.version = '0.7.5'
|
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']
|
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
|
23
23
|
|
24
24
|
s.add_runtime_dependency 'faraday', '~> 1.2.0'
|
25
|
-
s.add_runtime_dependency 'glimmer-dsl-libui', '~> 0.7.3'
|
26
25
|
s.add_runtime_dependency 'ruby-openai', '~> 3.5'
|
27
26
|
s.add_runtime_dependency 'thor', '~> 1.2.1'
|
28
27
|
s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
|
@@ -4,7 +4,7 @@ require_relative '../lib/generators/automation/automation_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe AutomationGenerator do
|
7
|
-
shared_examples 'creates web automation framework
|
7
|
+
shared_examples 'creates web automation framework' do |name|
|
8
8
|
it 'creates a login page file' do
|
9
9
|
expect(File).to exist("#{name}/page_objects/pages/login_page.rb")
|
10
10
|
end
|
@@ -22,25 +22,7 @@ describe AutomationGenerator do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
shared_examples 'creates
|
26
|
-
it 'creates an abstract page file' do
|
27
|
-
expect(File).to exist("#{name}/page_objects/abstract/abstract_page.rb")
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'creates an abstract component file' do
|
31
|
-
expect(File).to exist("#{name}/page_objects/abstract/abstract_component.rb")
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'creates a login page file' do
|
35
|
-
expect(File).not_to exist("#{name}/page_objects/pages/login_page.rb")
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'creates a component file' do
|
39
|
-
expect(File).not_to exist("#{name}/page_objects/components/header_component.rb")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
shared_examples 'creates mobile automation framework with example files' do |name|
|
25
|
+
shared_examples 'creates mobile automation framework' do |name|
|
44
26
|
it 'creates a home page file' do
|
45
27
|
expect(File).to exist("#{name}/page_objects/pages/home_page.rb")
|
46
28
|
end
|
@@ -54,21 +36,7 @@ describe AutomationGenerator do
|
|
54
36
|
end
|
55
37
|
end
|
56
38
|
|
57
|
-
shared_examples 'creates
|
58
|
-
it 'creates an abstract page file' do
|
59
|
-
expect(File).to exist("#{name}/page_objects/abstract/abstract_page.rb")
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'creates a home page file' do
|
63
|
-
expect(File).not_to exist("#{name}/page_objects/pages/home_page.rb")
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'creates a pdp page file' do
|
67
|
-
expect(File).not_to exist("#{name}/page_objects/pages/pdp_page.rb")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
shared_examples 'creates web visual framework with example files' do |name|
|
39
|
+
shared_examples 'creates web visual framework' do |name|
|
72
40
|
it 'creates a login page file' do
|
73
41
|
expect(File).to exist("#{name}/page_objects/pages/login_page.rb")
|
74
42
|
end
|
@@ -78,65 +46,41 @@ describe AutomationGenerator do
|
|
78
46
|
end
|
79
47
|
end
|
80
48
|
|
81
|
-
shared_examples 'creates web visual framework without example files' do |name|
|
82
|
-
it 'creates an abstract page file' do
|
83
|
-
expect(File).to exist("#{name}/page_objects/abstract/abstract_page.rb")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
49
|
context 'with rspec and selenium' do
|
88
|
-
include_examples 'creates web automation framework
|
89
|
-
include_examples 'creates web
|
90
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_without_examples"
|
91
|
-
include_examples 'creates web visual framework with example files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
|
50
|
+
include_examples 'creates web automation framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
51
|
+
include_examples 'creates web visual framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
|
92
52
|
end
|
93
53
|
|
94
54
|
context 'with rspec and watir' do
|
95
|
-
include_examples 'creates web automation framework
|
96
|
-
include_examples 'creates web automation framework without example files',
|
97
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_without_examples"
|
98
|
-
include_examples 'creates web visual framework with example files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
|
55
|
+
include_examples 'creates web automation framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
|
99
56
|
end
|
100
57
|
|
101
58
|
context 'with cucumber and selenium' do
|
102
|
-
include_examples 'creates web automation framework
|
103
|
-
include_examples 'creates web
|
104
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}_without_examples"
|
59
|
+
include_examples 'creates web automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
60
|
+
include_examples 'creates web visual framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}_visual"
|
105
61
|
end
|
106
62
|
|
107
63
|
context 'with cucumber and watir' do
|
108
|
-
include_examples 'creates web automation framework
|
109
|
-
include_examples 'creates web automation framework without example files',
|
110
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}_without_examples"
|
64
|
+
include_examples 'creates web automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
|
111
65
|
end
|
112
66
|
|
113
67
|
context 'with rspec and appium android' do
|
114
|
-
include_examples 'creates mobile automation framework
|
115
|
-
include_examples 'creates mobile automation framework without example files',
|
116
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}_without_examples"
|
68
|
+
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
|
117
69
|
end
|
118
70
|
|
119
71
|
context 'with rspec and appium ios' do
|
120
|
-
include_examples 'creates mobile automation framework
|
121
|
-
include_examples 'creates mobile automation framework without example files',
|
122
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}_without_examples"
|
72
|
+
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
|
123
73
|
end
|
124
74
|
|
125
75
|
context 'with cucumber and appium android' do
|
126
|
-
include_examples 'creates mobile automation framework
|
127
|
-
include_examples 'creates mobile automation framework without example files',
|
128
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}_without_examples"
|
76
|
+
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
|
129
77
|
end
|
130
78
|
|
131
79
|
context 'with cucumber and appium ios' do
|
132
|
-
include_examples 'creates mobile automation framework
|
133
|
-
include_examples 'creates mobile automation framework without example files',
|
134
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}_without_examples"
|
80
|
+
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
|
135
81
|
end
|
136
82
|
|
137
83
|
context 'with cucumber and appium cross platform' do
|
138
|
-
include_examples 'creates mobile automation framework
|
139
|
-
include_examples 'creates mobile automation framework without example files',
|
140
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}_without_examples"
|
84
|
+
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
141
85
|
end
|
142
86
|
end
|
@@ -107,12 +107,12 @@ describe CommonGenerator do
|
|
107
107
|
context 'with cucumber and appium cross platform' do
|
108
108
|
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
109
109
|
include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
110
|
-
include_examples
|
110
|
+
include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
111
111
|
end
|
112
112
|
|
113
113
|
context 'with rspec and appium cross platform' do
|
114
114
|
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
115
115
|
include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
116
|
-
include_examples
|
116
|
+
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
117
117
|
end
|
118
118
|
end
|
@@ -4,28 +4,6 @@ require_relative '../lib/generators/cucumber/cucumber_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe CucumberGenerator do
|
7
|
-
shared_examples 'creates cucumber files without examples' do |project_name, file_name|
|
8
|
-
it 'creates a feature file' do
|
9
|
-
expect(File).not_to exist("#{project_name}/features/#{file_name}.feature")
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'creates a step definitions file' do
|
13
|
-
expect(File).not_to exist("#{project_name}/features/step_definitions/#{file_name}_steps.rb")
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'creates an env file' do
|
17
|
-
expect(File).to exist("#{project_name}/features/support/env.rb")
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'creates an cucumber.yml file' do
|
21
|
-
expect(File).to exist("#{project_name}/cucumber.yml")
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'does not create a spec file' do
|
25
|
-
expect(File).not_to exist("#{project_name}/spec/home_spec.rb")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
7
|
shared_examples 'creates cucumber files' do |project_name, file_name|
|
30
8
|
it 'creates a feature file' do
|
31
9
|
expect(File).to exist("#{project_name}/features/#{file_name}.feature")
|
@@ -64,33 +42,23 @@ describe CucumberGenerator do
|
|
64
42
|
|
65
43
|
context 'with cucumber and appium android' do
|
66
44
|
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}", 'home'
|
67
|
-
include_examples 'creates cucumber files without examples',
|
68
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}_without_examples", 'home'
|
69
45
|
end
|
70
46
|
|
71
47
|
context 'with cucumber and appium ios' do
|
72
48
|
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}", 'home'
|
73
|
-
include_examples 'creates cucumber files without examples',
|
74
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}_without_examples", 'home'
|
75
49
|
end
|
76
50
|
|
77
51
|
context 'with cucumber and appium cross platform' do
|
78
52
|
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}", 'home'
|
79
|
-
include_examples 'creates cucumber files without examples',
|
80
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}_without_examples", 'home'
|
81
53
|
end
|
82
54
|
|
83
55
|
context 'with cucumber and selenium' do
|
84
56
|
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}", 'login'
|
85
57
|
include_examples 'creates factories for web projects', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}", 'login'
|
86
|
-
include_examples 'creates cucumber files without examples',
|
87
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}_without_examples", 'login'
|
88
58
|
end
|
89
59
|
|
90
60
|
context 'with cucumber and watir' do
|
91
61
|
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}", 'login'
|
92
62
|
include_examples 'creates factories for web projects', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}", 'login'
|
93
|
-
include_examples 'creates cucumber files without examples',
|
94
|
-
"#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}_without_examples", 'login'
|
95
63
|
end
|
96
64
|
end
|
@@ -5,10 +5,6 @@ require_relative 'spec_helper'
|
|
5
5
|
|
6
6
|
describe HelpersGenerator do
|
7
7
|
shared_examples 'creates common helpers' do |name|
|
8
|
-
it 'creates a raider file' do
|
9
|
-
expect(File).to exist("#{name}/helpers/raider.rb")
|
10
|
-
end
|
11
|
-
|
12
8
|
it 'creates an allure helper file' do
|
13
9
|
expect(File).to exist("#{name}/helpers/allure_helper.rb")
|
14
10
|
end
|
@@ -45,10 +41,6 @@ describe HelpersGenerator do
|
|
45
41
|
end
|
46
42
|
|
47
43
|
shared_examples 'creates common visual helpers' do |name|
|
48
|
-
it 'creates a raider file' do
|
49
|
-
expect(File).to exist("#{name}/helpers/raider.rb")
|
50
|
-
end
|
51
|
-
|
52
44
|
it 'creates a visual helper file' do
|
53
45
|
expect(File).to exist("#{name}/helpers/visual_helper.rb")
|
54
46
|
end
|
@@ -4,16 +4,6 @@ require_relative '../lib/generators/rspec/rspec_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe RspecGenerator do
|
7
|
-
shared_examples 'creates rspec files' do |project_name, file_name|
|
8
|
-
it 'creates a spec file' do
|
9
|
-
expect(File).to exist("#{project_name}/spec/#{file_name}_page_spec.rb")
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'creates the base spec file' do
|
13
|
-
expect(File).to exist("#{project_name}/spec/base_spec.rb")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
7
|
shared_examples 'creates factory files' do |project_name|
|
18
8
|
it 'creates a model factory file' do
|
19
9
|
expect(File).to exist("#{project_name}/models/model_factory.rb")
|
@@ -24,45 +14,36 @@ describe RspecGenerator do
|
|
24
14
|
end
|
25
15
|
end
|
26
16
|
|
27
|
-
shared_examples 'creates rspec files
|
17
|
+
shared_examples 'creates rspec files examples' do |project_name, file_name|
|
28
18
|
it 'creates a spec file' do
|
29
|
-
expect(File).
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'creates the base spec file' do
|
33
|
-
expect(File).to exist("#{project_name}/spec/base_spec.rb")
|
19
|
+
expect(File).to exist("#{project_name}/spec/#{file_name}_page_spec.rb")
|
34
20
|
end
|
35
21
|
end
|
36
22
|
|
37
23
|
context 'with rspec and selenium' do
|
38
|
-
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}", 'login'
|
39
24
|
include_examples 'creates factory files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
40
|
-
include_examples 'creates rspec files
|
41
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}
|
25
|
+
include_examples 'creates rspec files examples',
|
26
|
+
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}", 'login'
|
42
27
|
end
|
43
28
|
|
44
29
|
context 'with rspec and watir' do
|
45
|
-
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}", 'login'
|
46
30
|
include_examples 'creates factory files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
47
|
-
include_examples 'creates rspec files
|
48
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}
|
31
|
+
include_examples 'creates rspec files examples',
|
32
|
+
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}", 'login'
|
49
33
|
end
|
50
34
|
|
51
35
|
context 'with rspec and appium android' do
|
52
|
-
include_examples 'creates rspec files',
|
53
|
-
|
54
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}_without_examples", 'pdp'
|
36
|
+
include_examples 'creates rspec files examples',
|
37
|
+
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}", 'pdp'
|
55
38
|
end
|
56
39
|
|
57
40
|
context 'with rspec and appium ios' do
|
58
|
-
include_examples 'creates rspec files',
|
59
|
-
|
60
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}_without_examples", 'pdp'
|
41
|
+
include_examples 'creates rspec files examples',
|
42
|
+
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}", 'pdp'
|
61
43
|
end
|
62
44
|
|
63
45
|
context 'with rspec and appium cross platform' do
|
64
|
-
include_examples 'creates rspec files',
|
65
|
-
|
66
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}_without_examples", 'pdp'
|
46
|
+
include_examples 'creates rspec files examples',
|
47
|
+
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}", 'pdp'
|
67
48
|
end
|
68
49
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -14,8 +14,8 @@ RSpec.configure do |config|
|
|
14
14
|
config.before(:all) do
|
15
15
|
FRAMEWORKS.each do |framework|
|
16
16
|
AUTOMATION_TYPES.each do |automation|
|
17
|
-
[true, false].
|
18
|
-
settings = create_settings(framework: framework, automation: automation,
|
17
|
+
[true, false].each do |visual|
|
18
|
+
settings = create_settings(framework: framework, automation: automation, visual: visual)
|
19
19
|
generate_framework(settings)
|
20
20
|
end
|
21
21
|
end
|
@@ -25,8 +25,8 @@ RSpec.configure do |config|
|
|
25
25
|
config.after(:all) do
|
26
26
|
FRAMEWORKS.each do |framework|
|
27
27
|
AUTOMATION_TYPES.each do |automation|
|
28
|
-
[true, false].
|
29
|
-
settings = create_settings(framework: framework, automation: automation,
|
28
|
+
[true, false].each do |visual|
|
29
|
+
settings = create_settings(framework: framework, automation: automation, visual: visual)
|
30
30
|
FileUtils.rm_rf(settings[:name])
|
31
31
|
end
|
32
32
|
end
|
@@ -4,14 +4,12 @@
|
|
4
4
|
module SettingsHelper
|
5
5
|
def create_settings(options)
|
6
6
|
automation = options[:automation]
|
7
|
-
examples = options[:examples]
|
8
7
|
visual = options[:visual]
|
9
8
|
framework = options[:framework]
|
10
9
|
{
|
11
10
|
automation: automation,
|
12
|
-
examples: examples,
|
13
11
|
framework: framework,
|
14
|
-
name: "#{framework}_#{automation}#{'_visual' if visual}
|
12
|
+
name: "#{framework}_#{automation}#{'_visual' if visual}",
|
15
13
|
visual: visual
|
16
14
|
}
|
17
15
|
end
|