ruby_raider 0.4.8 → 0.4.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 904822acb4d07440328f3b619533a79374988766b0882f668f31e32f8636adb3
4
- data.tar.gz: e64bfe97f99255eac84ee1f6e850b5ce02293b0bc0314e031d047ee67071e3f3
3
+ metadata.gz: 72809bc4815e52fc26dcd2986702462c2f80c58eea9d5d3ae4093b46b60497d3
4
+ data.tar.gz: 367da2b34c2cebb02ceef20c4bea7cd4928ed18be55f02bccfe6d6b41b73ba0e
5
5
  SHA512:
6
- metadata.gz: c77b13d45b719d5ab8add012d22f9b2c1016d53877441dc7b6b1a9fde39553c1eac5f951d8c9f1e5d7012eb14b9da162fc12c0d08274eb24791cb0fefb462b48
7
- data.tar.gz: 610e5101c0f09d3ba1898d03111745e0208705ad36a5337dce2fd44b381afa0116f1a050be4c19896f0a973ae36b26b81a65f0d009568821ea82fdfd162204d5
6
+ metadata.gz: a654e20f8320af80c083e7e4274ba18b4717a6ba070d858d0334ffae46785031b8e5098061fd54ca9d66562211dfedc797b17e34c81381bac7d4a388ad6e450f
7
+ data.tar.gz: 8209f8add377cae9e94ce8e2db3825cf1d6eb40f07432b49a5c1e098963e99d3cbd7086cf9a1e8109b41ea498772d875826d12486d0b83271fdc28668608c1d3
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ruby_raider.svg)](https://badge.fury.io/rb/ruby_raider)
4
4
  [![Rubocop](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml/badge.svg)](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml)
5
+ [![Gitter](https://badges.gitter.im/RubyRaider/community.svg)](https://gitter.im/RubyRaider/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5
6
 
6
7
  <!-- PROJECT LOGO -->
7
8
  <br />
@@ -53,6 +54,8 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
53
54
 
54
55
  * Generating a visual testing framework with Rspec, Applitools and Selenium
55
56
 
57
+ * Generating a visual testing framework with Rspec, Applitools and Watir
58
+
56
59
  ***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
57
60
 
58
61
  ***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.).***
@@ -67,18 +67,12 @@ class MenuGenerator
67
67
  private
68
68
 
69
69
  def framework_choice(framework, automation_type)
70
- visual_automation = if automation_type == 'selenium' && framework == 'Rspec'
71
- choose_visual_automation
72
- end
70
+ visual_automation = choose_visual_automation if %w[selenium watir].include?(automation_type) && framework == 'Rspec'
73
71
 
74
72
  set_up_framework(automation_type, framework.downcase, visual_automation)
75
73
  prompt.say("You have chosen to use #{framework} with #{automation_type}")
76
74
  end
77
75
 
78
- def error_handling(platform)
79
- pp "#{platform} appium is coming soon. Thank you for the interest"
80
- end
81
-
82
76
  def select_test_framework(automation)
83
77
  prompt.select('Please select your test framework') do |menu|
84
78
  menu.choice :Cucumber, -> { framework_choice('Cucumber', automation) }
@@ -3,8 +3,10 @@
3
3
  require_relative '../abstract/abstract_page'
4
4
 
5
5
  class AppPage < AbstractPage
6
+ <%- if automation == 'selenium' -%>
6
7
  using Raider::SeleniumHelper
7
8
 
9
+ <%- end -%>
8
10
  def url(_page)
9
11
  'app.html#'
10
12
  end
@@ -1,7 +1,7 @@
1
- <% if automation == 'selenium' && visual_automation == true %>
2
- <%= ERB.new(File.read(File.expand_path('./partials/visual_login.tt', __dir__))).result(binding) %>
1
+ <% if %w[selenium watir].include?(automation) && visual_automation == true %>
2
+ <%= ERB.new(File.read(File.expand_path('./partials/visual_login.tt', __dir__)), trim_mode: '-').result(binding) %>
3
3
  <% elsif automation == 'selenium' %>
4
- <%= ERB.new(File.read(File.expand_path('./partials/selenium_login.tt', __dir__))).result(binding) %>
4
+ <%= ERB.new(File.read(File.expand_path('./partials/selenium_login.tt', __dir__)), trim_mode: '-').result(binding) %>
5
5
  <% elsif automation == 'watir' %>
6
- <%= ERB.new(File.read(File.expand_path('./partials/watir_login.tt', __dir__))).result(binding) %>
6
+ <%= ERB.new(File.read(File.expand_path('./partials/watir_login.tt', __dir__)), trim_mode: '-').result(binding) %>
7
7
  <% end %>
@@ -3,7 +3,9 @@
3
3
  require_relative '../abstract/abstract_page'
4
4
 
5
5
  class LoginPage < AbstractPage
6
+ <%- if automation == 'selenium' -%>
6
7
  using Raider::SeleniumHelper
8
+ <%- end -%>
7
9
 
8
10
  def url(_page)
9
11
  'index.html'
@@ -12,7 +14,11 @@ class LoginPage < AbstractPage
12
14
  # Actions
13
15
 
14
16
  def login
17
+ <%- if automation == 'watir' -%>
18
+ login_button.click
19
+ <%- else -%>
15
20
  login_button.click_when_present
21
+ <%- end -%>
16
22
  end
17
23
 
18
24
  private
@@ -20,6 +26,10 @@ class LoginPage < AbstractPage
20
26
  # Elements
21
27
 
22
28
  def login_button
29
+ <%- if automation == 'watir' -%>
30
+ browser.element(id: 'log-in')
31
+ <%- else -%>
23
32
  driver.find_element(:id, 'log-in')
33
+ <%- end -%>
24
34
  end
25
- end
35
+ end
@@ -10,6 +10,7 @@ gem 'allure-cucumber'
10
10
  <% end -%>
11
11
  <% if visual_automation -%>
12
12
  gem 'eyes_selenium'
13
+ gem 'eyes_universal'
13
14
  <% end -%>
14
15
  <% unless visual_automation -%>
15
16
  gem 'parallel_split_test'
@@ -50,6 +50,8 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
50
50
 
51
51
  * Generating a visual testing framework with Rspec, Applitools and Selenium
52
52
 
53
+ * Generating a visual testing framework with Rspec, Applitools and Watir
54
+
53
55
  ***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
54
56
 
55
57
  ***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.).***
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raider
4
- <% if framework == 'rspec' -%>
4
+ <%- if framework == 'rspec' -%>
5
5
  require_relative 'spec_helper'
6
- <% end -%>
6
+ <%- end -%>
7
7
  <%= ERB.new(File.read(File.expand_path('./partials/require_automation.tt', __dir__))).result(binding).strip! %>
8
- <% if automation == 'watir' -%>
8
+ <%- if automation == 'watir' -%>
9
9
  require_relative 'browser_helper'
10
- <% else -%>
10
+ <%- else -%>
11
11
  require_relative 'driver_helper'
12
- <% end -%>
13
- <% unless visual_automation -%>
12
+ <%- end -%>
13
+ <%- unless visual_automation -%>
14
14
  require_relative 'allure_helper'
15
- <% end -%>
16
- <% if automation == 'cross_platform' -%>
15
+ <%- end -%>
16
+ <%- if automation == 'cross_platform' -%>
17
17
  require_relative 'appium_helper'
18
- <% end -%>
19
- <% if visual_automation -%>
18
+ <%- end -%>
19
+ <%- if visual_automation -%>
20
20
  require_relative 'visual_helper'
21
- <% end -%>
21
+ <%- end -%>
22
22
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/inflector'
3
4
  require 'eyes_selenium'
4
5
  require 'yaml'
5
6
 
@@ -2,20 +2,28 @@
2
2
 
3
3
  require 'rspec'
4
4
  require 'eyes_selenium'
5
+ <%- if automation == 'selenium' -%>
5
6
  require_relative 'driver_helper'
7
+ <%- else -%>
8
+ require_relative 'browser_helper'
9
+ <%- end -%>
6
10
  require_relative 'visual_helper'
7
11
 
8
12
  module Raider
9
13
  module SpecHelper
10
14
  RSpec.configure do |config|
11
- config.include(DriverHelper)
15
+ config.include(<%- if automation == 'watir' -%>BrowserHelper<% else -%>DriverHelper<%- end -%>)
12
16
  config.include(VisualHelper)
13
17
  config.before(:each) do
14
18
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
15
19
  @grid_runner = create_grid_runner
16
20
  @eyes = create_eyes(@grid_runner)
17
21
  configure_eyes @eyes
22
+ <%- if automation == 'selenium' -%>
18
23
  @driver = @eyes.open(driver: new_driver)
24
+ <%- else -%>
25
+ @driver = @eyes.open(driver: new_browser.driver)
26
+ <%- end -%>
19
27
  end
20
28
 
21
29
  config.after(:each) do
@@ -1,4 +1,4 @@
1
- <% if automation == 'selenium' && visual_automation == true %>
1
+ <% if %w[selenium watir].include?(automation) && visual_automation == true %>
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative 'base_spec'
@@ -6,10 +6,10 @@ require_relative '../page_objects/pages/login_page'
6
6
  require_relative '../page_objects/pages/app_page'
7
7
 
8
8
  describe 'Login Page' do
9
- let(:app_page) { AppPage.new(@driver) }
10
- let(:login_page) { LoginPage.new(@driver) }
9
+ let(:app_page) { AppPage.new(<% if automation == 'watir' -%>browser<% else -%>driver<% end -%>) }
10
+ let(:login_page) { LoginPage.new(<% if automation == 'watir' -%>browser<% else -%>driver<% end -%>) }
11
11
 
12
- before(:example) do
12
+ before do
13
13
  login_page.visit
14
14
  end
15
15
 
@@ -19,17 +19,16 @@ describe 'Login Page' do
19
19
  check_page app_page
20
20
  end
21
21
  end
22
-
23
- <% elsif %w[selenium watir].include? automation -%>
22
+ <%- elsif %w[selenium watir].include? automation -%>
24
23
  require_relative 'base_spec'
25
24
  require_relative '../page_objects/pages/login_page'
26
25
 
27
26
  describe 'Login' do
28
27
  let(:user_name) { 'aguspe' }
29
- let(:login_page) { LoginPage.new(<% if automation == 'watir' -%>@browser<% else -%>@driver<% end -%>) }
28
+ let(:login_page) { LoginPage.new(<% if automation == 'watir' -%>browser<% else -%>driver<% end -%>) }
30
29
  subject { login_page.header.customer_name }
31
30
 
32
- before(:example) do
31
+ before do
33
32
  login_page.visit
34
33
  login_page.login(user_name, password)
35
34
  end
@@ -50,7 +49,7 @@ describe 'Login' do
50
49
  end
51
50
  end
52
51
  end
53
- <% else -%>
52
+ <%- else -%>
54
53
  require_relative '../page_objects/pages/home_page'
55
54
  require_relative 'base_spec'
56
55
  require_relative '../page_objects/pages/pdp_page'
@@ -67,4 +66,4 @@ class PdpSpec < BaseSpec
67
66
  end
68
67
  end
69
68
  end
70
- <% end -%>
69
+ <%- 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.8'
5
+ s.version = '0.4.9'
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']
@@ -36,12 +36,28 @@ describe AutomationGenerator do
36
36
  end
37
37
  end
38
38
 
39
+ shared_examples 'creates web visual automation files' do |name|
40
+ it 'creates a login page file' do
41
+ expect(File).to exist("#{name}/page_objects/pages/login_page.rb")
42
+ end
43
+
44
+ it 'creates an abstract page file' do
45
+ expect(File).to exist("#{name}/page_objects/abstract/abstract_page.rb")
46
+ end
47
+
48
+ it 'creates an app page file' do
49
+ expect(File).to exist("#{name}/page_objects/pages/app_page.rb")
50
+ end
51
+ end
52
+
39
53
  context 'with rspec and selenium' do
40
54
  include_examples 'creates web automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
55
+ include_examples 'creates web visual automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
41
56
  end
42
57
 
43
58
  context 'with rspec and watir' do
44
59
  include_examples 'creates web automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
60
+ include_examples 'creates web visual automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
45
61
  end
46
62
 
47
63
  context 'with cucumber and selenium' do
@@ -25,7 +25,7 @@ describe CommonGenerator do
25
25
  end
26
26
 
27
27
  shared_examples 'creates a capabilities file' do |name|
28
- it 'creates a config file' do
28
+ it 'creates a capabilities file' do
29
29
  expect(File).to exist("#{name}/config/capabilities.yml")
30
30
  end
31
31
  end
@@ -36,6 +36,12 @@ describe CommonGenerator do
36
36
  end
37
37
  end
38
38
 
39
+ shared_examples 'creates an options file' do |name|
40
+ it 'creates an options file' do
41
+ expect(File).to exist("#{name}/config/options.yml")
42
+ end
43
+ end
44
+
39
45
  context 'with rspec and selenium' do
40
46
  include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
41
47
  include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
@@ -46,6 +52,18 @@ describe CommonGenerator do
46
52
  include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
47
53
  end
48
54
 
55
+ context 'with rspec, selenium and applitools' do
56
+ include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
57
+ include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
58
+ include_examples 'creates an options file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
59
+ end
60
+
61
+ context 'with rspec, watir and applitools' do
62
+ include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
63
+ include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
64
+ include_examples 'creates an options file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
65
+ end
66
+
49
67
  context 'with cucumber and selenium' do
50
68
  include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
51
69
  include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
@@ -44,6 +44,20 @@ describe HelpersGenerator do
44
44
  end
45
45
  end
46
46
 
47
+ shared_examples 'creates common visual helpers' do |name|
48
+ it 'does not create an allure helper file' do
49
+ expect(File).not_to exist("#{name}/helpers/allure_helper.rb")
50
+ end
51
+
52
+ it 'creates a raider file' do
53
+ expect(File).to exist("#{name}/helpers/raider.rb")
54
+ end
55
+
56
+ it 'creates a visual helper file' do
57
+ expect(File).to exist("#{name}/helpers/visual_helper.rb")
58
+ end
59
+ end
60
+
47
61
  context 'with rspec and selenium' do
48
62
  include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
49
63
  include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
@@ -56,6 +70,18 @@ describe HelpersGenerator do
56
70
  include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
57
71
  end
58
72
 
73
+ context 'with rspec, selenium and applitools' do
74
+ include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
75
+ include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
76
+ include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_visual"
77
+ end
78
+
79
+ context 'with rspec, watir and applitools' do
80
+ include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
81
+ include_examples 'creates watir helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
82
+ include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
83
+ end
84
+
59
85
  context 'with cucumber and selenium' do
60
86
  include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
61
87
  include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
data/spec/spec_helper.rb CHANGED
@@ -12,13 +12,17 @@ RSpec.configure do |config|
12
12
  FRAMEWORKS.each do |framework|
13
13
  AUTOMATION_TYPES.each do |automation|
14
14
  MenuGenerator.new("#{framework}_#{automation}").generate_framework(automation, framework, false)
15
+ MenuGenerator.new("#{framework}_#{automation}_visual").generate_framework(automation, framework, true)
15
16
  end
16
17
  end
17
18
  end
18
19
 
19
20
  config.after(:all) do
20
21
  FRAMEWORKS.each do |framework|
21
- AUTOMATION_TYPES.each { |automation| FileUtils.rm_rf("#{framework}_#{automation}") }
22
+ AUTOMATION_TYPES.each do |automation|
23
+ FileUtils.rm_rf("#{framework}_#{automation}")
24
+ FileUtils.rm_rf("#{framework}_#{automation}_visual")
25
+ end
22
26
  end
23
27
  end
24
28
  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.4.8
4
+ version: 0.4.9
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-12-22 00:00:00.000000000 Z
11
+ date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake