ruby_raider 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require_relative 'spec_helper'
|
3
|
+
require_relative '../lib/ruby_raider'
|
4
|
+
|
5
|
+
describe RubyRaider do
|
6
|
+
shared_examples 'execute framework' do |name|
|
7
|
+
it 'runs the tests' do
|
8
|
+
Bundler.with_unbundled_env do
|
9
|
+
Dir.chdir(name) do
|
10
|
+
`bundle exec raider u browser_options headless | raider u raid`
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with a Rspec and Selenium project' do
|
17
|
+
include_examples 'execute framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with a Rspec and Watir project' do
|
21
|
+
include_examples 'execute framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with a Cucumber and Selenium project' do
|
25
|
+
include_examples 'execute framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'with a Cucumber and Watir project' do
|
29
|
+
include_examples 'execute framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,27 +3,19 @@
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'rspec'
|
5
5
|
require_relative '../lib/generators/invoke_generators'
|
6
|
+
require_relative 'support/settings_helper'
|
6
7
|
|
7
8
|
AUTOMATION_TYPES = %w[android ios selenium watir cross_platform].freeze
|
8
9
|
FRAMEWORKS = %w[cucumber rspec].freeze
|
9
10
|
|
10
|
-
def create_settings(framework, automation, examples, visual)
|
11
|
-
{
|
12
|
-
automation: automation,
|
13
|
-
examples: examples,
|
14
|
-
framework: framework,
|
15
|
-
name: "#{framework}_#{automation}#{'_visual' if visual}#{'_without_examples' unless examples}",
|
16
|
-
visual: visual
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
11
|
RSpec.configure do |config|
|
21
12
|
config.include(InvokeGenerators)
|
13
|
+
config.include(SettingsHelper)
|
22
14
|
config.before(:all) do
|
23
15
|
FRAMEWORKS.each do |framework|
|
24
16
|
AUTOMATION_TYPES.each do |automation|
|
25
17
|
[true, false].product([true, false]) do |examples, visual|
|
26
|
-
settings = create_settings(framework, automation, examples, visual)
|
18
|
+
settings = create_settings(framework: framework, automation: automation, examples: examples, visual: visual)
|
27
19
|
generate_framework(settings)
|
28
20
|
end
|
29
21
|
end
|
@@ -34,7 +26,7 @@ RSpec.configure do |config|
|
|
34
26
|
FRAMEWORKS.each do |framework|
|
35
27
|
AUTOMATION_TYPES.each do |automation|
|
36
28
|
[true, false].product([true, false]) do |examples, visual|
|
37
|
-
settings = create_settings(framework, automation, examples, visual)
|
29
|
+
settings = create_settings(framework: framework, automation: automation, examples: examples, visual: visual)
|
38
30
|
FileUtils.rm_rf(settings[:name])
|
39
31
|
end
|
40
32
|
end
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- ".github/FUNDING.yml"
|
189
189
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
190
190
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
191
|
+
- ".github/auto_assign-issues.yml"
|
191
192
|
- ".github/workflows/reek.yml"
|
192
193
|
- ".github/workflows/rspec.yml"
|
193
194
|
- ".github/workflows/rubocop.yml"
|
@@ -204,6 +205,9 @@ files:
|
|
204
205
|
- lib/commands/open_ai_commands.rb
|
205
206
|
- lib/commands/scaffolding_commands.rb
|
206
207
|
- lib/commands/utility_commands.rb
|
208
|
+
- lib/desktop/components/base_component.rb
|
209
|
+
- lib/desktop/components/runner_components.rb
|
210
|
+
- lib/desktop/screens/runner_screen.rb
|
207
211
|
- lib/generators/automation/automation_examples_generator.rb
|
208
212
|
- lib/generators/automation/automation_generator.rb
|
209
213
|
- lib/generators/automation/templates/abstract_component.tt
|
@@ -249,6 +253,8 @@ files:
|
|
249
253
|
- lib/generators/rspec/rspec_examples_generator.rb
|
250
254
|
- lib/generators/rspec/rspec_generator.rb
|
251
255
|
- lib/generators/rspec/templates/base_spec.tt
|
256
|
+
- lib/generators/rspec/templates/data.tt
|
257
|
+
- lib/generators/rspec/templates/factory.tt
|
252
258
|
- lib/generators/rspec/templates/spec.tt
|
253
259
|
- lib/generators/templates/common/config.tt
|
254
260
|
- lib/generators/templates/common/gemfile.tt
|
@@ -257,6 +263,8 @@ files:
|
|
257
263
|
- lib/generators/templates/common/partials/web_config.tt
|
258
264
|
- lib/generators/templates/common/rakefile.tt
|
259
265
|
- lib/generators/templates/common/read_me.tt
|
266
|
+
- lib/generators/templates/common/reek.tt
|
267
|
+
- lib/generators/templates/common/rubocop.tt
|
260
268
|
- lib/generators/templates/helpers/allure_helper.tt
|
261
269
|
- lib/generators/templates/helpers/appium_helper.tt
|
262
270
|
- lib/generators/templates/helpers/browser_helper.tt
|
@@ -265,11 +273,9 @@ files:
|
|
265
273
|
- lib/generators/templates/helpers/partials/allure_requirements.tt
|
266
274
|
- lib/generators/templates/helpers/partials/driver_and_options.tt
|
267
275
|
- lib/generators/templates/helpers/partials/quit_driver.tt
|
268
|
-
- lib/generators/templates/helpers/partials/require_automation.tt
|
269
276
|
- lib/generators/templates/helpers/partials/screenshot.tt
|
270
277
|
- lib/generators/templates/helpers/partials/select_driver.tt
|
271
278
|
- lib/generators/templates/helpers/raider_helper.tt
|
272
|
-
- lib/generators/templates/helpers/selenium_helper.tt
|
273
279
|
- lib/generators/templates/helpers/spec_helper.tt
|
274
280
|
- lib/generators/templates/helpers/visual_helper.tt
|
275
281
|
- lib/generators/templates/helpers/visual_spec_helper.tt
|
@@ -288,6 +294,7 @@ files:
|
|
288
294
|
- spec/helpers_generator_spec.rb
|
289
295
|
- spec/open_ai_commands_spec.rb
|
290
296
|
- spec/rspec_generator_spec.rb
|
297
|
+
- spec/ruby_raider_spec.rb
|
291
298
|
- spec/scaffolding_commands_spec.rb
|
292
299
|
- spec/spec_helper.rb
|
293
300
|
- spec/utility_commands_spec.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'selenium-webdriver'
|
4
|
-
require_relative 'driver_helper'
|
5
|
-
|
6
|
-
module Raider
|
7
|
-
module SeleniumHelper
|
8
|
-
def click_when_present
|
9
|
-
# This is an example of an implicit wait in selenium
|
10
|
-
wait = Selenium::WebDriver::Wait.new(timeout: 15)
|
11
|
-
wait.until { displayed? }
|
12
|
-
click
|
13
|
-
end
|
14
|
-
|
15
|
-
def select_by(key, value)
|
16
|
-
# Creates new Select object to use the select by method
|
17
|
-
dropdown = Selenium::WebDriver::Support::Select.new self
|
18
|
-
dropdown.select_by(key, value)
|
19
|
-
end
|
20
|
-
|
21
|
-
def hover
|
22
|
-
# Using actions to move the mouse over an element
|
23
|
-
DriverHelper.driver.action.move_to(self).perform
|
24
|
-
end
|
25
|
-
|
26
|
-
# How to perform right click through the context click method
|
27
|
-
def right_click
|
28
|
-
DriverHelper.driver.action.context_click(self).perform
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Here we are opening the selenium class and adding our custom method
|
33
|
-
class Selenium::WebDriver::Element
|
34
|
-
include SeleniumHelper
|
35
|
-
end
|
36
|
-
end
|