ruby_raider 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -4
- data/lib/generators/automation/templates/home.tt +1 -20
- data/lib/generators/automation/templates/page.tt +1 -18
- data/lib/generators/automation/templates/pdp.tt +1 -21
- data/lib/generators/cucumber/templates/partials/appium_env.tt +0 -21
- data/lib/generators/cucumber/templates/partials/mobile_steps.tt +1 -21
- data/lib/generators/generator.rb +2 -2
- data/lib/generators/menu_generator.rb +0 -9
- data/lib/generators/rspec/templates/spec.tt +0 -17
- data/lib/generators/templates/common/gemfile.tt +0 -3
- data/lib/generators/templates/common/read_me.tt +0 -4
- data/lib/generators/templates/helpers/driver_helper.tt +1 -24
- data/lib/generators/templates/helpers/spec_helper.tt +0 -31
- data/lib/version +1 -1
- metadata +2 -3
- data/spec/system/ruby_raider_spec.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02747aaf5daa92a26aec43eefd65d6e3a9d84b3b83a0c0b678174f7f93d3725a
|
4
|
+
data.tar.gz: 3b754cbe2bb76ade7f7c37f5d7cee232c08432a9b4a3bf148fc9ec046a379a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3831dcce4173d9612da9a8710401c0f532b61f5811c4ef4f3fa3215329fcdb5768a256e61c6de33bb666ffba3745b078119dcef7feeea6173e94f396a9280c4c
|
7
|
+
data.tar.gz: 0e56906c04bdbea1f0925e7bb91ba4d799ec91fa47550cec9ba540960c1d4512c5c2f57f25e3ddda9fc79bbd5c3273187ad27c41e8dde3a541ee1cda6fd43f37
|
data/README.md
CHANGED
@@ -41,10 +41,6 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
|
41
41
|
| Rspec and Watir | | Rspec and Appium for Android |
|
42
42
|
| | | Cucumber and Appium Cross-platform |
|
43
43
|
| | | Rspec and Appium Cross-platform |
|
44
|
-
| | | Cucumber and Sparkling Watir for IOS |
|
45
|
-
| | | Rspec and Sparkling Watir for IOS |
|
46
|
-
|
47
|
-
|
48
44
|
|
49
45
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
50
46
|
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of the commands below:***
|
@@ -1,24 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../abstract/page'
|
4
|
-
<%- if automation == 'sparkling_ios' -%>
|
5
|
-
class Home < Page
|
6
|
-
|
7
|
-
# Actions
|
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 -%>
|
22
4
|
class Home < Page
|
23
5
|
|
24
6
|
# Actions
|
@@ -34,5 +16,4 @@ class Home < Page
|
|
34
16
|
def backpack_image
|
35
17
|
<%= ERB.new(File.read(File.expand_path('./partials/home_page_selector.tt', __dir__)), trim_mode: '-').result(binding) %>
|
36
18
|
end
|
37
|
-
end
|
38
|
-
<%- end -%>
|
19
|
+
end
|
@@ -1,19 +1,3 @@
|
|
1
|
-
<%- if automation == 'sparkling_ios' -%>
|
2
|
-
require 'sparkling_watir/element'
|
3
|
-
|
4
|
-
class Page
|
5
|
-
|
6
|
-
attr_reader :app
|
7
|
-
|
8
|
-
def initialize(app)
|
9
|
-
@app = app
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_s
|
13
|
-
self.class.to_s.sub('Page', ' Page')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
<%- else -%>
|
17
1
|
<%- if web? -%>
|
18
2
|
require_relative '../components/header'
|
19
3
|
<%- end -%>
|
@@ -43,5 +27,4 @@ class Page
|
|
43
27
|
Header.new(browser.element(id: 'customer_menu_top'))
|
44
28
|
end
|
45
29
|
<%- end -%>
|
46
|
-
end
|
47
|
-
<%- end -%>
|
30
|
+
end
|
@@ -1,23 +1,4 @@
|
|
1
1
|
require_relative '../abstract/page'
|
2
|
-
<%- if automation == 'sparkling_ios' -%>
|
3
|
-
class Pdp < Page
|
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 -%>
|
20
|
-
|
21
2
|
class Pdp < Page
|
22
3
|
|
23
4
|
# Actions
|
@@ -33,5 +14,4 @@ class Pdp < Page
|
|
33
14
|
def add_to_cart_button
|
34
15
|
<%= ERB.new(File.read(File.expand_path('./partials/pdp_page_selector.tt', __dir__)), trim_mode: '-').result(binding) %>
|
35
16
|
end
|
36
|
-
end
|
37
|
-
<%- end -%>
|
17
|
+
end
|
@@ -1,23 +1,3 @@
|
|
1
|
-
<%- if automation == 'sparkling_ios' -%>
|
2
|
-
require 'tmpdir'
|
3
|
-
require_relative '../../helpers/allure_helper'
|
4
|
-
require_relative '../../helpers/driver_helper'
|
5
|
-
|
6
|
-
include DriverHelper
|
7
|
-
|
8
|
-
Before do
|
9
|
-
AllureHelper.configure
|
10
|
-
app
|
11
|
-
end
|
12
|
-
|
13
|
-
After do |scenario|
|
14
|
-
Dir.mktmpdir do |temp_folder|
|
15
|
-
screenshot = app.screenshot.save("#{temp_folder}/#{scenario.name}.png")
|
16
|
-
AllureHelper.add_screenshot(scenario.name, screenshot)
|
17
|
-
end
|
18
|
-
app.close
|
19
|
-
end
|
20
|
-
<%- else -%>
|
21
1
|
require 'tmpdir'
|
22
2
|
require_relative '../../helpers/allure_helper'
|
23
3
|
require_relative '../../helpers/driver_helper'
|
@@ -36,4 +16,3 @@ After do |scenario|
|
|
36
16
|
end
|
37
17
|
driver.quit_driver
|
38
18
|
end
|
39
|
-
<%- end -%>
|
@@ -1,22 +1,3 @@
|
|
1
|
-
<%- if automation == 'sparkling_ios' -%>
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require_relative '../../page_objects/pages/home'
|
5
|
-
require_relative '../../page_objects/pages/pdp'
|
6
|
-
|
7
|
-
Given("I'm an anonymous user on the home page") do
|
8
|
-
@home_page = Home.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 = Pdp.new(app)
|
17
|
-
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
18
|
-
end
|
19
|
-
<%- else -%>
|
20
1
|
# frozen_string_literal: true
|
21
2
|
|
22
3
|
<% if automation == 'cross_platform' -%>
|
@@ -36,5 +17,4 @@ end
|
|
36
17
|
When("I'm redirected to the product details page") do
|
37
18
|
pdp_page = Pdp.new(driver)
|
38
19
|
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
39
|
-
end
|
40
|
-
<%- end -%>
|
20
|
+
end
|
data/lib/generators/generator.rb
CHANGED
@@ -31,11 +31,11 @@ class Generator < Thor::Group
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def mobile?
|
34
|
-
(args & %w[android ios cross_platform
|
34
|
+
(args & %w[android ios cross_platform]).count.positive?
|
35
35
|
end
|
36
36
|
|
37
37
|
def single_platform?
|
38
|
-
(args & %w[android ios
|
38
|
+
(args & %w[android ios]).count.positive?
|
39
39
|
end
|
40
40
|
|
41
41
|
def rspec?
|
@@ -31,7 +31,6 @@ class MenuGenerator
|
|
31
31
|
|
32
32
|
def choose_test_framework(automation)
|
33
33
|
return choose_mobile_platform if automation == 'appium'
|
34
|
-
return choose_sparkling_platform if automation == 'sparkling'
|
35
34
|
|
36
35
|
select_test_framework(automation)
|
37
36
|
end
|
@@ -48,13 +47,6 @@ class MenuGenerator
|
|
48
47
|
system "cd #{name} && gem install bundler && bundle install"
|
49
48
|
end
|
50
49
|
|
51
|
-
def choose_sparkling_platform
|
52
|
-
prompt.select('Please select your mobile platform') do |menu|
|
53
|
-
menu.choice :iOS, -> { choose_test_framework 'sparkling_ios' }
|
54
|
-
menu.choice :Quit, -> { exit }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
50
|
def choose_mobile_platform
|
59
51
|
prompt.select('Please select your mobile platform') do |menu|
|
60
52
|
menu.choice :iOS, -> { choose_test_framework 'ios' }
|
@@ -110,7 +102,6 @@ class MenuGenerator
|
|
110
102
|
def select_automation_framework(menu)
|
111
103
|
menu.choice :Appium, -> { choose_test_framework('appium') }
|
112
104
|
menu.choice :Selenium, -> { choose_test_framework('selenium') }
|
113
|
-
menu.choice 'Sparkling Watir', -> { choose_test_framework('sparkling') }
|
114
105
|
menu.choice :Watir, -> { choose_test_framework('watir') }
|
115
106
|
menu.choice :Quit, -> { exit }
|
116
107
|
end
|
@@ -71,23 +71,6 @@ describe 'Login' do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
<%- end -%>
|
74
|
-
<%- elsif automation == 'sparkling_ios' -%>
|
75
|
-
require_relative '../helpers/spec_helper'
|
76
|
-
require_relative '../page_objects/pages/home'
|
77
|
-
require_relative '../page_objects/pages/pdp'
|
78
|
-
|
79
|
-
class PdpSpec
|
80
|
-
describe 'PDP page' do
|
81
|
-
|
82
|
-
let(:home_page) { Home.new(app) }
|
83
|
-
let(:pdp_page) { Pdp.new(app) }
|
84
|
-
|
85
|
-
it 'shows add to cart button' do
|
86
|
-
home_page.go_to_backpack_pdp
|
87
|
-
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
74
|
<%- else -%>
|
92
75
|
<% if automation == 'cross_platform' -%>
|
93
76
|
require_relative '../helpers/appium_helper'
|
@@ -35,10 +35,6 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
|
35
35
|
| Rspec and Watir | | Rspec and Appium for Android |
|
36
36
|
| | | Cucumber and Appium Cross-platform |
|
37
37
|
| | | Rspec and Appium Cross-platform |
|
38
|
-
| | | Cucumber and Sparkling Watir for IOS |
|
39
|
-
| | | Rspec and Sparkling Watir for IOS |
|
40
|
-
|
41
|
-
|
42
38
|
|
43
39
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
44
40
|
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of the commands below:***
|
@@ -1,25 +1,3 @@
|
|
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 -%>
|
23
1
|
# frozen_string_literal: true
|
24
2
|
<% if axe? -%>
|
25
3
|
require 'axe-selenium'
|
@@ -50,5 +28,4 @@ def driver
|
|
50
28
|
private
|
51
29
|
|
52
30
|
<%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
53
|
-
end
|
54
|
-
<%- end -%>
|
31
|
+
end
|
@@ -1,33 +1,3 @@
|
|
1
|
-
<%- if automation == 'sparkling_ios' -%>
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'rspec'
|
5
|
-
require 'tmpdir'
|
6
|
-
require_relative 'allure_helper'
|
7
|
-
require_relative 'driver_helper'
|
8
|
-
require 'sparkling_watir'
|
9
|
-
|
10
|
-
module SpecHelper
|
11
|
-
|
12
|
-
AllureHelper.configure
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.formatter = AllureHelper.formatter
|
15
|
-
config.include(DriverHelper)
|
16
|
-
config.before(:each) do
|
17
|
-
app
|
18
|
-
end
|
19
|
-
|
20
|
-
config.after(:each) do |example|
|
21
|
-
example_name = example.description
|
22
|
-
Dir.mktmpdir do |temp_folder|
|
23
|
-
screenshot = app.screenshot.save("#{temp_folder}/#{example_name}.png")
|
24
|
-
AllureHelper.add_screenshot(example_name, screenshot)
|
25
|
-
end
|
26
|
-
app.close
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
<%- else -%>
|
31
1
|
# frozen_string_literal: true
|
32
2
|
|
33
3
|
<%- if axe? %>
|
@@ -72,4 +42,3 @@ module SpecHelper
|
|
72
42
|
end
|
73
43
|
end
|
74
44
|
end
|
75
|
-
<%- end -%>
|
data/lib/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.3
|
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.
|
4
|
+
version: 0.9.3
|
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-
|
11
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -242,7 +242,6 @@ files:
|
|
242
242
|
- spec/integration/generators/rspec_generator_spec.rb
|
243
243
|
- spec/spec_helper.rb
|
244
244
|
- spec/support/settings_helper.rb
|
245
|
-
- spec/system/ruby_raider_spec.rb
|
246
245
|
homepage: https://github.com/RubyRaider/ruby_raider
|
247
246
|
licenses:
|
248
247
|
- MIT
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require_relative '../spec_helper'
|
3
|
-
require_relative '../../lib/ruby_raider'
|
4
|
-
|
5
|
-
describe RubyRaider do
|
6
|
-
shared_examples 'execute web frameworks' do |name|
|
7
|
-
it 'runs the tests' do
|
8
|
-
if ENV['CI']
|
9
|
-
Dir.chdir(name) { system('gem install bundler && bundle install && raider u raid') }
|
10
|
-
else
|
11
|
-
Bundler.with_unbundled_env { Dir.chdir(name) { system('bundle exec raider u raid') } }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'with a Rspec and Selenium project' do
|
17
|
-
include_examples 'execute web frameworks', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with a Rspec and Watir project' do
|
21
|
-
include_examples 'execute web frameworks', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with a Cucumber and Selenium project' do
|
25
|
-
include_examples 'execute web frameworks', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'with a Cucumber and Watir project' do
|
29
|
-
include_examples 'execute web frameworks', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
|
30
|
-
end
|
31
|
-
end
|