ruby_raider 0.6.0 → 0.6.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/.github/auto_assign-issues.yml +8 -0
- data/.github/workflows/rspec.yml +2 -0
- data/.reek.yml +5 -1
- data/Rakefile +6 -0
- data/lib/commands/open_ai_commands.rb +9 -7
- data/lib/commands/scaffolding_commands.rb +35 -24
- data/lib/commands/utility_commands.rb +19 -7
- data/lib/desktop/components/base_component.rb +18 -0
- data/lib/desktop/components/runner_components.rb +185 -0
- data/lib/desktop/screens/runner_screen.rb +20 -0
- data/lib/generators/automation/automation_examples_generator.rb +14 -11
- data/lib/generators/automation/automation_generator.rb +4 -4
- data/lib/generators/automation/templates/partials/selenium_login.tt +5 -5
- data/lib/generators/automation/templates/partials/url_methods.tt +1 -0
- data/lib/generators/automation/templates/partials/watir_login.tt +1 -1
- data/lib/generators/common_generator.rb +11 -3
- data/lib/generators/generator.rb +21 -1
- data/lib/generators/helper_generator.rb +21 -18
- data/lib/generators/invoke_generators.rb +5 -2
- data/lib/generators/menu_generator.rb +38 -19
- data/lib/generators/rspec/rspec_examples_generator.rb +14 -2
- data/lib/generators/rspec/templates/base_spec.tt +3 -1
- data/lib/generators/rspec/templates/data.tt +4 -0
- data/lib/generators/rspec/templates/factory.tt +10 -0
- data/lib/generators/rspec/templates/spec.tt +11 -7
- data/lib/generators/templates/common/gemfile.tt +5 -0
- data/lib/generators/templates/common/reek.tt +9 -0
- data/lib/generators/templates/common/rubocop.tt +92 -0
- data/lib/generators/templates/helpers/driver_helper.tt +2 -2
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +3 -1
- data/lib/generators/templates/helpers/raider_helper.tt +0 -1
- data/lib/open_ai/open_ai.rb +13 -7
- data/lib/ruby_raider.rb +9 -0
- data/lib/utilities/utilities.rb +6 -18
- data/ruby_raider.gemspec +1 -1
- data/spec/common_generator_spec.rb +11 -5
- data/spec/open_ai_commands_spec.rb +5 -4
- data/spec/rspec_generator_spec.rb +12 -0
- data/spec/ruby_raider_spec.rb +31 -0
- data/spec/spec_helper.rb +4 -12
- metadata +11 -4
- data/lib/generators/templates/helpers/partials/require_automation.tt +0 -3
- data/lib/generators/templates/helpers/selenium_helper.tt +0 -36
@@ -3,53 +3,56 @@
|
|
3
3
|
require_relative 'generator'
|
4
4
|
|
5
5
|
class HelpersGenerator < Generator
|
6
|
+
def generate_helpers
|
7
|
+
generate_raider_helper
|
8
|
+
generate_browser_helper
|
9
|
+
generate_driver_helper
|
10
|
+
generate_appium_helper
|
11
|
+
|
12
|
+
if visual_selected?
|
13
|
+
generate_visual_helper
|
14
|
+
generate_visual_spec_helper
|
15
|
+
else
|
16
|
+
generate_allure_helper
|
17
|
+
generate_spec_helper
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
6
23
|
def generate_raider_helper
|
7
24
|
template('helpers/raider_helper.tt', "#{name}/helpers/raider.rb")
|
8
25
|
end
|
9
26
|
|
10
27
|
def generate_allure_helper
|
11
|
-
return if @_initializer.first.last
|
12
|
-
|
13
28
|
template('helpers/allure_helper.tt', "#{name}/helpers/allure_helper.rb")
|
14
29
|
end
|
15
30
|
|
16
31
|
def generate_browser_helper
|
17
|
-
template('helpers/browser_helper.tt', "#{name}/helpers/browser_helper.rb") if
|
32
|
+
template('helpers/browser_helper.tt', "#{name}/helpers/browser_helper.rb") if args.include?('watir')
|
18
33
|
end
|
19
34
|
|
20
35
|
def generate_spec_helper
|
21
|
-
|
22
|
-
|
23
|
-
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb") if @_initializer.first.include?('rspec')
|
24
|
-
end
|
25
|
-
|
26
|
-
def generate_selenium_helper
|
27
|
-
return unless @_initializer.first.include?('selenium')
|
28
|
-
|
29
|
-
template('helpers/selenium_helper.tt', "#{name}/helpers/selenium_helper.rb")
|
36
|
+
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb") if args.include?('rspec')
|
30
37
|
end
|
31
38
|
|
32
39
|
def generate_driver_helper
|
33
|
-
return if
|
40
|
+
return if args.include?('watir')
|
34
41
|
|
35
42
|
template('helpers/driver_helper.tt', "#{name}/helpers/driver_helper.rb")
|
36
43
|
end
|
37
44
|
|
38
45
|
def generate_appium_helper
|
39
|
-
return unless
|
46
|
+
return unless args.include?('cross_platform')
|
40
47
|
|
41
48
|
template('helpers/appium_helper.tt', "#{name}/helpers/appium_helper.rb")
|
42
49
|
end
|
43
50
|
|
44
51
|
def generate_visual_helper
|
45
|
-
return unless @_initializer.first.last
|
46
|
-
|
47
52
|
template('helpers/visual_helper.tt', "#{name}/helpers/visual_helper.rb")
|
48
53
|
end
|
49
54
|
|
50
55
|
def generate_visual_spec_helper
|
51
|
-
return unless @_initializer.first.last
|
52
|
-
|
53
56
|
template('helpers/visual_spec_helper.tt', "#{name}/helpers/spec_helper.rb")
|
54
57
|
end
|
55
58
|
end
|
@@ -7,15 +7,18 @@ require_relative 'helper_generator'
|
|
7
7
|
require_relative 'rspec/rspec_generator'
|
8
8
|
require_relative 'rspec/rspec_examples_generator'
|
9
9
|
|
10
|
+
# :reek:FeatureEnvy { enabled: false }
|
11
|
+
# :reek:UtilityFunction { enabled: false }
|
10
12
|
module InvokeGenerators
|
11
13
|
def generate_framework(structure = {})
|
12
14
|
generators = %w[Automation Common Helpers]
|
13
|
-
|
15
|
+
framework = structure[:framework]
|
16
|
+
add_generator(generators, framework.capitalize)
|
14
17
|
generators = add_examples(generators) if structure[:examples]
|
15
18
|
generators.each do |generator|
|
16
19
|
invoke_generator({
|
17
20
|
automation: structure[:automation],
|
18
|
-
framework:
|
21
|
+
framework: framework,
|
19
22
|
generator: generator,
|
20
23
|
name: structure[:name],
|
21
24
|
visual: structure[:visual]
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'tty-prompt'
|
4
4
|
require_relative '../generators/invoke_generators'
|
5
5
|
|
6
|
+
# :reek:FeatureEnvy { enabled: false }
|
7
|
+
# :reek:UtilityFunction { enabled: false }
|
6
8
|
class MenuGenerator
|
7
9
|
attr_reader :prompt, :name
|
8
10
|
|
@@ -23,11 +25,7 @@ class MenuGenerator
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def choose_visual_automation
|
26
|
-
prompt.select('Do you want to add visual automation with applitools?')
|
27
|
-
menu.choice :Yes, -> { true }
|
28
|
-
menu.choice :No, -> { false }
|
29
|
-
menu.choice :Quit, -> { exit }
|
30
|
-
end
|
28
|
+
prompt.select('Do you want to add visual automation with applitools?', visual_automation_menu_choices)
|
31
29
|
end
|
32
30
|
|
33
31
|
def choose_test_framework(automation)
|
@@ -36,13 +34,13 @@ class MenuGenerator
|
|
36
34
|
select_test_framework(automation)
|
37
35
|
end
|
38
36
|
|
39
|
-
def set_up_framework(
|
37
|
+
def set_up_framework(options)
|
40
38
|
structure = {
|
41
|
-
automation: automation,
|
42
|
-
framework: framework,
|
39
|
+
automation: options[:automation],
|
40
|
+
framework: options[:framework],
|
43
41
|
name: @name,
|
44
|
-
visual: visual_automation,
|
45
|
-
examples: with_examples
|
42
|
+
visual: options[:visual_automation],
|
43
|
+
examples: options[:with_examples]
|
46
44
|
}
|
47
45
|
generate_framework(structure)
|
48
46
|
system "cd #{name} && gem install bundler && bundle install"
|
@@ -59,13 +57,6 @@ class MenuGenerator
|
|
59
57
|
|
60
58
|
private
|
61
59
|
|
62
|
-
def framework_choice(framework, automation_type, with_examples: true)
|
63
|
-
visual_automation = choose_visual_automation if %w[selenium watir].include?(automation_type) && framework == 'Rspec'
|
64
|
-
|
65
|
-
set_up_framework(automation_type, framework.downcase, visual_automation, with_examples)
|
66
|
-
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
67
|
-
end
|
68
|
-
|
69
60
|
def select_test_framework(automation)
|
70
61
|
prompt.select('Please select your test framework') do |menu|
|
71
62
|
menu.choice :Cucumber, -> { select_example_files('Cucumber', automation) }
|
@@ -76,9 +67,37 @@ class MenuGenerator
|
|
76
67
|
|
77
68
|
def select_example_files(framework, automation)
|
78
69
|
prompt.select('Would you like to create example files?') do |menu|
|
79
|
-
menu.choice :Yes, -> {
|
80
|
-
menu.choice :No, -> {
|
70
|
+
menu.choice :Yes, -> { framework_with_examples(framework, automation) }
|
71
|
+
menu.choice :No, -> { framework_without_examples(framework, automation) }
|
81
72
|
menu.choice :Quit, -> { exit }
|
82
73
|
end
|
83
74
|
end
|
75
|
+
|
76
|
+
FrameworkOptions = Struct.new(:automation, :framework, :visual_automation, :with_examples)
|
77
|
+
|
78
|
+
def create_framework_options(params)
|
79
|
+
FrameworkOptions.new(params[:automation], params[:framework], params[:visual_automation], params[:with_examples])
|
80
|
+
end
|
81
|
+
|
82
|
+
def framework_with_examples(framework, automation_type)
|
83
|
+
visual_automation = choose_visual_automation if %w[selenium watir].include?(automation_type) && framework == 'Rspec'
|
84
|
+
options = create_framework_options(automation: automation_type, framework: framework.downcase, visual_automation: visual_automation, with_examples: true)
|
85
|
+
set_up_framework(options)
|
86
|
+
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
87
|
+
end
|
88
|
+
|
89
|
+
def framework_without_examples(framework, automation_type)
|
90
|
+
visual_automation = choose_visual_automation if %w[selenium watir].include?(automation_type) && framework == 'Rspec'
|
91
|
+
options = create_framework_options(automation: automation_type, framework: framework.downcase, visual_automation: visual_automation, with_examples: false)
|
92
|
+
set_up_framework(options)
|
93
|
+
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
94
|
+
end
|
95
|
+
|
96
|
+
def visual_automation_menu_choices
|
97
|
+
{
|
98
|
+
Yes: -> { true },
|
99
|
+
No: -> { false },
|
100
|
+
Quit: -> { exit }
|
101
|
+
}
|
102
|
+
end
|
84
103
|
end
|
@@ -4,14 +4,26 @@ require_relative '../generator'
|
|
4
4
|
|
5
5
|
class RspecExamplesGenerator < Generator
|
6
6
|
def generate_login_spec
|
7
|
-
return
|
7
|
+
return if mobile_platform?
|
8
8
|
|
9
9
|
template('spec.tt', "#{name}/spec/login_page_spec.rb")
|
10
10
|
end
|
11
11
|
|
12
12
|
def generate_pdp_spec
|
13
|
-
return
|
13
|
+
return unless mobile_platform?
|
14
14
|
|
15
15
|
template('spec.tt', "#{name}/spec/pdp_page_spec.rb")
|
16
16
|
end
|
17
|
+
|
18
|
+
def generate_model_factory
|
19
|
+
return if args.include?(%w[selenium watir])
|
20
|
+
|
21
|
+
template('factory.tt', "#{name}/models/model_factory.rb")
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_model_data
|
25
|
+
return if args.include?(%w[selenium watir])
|
26
|
+
|
27
|
+
template('data.tt', "#{name}/models/data/users.yml")
|
28
|
+
end
|
17
29
|
end
|
@@ -20,32 +20,36 @@ describe 'Login Page' do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
<%- elsif %w[selenium watir].include? automation -%>
|
23
|
+
# frozen_string_literal: true
|
24
|
+
|
23
25
|
require_relative 'base_spec'
|
26
|
+
require_relative '../models/model_factory'
|
24
27
|
require_relative '../page_objects/pages/login_page'
|
25
28
|
|
26
29
|
describe 'Login' do
|
27
|
-
|
30
|
+
subject(:header) { login_page.header.customer_name }
|
31
|
+
|
32
|
+
let(:user) { ModelFactory.for('users')['Agustin'] }
|
28
33
|
let(:login_page) { LoginPage.new(<% if automation == 'watir' -%>browser<% else -%>driver<% end -%>) }
|
29
|
-
subject { login_page.header.customer_name }
|
30
34
|
|
31
35
|
before do
|
32
36
|
login_page.visit
|
33
|
-
login_page.login(
|
37
|
+
login_page.login(user['username'], password)
|
34
38
|
end
|
35
39
|
|
36
40
|
context 'with right credentials' do
|
37
|
-
let(:password) { '
|
41
|
+
let(:password) { user['password'] }
|
38
42
|
|
39
43
|
it 'can successfully log in' do
|
40
|
-
expect(
|
44
|
+
expect(header).to eq "Welcome back #{user['name']}"
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
48
|
context 'with wrong credentials' do
|
45
49
|
let(:password) { 'wrongPassword' }
|
46
50
|
|
47
|
-
it '
|
48
|
-
expect(
|
51
|
+
it 'cannot login in' do
|
52
|
+
expect(header).to be_empty
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
@@ -17,10 +17,15 @@ gem 'parallel_split_test'
|
|
17
17
|
gem 'parallel_tests'
|
18
18
|
<% end -%>
|
19
19
|
gem 'rake'
|
20
|
+
gem 'reek'
|
20
21
|
gem '<%= framework %>'
|
21
22
|
<% if framework == 'cucumber' -%>
|
22
23
|
gem 'rspec'
|
23
24
|
<% end -%>
|
25
|
+
gem 'rubocop'
|
26
|
+
<% if framework == 'rspec' -%>
|
27
|
+
gem 'rubocop-rspec'
|
28
|
+
<% end -%>
|
24
29
|
gem 'ruby_raider'
|
25
30
|
<%= ERB.new(File.read(File.expand_path('./partials/automation_gems.tt', __dir__))).result(binding).strip! %>
|
26
31
|
<% if %w[selenium watir].include? automation -%>
|
@@ -0,0 +1,92 @@
|
|
1
|
+
<% if framework == 'rspec' -%>
|
2
|
+
require:
|
3
|
+
- rubocop-rspec
|
4
|
+
<% end -%>
|
5
|
+
|
6
|
+
# Layout
|
7
|
+
Layout/CaseIndentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Layout/ClosingParenthesisIndentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Layout/LineLength:
|
14
|
+
Max: 999
|
15
|
+
|
16
|
+
Layout/MultilineMethodCallBraceLayout:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Layout/SpaceInsideHashLiteralBraces:
|
20
|
+
StyleGuide: '#spaces-operators'
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Lint
|
24
|
+
|
25
|
+
# Metrics
|
26
|
+
Metrics/AbcSize:
|
27
|
+
Max: 100
|
28
|
+
|
29
|
+
Metrics/BlockLength:
|
30
|
+
Max: 150
|
31
|
+
|
32
|
+
Metrics/BlockNesting:
|
33
|
+
Max: 4
|
34
|
+
|
35
|
+
Metrics/ClassLength:
|
36
|
+
CountComments: false
|
37
|
+
Max: 500
|
38
|
+
|
39
|
+
Metrics/CyclomaticComplexity:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/MethodLength:
|
43
|
+
Max: 150
|
44
|
+
|
45
|
+
Metrics/ModuleLength:
|
46
|
+
Max: 600
|
47
|
+
|
48
|
+
Metrics/ParameterLists:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Metrics/PerceivedComplexity:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Naming/AccessorMethodName:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
# Migration
|
58
|
+
|
59
|
+
# Naming
|
60
|
+
Naming/PredicateName:
|
61
|
+
ForbiddenPrefixes:
|
62
|
+
- 'is_'
|
63
|
+
|
64
|
+
# Security
|
65
|
+
|
66
|
+
# Styles
|
67
|
+
|
68
|
+
Style/AsciiComments:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Style/Documentation:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Style/FrozenStringLiteralComment:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Style/HashEachMethods:
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Style/HashTransformKeys:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
Style/HashTransformValues:
|
84
|
+
Enabled: true
|
85
|
+
|
86
|
+
Style/SafeNavigation:
|
87
|
+
Description: "Use &. instead of checking if an object exists"
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Style/SingleLineBlockParams:
|
91
|
+
Description: 'Enforces the names of some block params.'
|
92
|
+
Enabled: false
|
@@ -10,8 +10,10 @@
|
|
10
10
|
create_options(*opts)
|
11
11
|
end
|
12
12
|
|
13
|
+
# :reek:FeatureEnvy
|
13
14
|
def create_options(*opts)
|
14
|
-
|
15
|
+
load_browser = @config['browser'].to_s
|
16
|
+
browser = load_browser == 'ie' ? load_browser.upcase : load_browser.capitalize
|
15
17
|
caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
|
16
18
|
opts.each { |option| caps.add_argument(option) }
|
17
19
|
caps
|
@@ -4,7 +4,6 @@ module Raider
|
|
4
4
|
<%- if framework == 'rspec' -%>
|
5
5
|
require_relative 'spec_helper'
|
6
6
|
<%- end -%>
|
7
|
-
<%= ERB.new(File.read(File.expand_path('./partials/require_automation.tt', __dir__))).result(binding).strip! %>
|
8
7
|
<%- if automation == 'watir' -%>
|
9
8
|
require_relative 'browser_helper'
|
10
9
|
<%- else -%>
|
data/lib/open_ai/open_ai.rb
CHANGED
@@ -28,25 +28,31 @@ module OpenAi
|
|
28
28
|
})
|
29
29
|
end
|
30
30
|
|
31
|
-
def create_file(
|
32
|
-
|
31
|
+
def create_file(options)
|
32
|
+
path, request, choice = options.values_at(:path, :request, :choice)
|
33
|
+
File.write(path, output(request: request, choice: choice))
|
33
34
|
end
|
34
35
|
|
35
|
-
def output(
|
36
|
+
def output(options)
|
37
|
+
request, choice = options.values_at(:request, :choice)
|
38
|
+
choice ||= 0
|
36
39
|
extract_text(input(request), 'choices', choice, 'message', 'content')
|
37
40
|
end
|
38
41
|
|
39
|
-
def edit_file(
|
42
|
+
def edit_file(options)
|
43
|
+
path, request, choice = options.values_at(:path, :request, :choice)
|
40
44
|
content = File.read(path)
|
41
|
-
response = edit(content, request)
|
45
|
+
response = edit(content: content, request: request)
|
42
46
|
File.write(path, extract_text(response, 'choices', choice, 'text'))
|
43
47
|
end
|
44
48
|
|
45
|
-
def edit(
|
49
|
+
def edit(options)
|
50
|
+
content, request, model = options.values_at(:content, :request, :model)
|
51
|
+
model ||= 'text-davinci-edit-001'
|
46
52
|
client.edits(
|
47
53
|
parameters: {
|
48
54
|
model: model,
|
49
|
-
input:
|
55
|
+
input: content,
|
50
56
|
instruction: request
|
51
57
|
}
|
52
58
|
)
|
data/lib/ruby_raider.rb
CHANGED
@@ -3,7 +3,10 @@
|
|
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'
|
6
7
|
|
8
|
+
# :reek:FeatureEnvy { enabled: false }
|
9
|
+
# :reek:UtilityFunction { enabled: false }
|
7
10
|
module RubyRaider
|
8
11
|
class Raider < Thor
|
9
12
|
desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
|
@@ -14,6 +17,12 @@ module RubyRaider
|
|
14
17
|
|
15
18
|
map '-n' => 'new'
|
16
19
|
|
20
|
+
desc 'open', 'It opens the Ruby Raider desktop app'
|
21
|
+
|
22
|
+
def open
|
23
|
+
RunnerScreen.new.launch
|
24
|
+
end
|
25
|
+
|
17
26
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
18
27
|
|
19
28
|
def version
|
data/lib/utilities/utilities.rb
CHANGED
@@ -62,24 +62,6 @@ module Utilities
|
|
62
62
|
system "#{command} #{opts}"
|
63
63
|
end
|
64
64
|
|
65
|
-
def download_builds(build_type)
|
66
|
-
case build_type
|
67
|
-
when 'android'
|
68
|
-
download_android_build
|
69
|
-
when 'ios'
|
70
|
-
download_ios_build
|
71
|
-
else
|
72
|
-
download_android_build
|
73
|
-
download_ios_build
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def overwrite_yaml
|
80
|
-
File.open(@path, 'w') { |file| YAML.dump(config, file) }
|
81
|
-
end
|
82
|
-
|
83
65
|
def download_android_build
|
84
66
|
download_build('Android-MyDemoAppRN.1.3.0.build-244.apk',
|
85
67
|
'https://github.com/saucelabs/my-demo-app-rn/releases/download/v1.3.0/Android-MyDemoAppRN.1.3.0.build-244.apk')
|
@@ -99,6 +81,12 @@ module Utilities
|
|
99
81
|
end
|
100
82
|
end
|
101
83
|
|
84
|
+
private
|
85
|
+
|
86
|
+
def overwrite_yaml
|
87
|
+
File.open(@path, 'w') { |file| YAML.dump(config, file) }
|
88
|
+
end
|
89
|
+
|
102
90
|
def config
|
103
91
|
@config ||= File.exist?(@path) ? YAML.load_file(@path) : nil
|
104
92
|
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.6.
|
5
|
+
s.version = '0.6.1'
|
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']
|
@@ -24,9 +24,9 @@ describe CommonGenerator do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
shared_examples 'creates a
|
28
|
-
it 'creates a
|
29
|
-
expect(File).to exist("#{name}/config/
|
27
|
+
shared_examples 'creates a config file' do |name|
|
28
|
+
it 'creates a config file' do
|
29
|
+
expect(File).to exist("#{name}/config/config.yml")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -42,6 +42,12 @@ describe CommonGenerator do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
shared_examples 'creates a capabilities file' do |name|
|
46
|
+
it 'creates a capabilities file' do
|
47
|
+
expect(File).to exist("#{name}/config/capabilities.yml")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
45
51
|
context 'with rspec and selenium' do
|
46
52
|
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
47
53
|
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
@@ -101,12 +107,12 @@ describe CommonGenerator do
|
|
101
107
|
context 'with cucumber and appium cross platform' do
|
102
108
|
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
103
109
|
include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
104
|
-
include_examples '
|
110
|
+
include_examples "doesn't create a config file", "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
105
111
|
end
|
106
112
|
|
107
113
|
context 'with rspec and appium cross platform' do
|
108
114
|
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
109
115
|
include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
110
|
-
include_examples '
|
116
|
+
include_examples "doesn't create a config file", "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
111
117
|
end
|
112
118
|
end
|
@@ -23,10 +23,11 @@ describe OpenAiCommands do
|
|
23
23
|
FileUtils.rm_rf('joke.txt')
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
# TODO: Enable test once the paid account is setup
|
27
|
+
# it 'creates a file using open ai' do
|
28
|
+
# open_ai.new.invoke(:make, nil, ['tell me a joke', '--path', 'joke.txt'])
|
29
|
+
# expect(File).to be_size('joke.txt')
|
30
|
+
# end
|
30
31
|
|
31
32
|
it 'edits an existing file using open ai' do
|
32
33
|
FileUtils.touch('joke.txt')
|
@@ -14,6 +14,16 @@ describe RspecGenerator do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
shared_examples 'creates factory files' do |project_name|
|
18
|
+
it 'creates a model factory file' do
|
19
|
+
expect(File).to exist("#{project_name}/models/model_factory.rb")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'creates the data for the factory' do
|
23
|
+
expect(File).to exist("#{project_name}/models/data/users.yml")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
17
27
|
shared_examples 'creates rspec files without examples' do |project_name, file_name|
|
18
28
|
it 'creates a spec file' do
|
19
29
|
expect(File).not_to exist("#{project_name}/spec/#{file_name}_page_spec.rb")
|
@@ -26,12 +36,14 @@ describe RspecGenerator do
|
|
26
36
|
|
27
37
|
context 'with rspec and selenium' do
|
28
38
|
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}", 'login'
|
39
|
+
include_examples 'creates factory files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
29
40
|
include_examples 'creates rspec files without examples',
|
30
41
|
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_without_examples", 'login'
|
31
42
|
end
|
32
43
|
|
33
44
|
context 'with rspec and watir' do
|
34
45
|
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}", 'login'
|
46
|
+
include_examples 'creates factory files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
35
47
|
include_examples 'creates rspec files without examples',
|
36
48
|
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_without_examples", 'login'
|
37
49
|
end
|