ruby_raider 0.7.5 → 0.7.6

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: 6187527f5296b729b6b97dfc897beb9d60809db17ab34fece7673c53a247be0f
4
- data.tar.gz: 2ac25c14abdc3c038390cf6ca0b1b1a36cab72366adef86c7cdf6d32984aadec
3
+ metadata.gz: a3c7392870379f23c003129b0c892eeb60cfd87fe7d0479e42670cfd9b20fc13
4
+ data.tar.gz: b09e4169504207c2af34d0a0a0f5846ab370c9df62cd1e350daf747c4980e1c9
5
5
  SHA512:
6
- metadata.gz: d999412e75b3f5b595d3615bc4664c0bc2c059385d8d397e970cce48565caa11712223654b6c28ae2892ba1ce03c3e72ddb305f272d9c61228053d93a7b92e8e
7
- data.tar.gz: 33f26594ee731b2dfce01861e13ee8423acca5411c583fe4d77784d54edea05f840cf95cdc85b70dcc15407ce041e8e3062dd46d35b9617a42c18e803dc5f276
6
+ metadata.gz: fc2e7a690f3ba2c6f23d2344ad7e634e4046bdfb7da082f4522f0a3736650f32767ac5ad8484649c26df8499624ba522e8f8b2f58122f42debcd54dae87c90bf
7
+ data.tar.gz: 2e12ed98a785fcee9f22310d4ead6b8de730eea67c092d319c183c5a1051c1317345186b14669e0f417cbe0ab4827390b2e49729704b779e1cb7e04e16305a3a
@@ -1,7 +1,19 @@
1
- <%- if automation == 'cross_platform' -%>
2
- require_relative '../../helpers/appium_helper'
3
- <% end -%>
1
+ <%- if automation == 'sparkling_ios' -%>
2
+ require 'sparkling_watir/element'
3
+
4
+ class AbstractPage
5
+
6
+ attr_reader :app
7
+
8
+ def initialize(app)
9
+ @app = app
10
+ end
4
11
 
12
+ def to_s
13
+ self.class.to_s.sub('Page', ' Page')
14
+ end
15
+ end
16
+ <%- else -%>
5
17
  class AbstractPage
6
18
  <% if automation == 'cross_platform' -%>
7
19
  include AppiumHelper
@@ -14,3 +26,4 @@ class AbstractPage
14
26
  self.class.to_s.sub('Page', ' Page')
15
27
  end
16
28
  end
29
+ <%- end -%>
@@ -1,4 +1,4 @@
1
- <% if automation == 'ios' %>
1
+ <% if automation.include?('ios') %>
2
2
  <%= ERB.new(File.read(File.expand_path('./partials/ios_caps.tt', __dir__))).result(binding) -%>
3
3
  <% elsif automation == 'android' %>
4
4
  <%= ERB.new(File.read(File.expand_path('./partials/android_caps.tt', __dir__))).result(binding) -%>
@@ -1,7 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../abstract/abstract_page'
4
+ <%- if automation == 'sparkling_ios' -%>
5
+ class HomePage < AbstractPage
6
+
7
+ # Actions
4
8
 
9
+ def go_to_backpack_pdp
10
+ app.tap on: backpack_image.wait_until(&:present?)
11
+ end
12
+
13
+ private
14
+
15
+ # Elements
16
+
17
+ def backpack_image
18
+ app.element(predicate: 'label == "Sauce Labs Backpack"')
19
+ end
20
+ end
21
+ <%- else -%>
5
22
  class HomePage < AbstractPage
6
23
 
7
24
  # Actions
@@ -18,3 +35,4 @@ class HomePage < AbstractPage
18
35
  <%= ERB.new(File.read(File.expand_path('./partials/home_page_selector.tt', __dir__)), trim_mode: '-').result(binding) %>
19
36
  end
20
37
  end
38
+ <%- end -%>
@@ -1,4 +1,22 @@
1
1
  require_relative '../abstract/abstract_page'
2
+ <%- if automation == 'sparkling_ios' -%>
3
+ class PdpPage < AbstractPage
4
+
5
+ # Actions
6
+
7
+ def add_to_cart_text
8
+ add_to_cart_button.wait_until(&:present?).text
9
+ end
10
+
11
+ private
12
+
13
+ # Elements
14
+
15
+ def add_to_cart_button
16
+ app.element(accessibility_id: 'Add To Cart button')
17
+ end
18
+ end
19
+ <%- else -%>
2
20
 
3
21
  class PdpPage < AbstractPage
4
22
 
@@ -16,3 +34,4 @@ class PdpPage < AbstractPage
16
34
  <%= ERB.new(File.read(File.expand_path('./partials/pdp_page_selector.tt', __dir__)), trim_mode: '-').result(binding) %>
17
35
  end
18
36
  end
37
+ <%- end -%>
@@ -1,3 +1,19 @@
1
+ <%- if automation == 'sparkling_ios' -%>
2
+ require_relative '../../helpers/driver_helper'
3
+
4
+ include DriverHelper
5
+
6
+ Before do
7
+ AllureHelper.configure
8
+ app
9
+ end
10
+
11
+ After do |scenario|
12
+ app.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
13
+ AllureHelper.add_screenshot(scenario.name)
14
+ app.close
15
+ end
16
+ <%- else -%>
1
17
  require_relative '../../helpers/driver_helper'
2
18
 
3
19
  include DriverHelper
@@ -11,4 +27,5 @@ After do |scenario|
11
27
  driver.screenshot("allure-results/screenshots/#{scenario.name}.png")
12
28
  AllureHelper.add_screenshot(scenario.name)
13
29
  driver.quit_driver
14
- end
30
+ end
31
+ <%- end -%>
@@ -1,3 +1,22 @@
1
+ <%- if automation == 'sparkling_ios' -%>
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../../page_objects/pages/home_page'
5
+ require_relative '../../page_objects/pages/pdp_page'
6
+
7
+ Given("I'm an anonymous user on the home page") do
8
+ @home_page = HomePage.new(app)
9
+ end
10
+
11
+ When('I select one of the products') do
12
+ @home_page.go_to_backpack_pdp
13
+ end
14
+
15
+ When("I'm redirected to the product details page") do
16
+ pdp_page = PdpPage.new(app)
17
+ expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
18
+ end
19
+ <%- else -%>
1
20
  # frozen_string_literal: true
2
21
 
3
22
  require_relative '../../page_objects/pages/home_page'
@@ -15,3 +34,4 @@ When("I'm redirected to the product details page") do
15
34
  pdp_page = PdpPage.new(driver)
16
35
  expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
17
36
  end
37
+ <%- end -%>
@@ -29,11 +29,11 @@ class Generator < Thor::Group
29
29
  end
30
30
 
31
31
  def mobile?
32
- (args & %w[android ios cross_platform]).count.positive?
32
+ (args & %w[android ios cross_platform sparkling_ios]).count.positive?
33
33
  end
34
34
 
35
35
  def single_platform?
36
- (args & %w[android ios]).count.positive?
36
+ (args & %w[android ios sparkling_ios]).count.positive?
37
37
  end
38
38
 
39
39
  def rspec?
@@ -19,6 +19,7 @@ class MenuGenerator
19
19
  prompt.select('Please select your automation framework') do |menu|
20
20
  menu.choice :Appium, -> { choose_test_framework('appium') }
21
21
  menu.choice :Selenium, -> { choose_test_framework('selenium') }
22
+ menu.choice 'Sparkling Watir', -> { choose_test_framework('sparkling') }
22
23
  menu.choice :Watir, -> { choose_test_framework('watir') }
23
24
  menu.choice :Quit, -> { exit }
24
25
  end
@@ -30,6 +31,7 @@ class MenuGenerator
30
31
 
31
32
  def choose_test_framework(automation)
32
33
  return choose_mobile_platform if automation == 'appium'
34
+ return choose_sparkling_platform if automation == 'sparkling'
33
35
 
34
36
  select_test_framework(automation)
35
37
  end
@@ -45,6 +47,13 @@ class MenuGenerator
45
47
  system "cd #{name} && gem install bundler && bundle install"
46
48
  end
47
49
 
50
+ def choose_sparkling_platform
51
+ prompt.select('Please select your mobile platform') do |menu|
52
+ menu.choice :iOS, -> { choose_test_framework 'sparkling_ios' }
53
+ menu.choice :Quit, -> { exit }
54
+ end
55
+ end
56
+
48
57
  def choose_mobile_platform
49
58
  prompt.select('Please select your mobile platform') do |menu|
50
59
  menu.choice :iOS, -> { choose_test_framework 'ios' }
@@ -42,6 +42,23 @@ describe 'Login' do
42
42
  end
43
43
  end
44
44
  end
45
+ <%- elsif automation == 'sparkling_ios' -%>
46
+ require_relative '../helpers/spec_helper'
47
+ require_relative '../page_objects/pages/home_page'
48
+ require_relative '../page_objects/pages/pdp_page'
49
+
50
+ class PdpSpec
51
+ describe 'PDP page' do
52
+
53
+ let(:home_page) { HomePage.new(app) }
54
+ let(:pdp_page) { PdpPage.new(app) }
55
+
56
+ it 'shows add to cart button' do
57
+ home_page.go_to_backpack_pdp
58
+ expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
59
+ end
60
+ end
61
+ end
45
62
  <%- else -%>
46
63
  require_relative '../helpers/spec_helper'
47
64
  require_relative '../page_objects/pages/home_page'
@@ -30,3 +30,6 @@ gem 'ruby_raider', '~> 0.7.0'
30
30
  <% if %w[selenium watir].include? automation -%>
31
31
  gem 'webdrivers'
32
32
  <% end -%>
33
+ <% if automation == 'sparkling_ios' -%>
34
+ gem 'sparkling_watir'
35
+ <% end -%>
@@ -1,3 +1,25 @@
1
+ <%- if automation == 'sparkling_ios' -%>
2
+ # frozen_string_literal: true
3
+ require 'yaml'
4
+ require 'sparkling_watir'
5
+
6
+ module DriverHelper
7
+ def app
8
+ @app ||= create_app
9
+ end
10
+
11
+ private
12
+
13
+ def create_app
14
+ @app = SparklingWatir::App.new(caps: caps)
15
+ end
16
+
17
+ # :reek:UtilityFunction
18
+ def caps
19
+ YAML.load_file('config/capabilities.yml')
20
+ end
21
+ end
22
+ <%- else -%>
1
23
  # frozen_string_literal: true
2
24
  require 'yaml'
3
25
  <% if automation == 'selenium' -%>
@@ -29,3 +51,4 @@ module DriverHelper
29
51
  end
30
52
  <%- end -%>
31
53
  end
54
+ <%- end -%>
@@ -1,3 +1,30 @@
1
+ <%- if automation == 'sparkling_ios' -%>
2
+ # frozen_string_literal: true
3
+
4
+ require 'rspec'
5
+ require_relative 'allure_helper'
6
+ require_relative 'driver_helper'
7
+ require 'sparkling_watir'
8
+
9
+ module SpecHelper
10
+
11
+ AllureHelper.configure
12
+ RSpec.configure do |config|
13
+ config.formatter = AllureHelper.formatter
14
+ config.include(DriverHelper)
15
+ config.before(:each) do
16
+ app
17
+ end
18
+
19
+ config.after(:each) do
20
+ example_name = self.class.descendant_filtered_examples.first.description
21
+ app.screenshot.save("allure-results/screenshots/#{example_name}.png")
22
+ AllureHelper.add_screenshot example_name
23
+ app.close
24
+ end
25
+ end
26
+ end
27
+ <%- else -%>
1
28
  # frozen_string_literal: true
2
29
 
3
30
  require 'rspec'
@@ -27,4 +54,5 @@ module SpecHelper
27
54
  <%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
28
55
  end
29
56
  end
30
- end
57
+ end
58
+ <%- 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.7.5'
5
+ s.version = '0.7.6'
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']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_raider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno