ruby_raider 0.9.3 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/integration.yml +5 -5
  3. data/.github/workflows/selenium.yml +22 -0
  4. data/.github/workflows/watir.yml +22 -0
  5. data/README.md +24 -18
  6. data/lib/generators/automation/templates/account.tt +2 -2
  7. data/lib/generators/automation/templates/appium_caps.tt +2 -2
  8. data/lib/generators/automation/templates/home.tt +3 -2
  9. data/lib/generators/automation/templates/login.tt +2 -2
  10. data/lib/generators/automation/templates/page.tt +4 -4
  11. data/lib/generators/automation/templates/partials/element.tt +1 -1
  12. data/lib/generators/automation/templates/partials/home_page_selector.tt +2 -2
  13. data/lib/generators/automation/templates/partials/initialize_selector.tt +1 -1
  14. data/lib/generators/automation/templates/partials/pdp_page_selector.tt +2 -2
  15. data/lib/generators/automation/templates/partials/selenium_login.tt +1 -1
  16. data/lib/generators/automation/templates/partials/url_methods.tt +1 -1
  17. data/lib/generators/automation/templates/partials/visit_method.tt +2 -2
  18. data/lib/generators/automation/templates/pdp.tt +3 -2
  19. data/lib/generators/cucumber/templates/env.tt +6 -7
  20. data/lib/generators/cucumber/templates/feature.tt +7 -3
  21. data/lib/generators/cucumber/templates/partials/appium_env.tt +1 -4
  22. data/lib/generators/cucumber/templates/partials/driver_world.tt +4 -3
  23. data/lib/generators/cucumber/templates/partials/mobile_steps.tt +7 -7
  24. data/lib/generators/cucumber/templates/partials/selenium_env.tt +6 -6
  25. data/lib/generators/cucumber/templates/partials/watir_env.tt +1 -4
  26. data/lib/generators/cucumber/templates/partials/web_steps.tt +10 -3
  27. data/lib/generators/cucumber/templates/steps.tt +3 -3
  28. data/lib/generators/cucumber/templates/world.tt +1 -1
  29. data/lib/generators/generator.rb +15 -5
  30. data/lib/generators/helper_generator.rb +1 -1
  31. data/lib/generators/invoke_generators.rb +2 -6
  32. data/lib/generators/menu_generator.rb +7 -21
  33. data/lib/generators/rspec/rspec_generator.rb +1 -1
  34. data/lib/generators/rspec/templates/spec.tt +7 -7
  35. data/lib/generators/templates/common/config.tt +1 -1
  36. data/lib/generators/templates/common/gemfile.tt +13 -13
  37. data/lib/generators/templates/common/partials/automation_gems.tt +1 -1
  38. data/lib/generators/templates/common/partials/web_config.tt +1 -1
  39. data/lib/generators/templates/common/read_me.tt +21 -15
  40. data/lib/generators/templates/common/rubocop.tt +1 -1
  41. data/lib/generators/templates/helpers/allure_helper.tt +2 -2
  42. data/lib/generators/templates/helpers/driver_helper.tt +10 -8
  43. data/lib/generators/templates/helpers/partials/allure_imports.tt +1 -1
  44. data/lib/generators/templates/helpers/partials/allure_requirements.tt +1 -1
  45. data/lib/generators/templates/helpers/partials/driver_and_options.tt +3 -3
  46. data/lib/generators/templates/helpers/partials/quit_driver.tt +5 -6
  47. data/lib/generators/templates/helpers/partials/screenshot.tt +6 -7
  48. data/lib/generators/templates/helpers/spec_helper.tt +5 -5
  49. data/lib/utilities/utilities.rb +1 -1
  50. data/lib/version +1 -1
  51. data/spec/integration/commands/scaffolding_commands_spec.rb +1 -1
  52. data/spec/integration/commands/utility_commands_spec.rb +3 -3
  53. data/spec/integration/generators/actions_generator_spec.rb +1 -1
  54. data/spec/integration/generators/automation_generator_spec.rb +4 -4
  55. data/spec/integration/generators/common_generator_spec.rb +13 -20
  56. data/spec/integration/generators/cucumber_generator_spec.rb +2 -2
  57. data/spec/integration/generators/helpers_generator_spec.rb +13 -13
  58. data/spec/integration/generators/rspec_generator_spec.rb +2 -2
  59. data/spec/{support → integration}/settings_helper.rb +1 -3
  60. data/spec/integration/spec_helper.rb +33 -0
  61. data/spec/system/selenium_spec.rb +40 -0
  62. data/spec/system/watir_spec.rb +40 -0
  63. metadata +8 -6
  64. data/.github/workflows/rspec_selenium.yml +0 -42
  65. data/.github/workflows/rspec_watir.yml +0 -42
  66. data/spec/spec_helper.rb +0 -35
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../../../lib/generators/helper_generator'
4
- require_relative '../../spec_helper'
4
+ require_relative '../spec_helper'
5
5
 
