ruby_raider 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/automation/automation_generator.rb +7 -7
- data/lib/generators/automation/templates/component.tt +4 -4
- data/lib/generators/automation/templates/header.tt +9 -0
- data/lib/generators/automation/templates/{home_page.tt → home.tt} +3 -3
- data/lib/generators/automation/templates/page.tt +45 -0
- data/lib/generators/automation/templates/partials/selenium_account.tt +2 -2
- data/lib/generators/automation/templates/partials/selenium_login.tt +2 -2
- data/lib/generators/automation/templates/partials/watir_account.tt +2 -2
- data/lib/generators/automation/templates/partials/watir_login.tt +3 -2
- data/lib/generators/automation/templates/{pdp_page.tt → pdp.tt} +3 -3
- data/lib/generators/cucumber/templates/partials/mobile_steps.tt +6 -6
- data/lib/generators/cucumber/templates/partials/web_steps.tt +4 -4
- data/lib/generators/rspec/templates/spec.tt +14 -14
- data/lib/generators/templates/helpers/spec_helper.tt +1 -1
- data/lib/ruby_raider.rb +1 -1
- data/ruby_raider.gemspec +1 -1
- data/spec/automation_generator_spec.rb +1 -1
- metadata +9 -9
- data/lib/generators/automation/templates/abstract_component.tt +0 -9
- data/lib/generators/automation/templates/abstract_page.tt +0 -47
- /data/lib/generators/automation/templates/{account_page.tt → account.tt} +0 -0
- /data/lib/generators/automation/templates/{login_page.tt → login.tt} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2baf71e8ae4c89c2a2d8065d9c8e5dd1b295b9efcb53d1ecd1e9732b7bc3149
|
4
|
+
data.tar.gz: 51277d989955c36486496791c86556eadee9ccba99859b4bf521c178cecd60fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066b4da6d3042c898a0468e293e7539fed2643cb6f09444e07033df2b96baab16dccafac4037e9d86f4f49bbd4d14b01003ee2cb93f370c663ac7a2d2e6033a9
|
7
|
+
data.tar.gz: b9b4c25a4c895328c016c917a9bd67f0773a9c7afa1c420f9740183ecf9554c73831b690393cfdcbafe8c0d107d1852a878634ffbd6eb19516aff6307d543c97
|
@@ -36,11 +36,11 @@ class AutomationGenerator < Generator
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def generate_abstract_page
|
39
|
-
template('
|
39
|
+
template('page.tt', "#{name}/page_objects/abstract/page.rb")
|
40
40
|
end
|
41
41
|
|
42
42
|
def generate_abstract_component
|
43
|
-
template('
|
43
|
+
template('component.tt', "#{name}/page_objects/abstract/component.rb")
|
44
44
|
end
|
45
45
|
|
46
46
|
def generate_appium_settings
|
@@ -54,23 +54,23 @@ class AutomationGenerator < Generator
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def generate_login_page
|
57
|
-
template('
|
57
|
+
template('login.tt', "#{name}/page_objects/pages/login.rb")
|
58
58
|
end
|
59
59
|
|
60
60
|
def generate_account_page
|
61
|
-
template('
|
61
|
+
template('account.tt', "#{name}/page_objects/pages/account.rb")
|
62
62
|
end
|
63
63
|
|
64
64
|
def generate_home_page
|
65
|
-
template('
|
65
|
+
template('home.tt', "#{name}/page_objects/pages/home.rb")
|
66
66
|
end
|
67
67
|
|
68
68
|
def generate_pdp_page
|
69
|
-
template('
|
69
|
+
template('pdp.tt', "#{name}/page_objects/pages/pdp.rb")
|
70
70
|
end
|
71
71
|
|
72
72
|
def generate_header_component
|
73
|
-
template('
|
73
|
+
template('header.tt', "#{name}/page_objects/components/header.rb")
|
74
74
|
end
|
75
75
|
|
76
76
|
def generate_model_factory
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
class Component
|
4
|
+
attr_reader :component
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
component.text
|
6
|
+
def initialize(component)
|
7
|
+
@component = component
|
8
8
|
end
|
9
9
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../abstract/
|
3
|
+
require_relative '../abstract/page'
|
4
4
|
<%- if automation == 'sparkling_ios' -%>
|
5
|
-
class
|
5
|
+
class Home < Page
|
6
6
|
|
7
7
|
# Actions
|
8
8
|
|
@@ -19,7 +19,7 @@ class HomePage < AbstractPage
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
<%- else -%>
|
22
|
-
class
|
22
|
+
class Home < Page
|
23
23
|
|
24
24
|
# Actions
|
25
25
|
|
@@ -0,0 +1,45 @@
|
|
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
|
+
<%- if web? -%>
|
18
|
+
require_relative '../components/header'
|
19
|
+
<%- end -%>
|
20
|
+
|
21
|
+
class Page
|
22
|
+
<%- if automation == 'cross_platform' -%>
|
23
|
+
include AppiumHelper
|
24
|
+
<%- end -%>
|
25
|
+
<%=- ERB.new(File.read(File.expand_path('./partials/initialize_selector.tt', __dir__))).result(binding) -%>
|
26
|
+
<%=- ERB.new(File.read(File.expand_path('./partials/visit_method.tt', __dir__))).result(binding) -%>
|
27
|
+
<%=- ERB.new(File.read(File.expand_path('./partials/url_methods.tt', __dir__))).result(binding) -%>
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
self.class.to_s.sub('Page', ' Page')
|
31
|
+
end
|
32
|
+
|
33
|
+
# Components
|
34
|
+
|
35
|
+
<%- if automation == 'selenium' -%>
|
36
|
+
def header
|
37
|
+
Header.new(driver.find_element(id: 'customer_menu_top'))
|
38
|
+
end
|
39
|
+
<%- elsif automation == 'watir' -%>
|
40
|
+
def header
|
41
|
+
Header.new(browser.element(id: 'customer_menu_top'))
|
42
|
+
end
|
43
|
+
<%- end -%>
|
44
|
+
end
|
45
|
+
<%- end -%>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative '../abstract/
|
1
|
+
require_relative '../abstract/page'
|
2
2
|
<%- if automation == 'sparkling_ios' -%>
|
3
|
-
class
|
3
|
+
class Pdp < Page
|
4
4
|
|
5
5
|
# Actions
|
6
6
|
|
@@ -18,7 +18,7 @@ class PdpPage < AbstractPage
|
|
18
18
|
end
|
19
19
|
<%- else -%>
|
20
20
|
|
21
|
-
class
|
21
|
+
class Pdp < Page
|
22
22
|
|
23
23
|
# Actions
|
24
24
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%- if automation == 'sparkling_ios' -%>
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative '../../page_objects/pages/
|
5
|
-
require_relative '../../page_objects/pages/
|
4
|
+
require_relative '../../page_objects/pages/home'
|
5
|
+
require_relative '../../page_objects/pages/pdp'
|
6
6
|
|
7
7
|
Given("I'm an anonymous user on the home page") do
|
8
|
-
@home_page =
|
8
|
+
@home_page = Home.new(app)
|
9
9
|
end
|
10
10
|
|
11
11
|
When('I select one of the products') do
|
@@ -13,7 +13,7 @@ When('I select one of the products') do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
When("I'm redirected to the product details page") do
|
16
|
-
pdp_page =
|
16
|
+
pdp_page = Pdp.new(app)
|
17
17
|
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
18
18
|
end
|
19
19
|
<%- else -%>
|
@@ -23,7 +23,7 @@ require_relative '../../page_objects/pages/home_page'
|
|
23
23
|
require_relative '../../page_objects/pages/pdp_page'
|
24
24
|
|
25
25
|
Given("I'm an anonymous user on the home page") do
|
26
|
-
@home_page =
|
26
|
+
@home_page = Home.new(driver)
|
27
27
|
end
|
28
28
|
|
29
29
|
When('I select one of the products') do
|
@@ -31,7 +31,7 @@ When('I select one of the products') do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
When("I'm redirected to the product details page") do
|
34
|
-
pdp_page =
|
34
|
+
pdp_page = Pdp.new(driver)
|
35
35
|
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
36
36
|
end
|
37
37
|
<%- end -%>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../../page_objects/pages/
|
4
|
-
require_relative '../../page_objects/pages/
|
3
|
+
require_relative '../../page_objects/pages/account'
|
4
|
+
require_relative '../../page_objects/pages/login'
|
5
5
|
|
6
6
|
Given("I'm a {user} on the login page") do |user|
|
7
7
|
@user = user
|
8
|
-
@login_page =
|
8
|
+
@login_page = Login.new(<% if automation == 'watir' %>browser<% else %>driver<% end %>)
|
9
9
|
@login_page.visit
|
10
10
|
end
|
11
11
|
|
@@ -14,7 +14,7 @@ When('I login with my credentials') do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
Then("I'm logged in") do
|
17
|
-
account_page =
|
17
|
+
account_page = Account.new(<% if automation == 'watir' %>browser<% else %>driver<% end %>)
|
18
18
|
<%- if visual_automation == true -%>
|
19
19
|
check_page account_page
|
20
20
|
<%- else -%>
|
@@ -3,15 +3,15 @@
|
|
3
3
|
|
4
4
|
require_relative '../helpers/spec_helper'
|
5
5
|
require_relative '../models/model_factory'
|
6
|
-
require_relative '../page_objects/pages/
|
7
|
-
require_relative '../page_objects/pages/
|
6
|
+
require_relative '../page_objects/pages/account'
|
7
|
+
require_relative '../page_objects/pages/login'
|
8
8
|
|
9
9
|
describe 'Login' do
|
10
10
|
subject(:header) { account_page.header.customer_name }
|
11
11
|
|
12
12
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
13
|
-
let(:login_page) {
|
14
|
-
let(:account_page) {
|
13
|
+
let(:login_page) { Login.new(<% if automation == 'watir' -%>browser<% else -%>driver<% end -%>) }
|
14
|
+
let(:account_page) { Account.new(<% if automation == 'watir' -%>browser<% else -%>driver<% end -%>) }
|
15
15
|
|
16
16
|
before do
|
17
17
|
login_page.visit
|
@@ -37,21 +37,21 @@ describe 'Login' do
|
|
37
37
|
<%- if visual_automation == true -%>
|
38
38
|
check_page login_page
|
39
39
|
<%- else -%>
|
40
|
-
expect(header).to
|
40
|
+
expect(header).to eq 'Login or register'
|
41
41
|
<%- end -%>
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
<%- elsif automation == 'sparkling_ios' -%>
|
46
46
|
require_relative '../helpers/spec_helper'
|
47
|
-
require_relative '../page_objects/pages/
|
48
|
-
require_relative '../page_objects/pages/
|
47
|
+
require_relative '../page_objects/pages/home'
|
48
|
+
require_relative '../page_objects/pages/pdp'
|
49
49
|
|
50
50
|
class PdpSpec
|
51
51
|
describe 'PDP page' do
|
52
52
|
|
53
|
-
let(:home_page) {
|
54
|
-
let(:pdp_page) {
|
53
|
+
let(:home_page) { Home.new(app) }
|
54
|
+
let(:pdp_page) { Pdp.new(app) }
|
55
55
|
|
56
56
|
it 'shows add to cart button' do
|
57
57
|
home_page.go_to_backpack_pdp
|
@@ -61,14 +61,14 @@ class PdpSpec
|
|
61
61
|
end
|
62
62
|
<%- else -%>
|
63
63
|
require_relative '../helpers/spec_helper'
|
64
|
-
require_relative '../page_objects/pages/
|
65
|
-
require_relative '../page_objects/pages/
|
64
|
+
require_relative '../page_objects/pages/home'
|
65
|
+
require_relative '../page_objects/pages/pdp'
|
66
66
|
|
67
67
|
class PdpSpec
|
68
|
-
describe 'PDP
|
68
|
+
describe 'PDP' do
|
69
69
|
|
70
|
-
let(:home_page) {
|
71
|
-
let(:pdp_page) {
|
70
|
+
let(:home_page) { Home.new(driver) }
|
71
|
+
let(:pdp_page) { Pdp.new(driver) }
|
72
72
|
|
73
73
|
it 'shows add to cart button' do
|
74
74
|
home_page.go_to_backpack_pdp
|
@@ -58,7 +58,7 @@ module SpecHelper
|
|
58
58
|
config.after(:each) do
|
59
59
|
example_name = self.class.descendant_filtered_examples.first.description
|
60
60
|
<%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
61
|
-
|
61
|
+
AllureHelper.add_screenshot example_name
|
62
62
|
<%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
63
63
|
end
|
64
64
|
end
|
data/lib/ruby_raider.rb
CHANGED
@@ -19,7 +19,7 @@ module RubyRaider
|
|
19
19
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
20
20
|
|
21
21
|
def version
|
22
|
-
puts 'The Ruby Raider version is 0.8.
|
22
|
+
puts 'The Ruby Raider version is 0.8.1, Happy testing!'
|
23
23
|
end
|
24
24
|
|
25
25
|
map 'v' => 'version'
|
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.8.
|
5
|
+
s.version = '0.8.1'
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_raider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.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-09-
|
11
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -200,13 +200,13 @@ files:
|
|
200
200
|
- lib/generators/actions/actions_generator.rb
|
201
201
|
- lib/generators/actions/templates/actions.tt
|
202
202
|
- lib/generators/automation/automation_generator.rb
|
203
|
-
- lib/generators/automation/templates/
|
204
|
-
- lib/generators/automation/templates/abstract_page.tt
|
205
|
-
- lib/generators/automation/templates/account_page.tt
|
203
|
+
- lib/generators/automation/templates/account.tt
|
206
204
|
- lib/generators/automation/templates/appium_caps.tt
|
207
205
|
- lib/generators/automation/templates/component.tt
|
208
|
-
- lib/generators/automation/templates/
|
209
|
-
- lib/generators/automation/templates/
|
206
|
+
- lib/generators/automation/templates/header.tt
|
207
|
+
- lib/generators/automation/templates/home.tt
|
208
|
+
- lib/generators/automation/templates/login.tt
|
209
|
+
- lib/generators/automation/templates/page.tt
|
210
210
|
- lib/generators/automation/templates/partials/android_caps.tt
|
211
211
|
- lib/generators/automation/templates/partials/cross_platform_caps.tt
|
212
212
|
- lib/generators/automation/templates/partials/element.tt
|
@@ -220,7 +220,7 @@ files:
|
|
220
220
|
- lib/generators/automation/templates/partials/visit_method.tt
|
221
221
|
- lib/generators/automation/templates/partials/watir_account.tt
|
222
222
|
- lib/generators/automation/templates/partials/watir_login.tt
|
223
|
-
- lib/generators/automation/templates/
|
223
|
+
- lib/generators/automation/templates/pdp.tt
|
224
224
|
- lib/generators/automation/templates/visual_options.tt
|
225
225
|
- lib/generators/common_generator.rb
|
226
226
|
- lib/generators/cucumber/cucumber_generator.rb
|
@@ -308,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
308
|
- !ruby/object:Gem::Version
|
309
309
|
version: '0'
|
310
310
|
requirements: []
|
311
|
-
rubygems_version: 3.4.
|
311
|
+
rubygems_version: 3.4.19
|
312
312
|
signing_key:
|
313
313
|
specification_version: 4
|
314
314
|
summary: A gem to make setup and start of UI automation projects easier
|
@@ -1,47 +0,0 @@
|
|
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
|
11
|
-
|
12
|
-
def to_s
|
13
|
-
self.class.to_s.sub('Page', ' Page')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
<%- else -%>
|
17
|
-
<% if web? -%>
|
18
|
-
require_relative '../components/header'
|
19
|
-
<% end -%>
|
20
|
-
|
21
|
-
class AbstractPage
|
22
|
-
|
23
|
-
<%- if automation == 'cross_platform' -%>
|
24
|
-
include AppiumHelper
|
25
|
-
<%- end -%>
|
26
|
-
<%= ERB.new(File.read(File.expand_path('./partials/initialize_selector.tt', __dir__))).result(binding) -%>
|
27
|
-
<%= ERB.new(File.read(File.expand_path('./partials/visit_method.tt', __dir__))).result(binding) -%>
|
28
|
-
<%= ERB.new(File.read(File.expand_path('./partials/url_methods.tt', __dir__))).result(binding) -%>
|
29
|
-
|
30
|
-
<%- if automation == 'selenium' -%>
|
31
|
-
# Components
|
32
|
-
|
33
|
-
def header
|
34
|
-
Header.new(driver.find_element(id: 'customernav'))
|
35
|
-
end
|
36
|
-
<%- elsif automation == 'watir' -%>
|
37
|
-
# Components
|
38
|
-
|
39
|
-
def header
|
40
|
-
Header.new(browser.element(id: 'customernav'))
|
41
|
-
end
|
42
|
-
<%- end -%>
|
43
|
-
def to_s
|
44
|
-
self.class.to_s.sub('Page', ' Page')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
<%- end -%>
|
File without changes
|
File without changes
|