6
6
  describe HelpersGenerator do
7
7
  shared_examples 'creates common helpers' do |name|
@@ -35,7 +35,7 @@ describe HelpersGenerator do
35
35
  end
36
36
 
37
37
  shared_examples 'creates cross platform helpers' do |name|
38
- it 'creates a browser helper file' do
38
+ it 'creates an appium helper file' do
39
39
  expect(File).to exist("#{name}/helpers/appium_helper.rb")
40
40
  end
41
41
  end
@@ -59,9 +59,9 @@ describe HelpersGenerator do
59
59
  end
60
60
 
61
61
  context 'with rspec, selenium and applitools' do
62
- include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
63
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
64
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
62
+ include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
63
+ include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
64
+ include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
65
65
  end
66
66
 
67
67
  context 'with cucumber and selenium' do
@@ -101,16 +101,16 @@ describe HelpersGenerator do
101
101
  end
102
102
 
103
103
  context 'with rspec and appium cross platform' do
104
- include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
105
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
106
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
107
- include_examples 'creates cross platform helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
104
+ include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
105
+ include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
106
+ include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
107
+ include_examples 'creates cross platform helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
108
108
  end
109
109
 
110
110
  context 'with cucumber and appium cross platform' do
111
- include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
112
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
113
- include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
114
- include_examples 'creates cross platform helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
111
+ include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
112
+ include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
113
+ include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
114
+ include_examples 'creates cross platform helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
115
115
  end
116
116
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../../../lib/generators/rspec/rspec_generator'
4
- require_relative '../../spec_helper'
4
+ require_relative '../spec_helper'
5
5
 
6
6
  describe RspecGenerator do
7
7
  shared_examples 'creates factory files' do |project_name|
@@ -44,6 +44,6 @@ describe RspecGenerator do
44
44
 
45
45
  context 'with rspec and appium cross platform' do
46
46
  include_examples 'creates rspec files examples',
47
- "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}", 'pdp'
47
+ "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}", 'pdp'
48
48
  end
49
49
  end
@@ -4,13 +4,11 @@
4
4
  module SettingsHelper
5
5
  def create_settings(options)
6
6
  automation = options[:automation]
7
- visual = options[:visual]
8
7
  framework = options[:framework]
9
8
  {
10
9
  automation:,
11
10
  framework:,
12
- name: "#{framework}_#{automation}#{'_visual' if visual}",
13
- visual:
11
+ name: "#{framework}_#{automation}"
14
12
  }
15
13
  end
16
14
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'rspec'
5
+ require_relative '../../lib/generators/invoke_generators'
6
+ require_relative 'settings_helper'
7
+
8
+ AUTOMATION_TYPES = %w[android ios selenium watir cross_platform axe applitools].freeze
9
+ FRAMEWORKS = %w[cucumber rspec].freeze
10
+
11
+ RSpec.configure do |config|
12
+ config.include(InvokeGenerators)
13
+ config.include(SettingsHelper)
14
+ # rubocop:disable RSpec/BeforeAfterAll
15
+ config.before(:all) do
16
+ FRAMEWORKS.each do |framework|
17
+ AUTOMATION_TYPES.each do |automation|
18
+ settings = create_settings(framework:, automation:)
19
+ generate_framework(settings)
20
+ end
21
+ end
22
+ end
23
+
24
+ config.after(:all) do
25
+ FRAMEWORKS.each do |framework|
26
+ AUTOMATION_TYPES.each do |automation|
27
+ settings = create_settings(framework:, automation:)
28
+ FileUtils.rm_rf(settings[:name])
29
+ end
30
+ end
31
+ end
32
+ end
33
+ # rubocop:enable RSpec/BeforeAfterAll
@@ -0,0 +1,40 @@
1
+ require_relative '../../lib/ruby_raider'
2
+
3
+ FRAMEWORKS = %w[cucumber rspec].freeze
4
+
5
+ describe 'Selenium based frameworks' do
6
+ before do
7
+ FRAMEWORKS.each do |framework|
8
+ RubyRaider::Raider
9
+ .new.invoke(:new, nil, %W[selenium_#{framework} -p framework:#{framework} automation:selenium])
10
+ end
11
+ end
12
+
13
+ after do
14
+ FRAMEWORKS.each do |framework|
15
+ FileUtils.rm_rf("selenium_#{framework}")
16
+ end
17
+ end
18
+
19
+ shared_examples 'creates web automation framework' do |type|
20
+ it 'executes without errors' do
21
+ run_tests_with(type)
22
+ expect($stdout).not_to match(/StandardError/)
23
+ end
24
+ end
25
+
26
+ context 'with rspec' do
27
+ include_examples 'creates web automation framework', 'rspec'
28
+ end
29
+
30
+ context 'with cucumber' do
31
+ include_examples 'creates web automation framework', 'cucumber'
32
+ end
33
+
34
+ private
35
+
36
+ def run_tests_with(framework)
37
+ folder = framework == 'rspec' ? 'spec' : 'features'
38
+ system("cd selenium_#{framework} && bundle install && raider utility browser_options chrome headless && bundle exec #{framework} #{folder}")
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ require_relative '../../lib/ruby_raider'
2
+
3
+ FRAMEWORKS = %w[cucumber rspec].freeze
4
+
5
+ describe 'Watir based frameworks' do
6
+ before do
7
+ FRAMEWORKS.each do |framework|
8
+ RubyRaider::Raider
9
+ .new.invoke(:new, nil, %W[watir_#{framework} -p framework:#{framework} automation:watir])
10
+ end
11
+ end
12
+
13
+ after do
14
+ FRAMEWORKS.each do |framework|
15
+ FileUtils.rm_rf("watir_#{framework}")
16
+ end
17
+ end
18
+
19
+ shared_examples 'creates web automation framework' do |type|
20
+ it 'executes without errors' do
21
+ run_tests_with(type)
22
+ expect($stdout).not_to match(/StandardError/)
23
+ end
24
+ end
25
+
26
+ context 'with rspec' do
27
+ include_examples 'creates web automation framework', 'rspec'
28
+ end
29
+
30
+ context 'with cucumber' do
31
+ include_examples 'creates web automation framework', 'cucumber'
32
+ end
33
+
34
+ private
35
+
36
+ def run_tests_with(framework)
37
+ folder = framework == 'rspec' ? 'spec' : 'features'
38
+ system("cd watir_#{framework} && bundle install && raider utility browser_options chrome headless && bundle exec #{framework} #{folder}")
39
+ end
40
+ 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.9.3
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-20 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -136,9 +136,9 @@ files:
136
136
  - ".github/workflows/integration.yml"
137
137
  - ".github/workflows/push_gem.yml"
138
138
  - ".github/workflows/reek.yml"
139
- - ".github/workflows/rspec_selenium.yml"
140
- - ".github/workflows/rspec_watir.yml"
141
139
  - ".github/workflows/rubocop.yml"
140
+ - ".github/workflows/selenium.yml"
141
+ - ".github/workflows/watir.yml"
142
142
  - ".gitignore"
143
143
  - ".reek.yml"
144
144
  - ".rubocop.yml"
@@ -240,8 +240,10 @@ files:
240
240
  - spec/integration/generators/cucumber_generator_spec.rb
241
241
  - spec/integration/generators/helpers_generator_spec.rb
242
242
  - spec/integration/generators/rspec_generator_spec.rb
243
- - spec/spec_helper.rb
244
- - spec/support/settings_helper.rb
243
+ - spec/integration/settings_helper.rb
244
+ - spec/integration/spec_helper.rb
245
+ - spec/system/selenium_spec.rb
246
+ - spec/system/watir_spec.rb
245
247
  homepage: https://github.com/RubyRaider/ruby_raider
246
248
  licenses:
247
249
  - MIT
@@ -1,42 +0,0 @@
1
- name: BrowserStack Test
2
- on: [ pull_request ]
3
-
4
- jobs:
5
- ubuntu-job:
6
- name: BrowserStack Test on Ubuntu
7
- runs-on: ubuntu-latest
8
- steps:
9
- - name: BrowserStack Env Setup
10
- uses: browserstack/github-actions/setup-env@master
11
- with:
12
- username: ${{ secrets.BROWSERSTACK_USERNAME }}
13
- access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
14
- build-name: BUILD_INFO
15
- project-name: REPO_NAME
16
- - name: BrowserStackLocal Setup
17
- uses: browserstack/github-actions/setup-local@master
18
- with:
19
- local-testing: start
20
-
21
-
22
- - name: Checkout the repository
23
- uses: actions/checkout@v2
24
-
25
- - name: Set up Ruby
26
- uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
27
- with:
28
- ruby-version: head
29
-
30
- - name: Install gems
31
- run: bundle install
32
-
33
- - name: Create Raider framework
34
- run: bin/raider new rspec_selenium -p framework:rspec automation:selenium visual:false axe:true
35
-
36
- - name: Run Raider tests
37
- run: cd rspec_selenium && bundle install && raider utility browser_options chrome headless && rspec spec/
38
-
39
- - name: BrowserStackLocal Stop
40
- uses: browserstack/github-actions/setup-local@master
41
- with:
42
- local-testing: stop
@@ -1,42 +0,0 @@
1
- name: BrowserStack Test
2
- on: [ pull_request ]
3
-
4
- jobs:
5
- ubuntu-job:
6
- name: BrowserStack Test on Ubuntu
7
- runs-on: ubuntu-latest
8
- steps:
9
- - name: BrowserStack Env Setup
10
- uses: browserstack/github-actions/setup-env@master
11
- with:
12
- username: ${{ secrets.BROWSERSTACK_USERNAME }}
13
- access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
14
- build-name: BUILD_INFO
15
- project-name: REPO_NAME
16
- - name: BrowserStackLocal Setup
17
- uses: browserstack/github-actions/setup-local@master
18
- with:
19
- local-testing: start
20
-
21
-
22
- - name: Checkout the repository
23
- uses: actions/checkout@v2
24
-
25
- - name: Set up Ruby
26
- uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
27
- with:
28
- ruby-version: head
29
-
30
- - name: Install gems
31
- run: bundle install
32
-
33
- - name: Create Raider framework
34
- run: bin/raider new rspec_watir -p framework:rspec automation:watir visual:false axe:true
35
-
36
- - name: Run Raider tests
37
- run: cd rspec_selenium && bundle install && raider utility browser_options chrome headless && rspec spec/
38
-
39
- - name: BrowserStackLocal Stop
40
- uses: browserstack/github-actions/setup-local@master
41
- with:
42
- local-testing: stop
data/spec/spec_helper.rb DELETED
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fileutils'
4
- require 'rspec'
5
- require_relative '../lib/generators/invoke_generators'
6
- require_relative 'support/settings_helper'
7
-
8
- AUTOMATION_TYPES = %w[android ios selenium watir cross_platform].freeze
9
- FRAMEWORKS = %w[cucumber rspec].freeze
10
-
11
- RSpec.configure do |config|
12
- config.include(InvokeGenerators)
13
- config.include(SettingsHelper)
14
- config.before(:all) do
15
- FRAMEWORKS.each do |framework|
16
- AUTOMATION_TYPES.each do |automation|
17
- [true, false].each do |visual|
18
- settings = create_settings(framework:, automation:, visual:)
19
- generate_framework(settings)
20
- end
21
- end
22
- end
23
- end
24
-
25
- config.after(:all) do
26
- FRAMEWORKS.each do |framework|
27
- AUTOMATION_TYPES.each do |automation|
28
- [true, false].each do |visual|
29
- settings = create_settings(framework:, automation:, visual:)
30
- FileUtils.rm_rf(settings[:name])
31
- end
32
- end
33
- end
34
- end
35
- end