ruby_raider 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/Rakefile +2 -2
- data/lib/generators/automation_generator.rb +14 -10
- data/lib/generators/cucumber_generator.rb +10 -2
- data/lib/generators/menu_generator.rb +2 -2
- data/lib/generators/rspec_generator.rb +9 -1
- data/lib/generators/templates/automation/abstract_component.tt +2 -0
- data/lib/generators/templates/automation/abstract_page.tt +0 -1
- data/lib/generators/templates/automation/appium_settings.tt +5 -8
- data/lib/generators/templates/automation/component.tt +1 -1
- data/lib/generators/templates/automation/home_page.tt +9 -5
- data/lib/generators/templates/automation/login_page.tt +0 -2
- data/lib/generators/templates/automation/partials/android_settings.tt +8 -0
- data/lib/generators/templates/automation/partials/element.tt +3 -3
- data/lib/generators/templates/automation/partials/initialize_selector.tt +4 -0
- data/lib/generators/templates/automation/partials/ios_settings.tt +8 -0
- data/lib/generators/templates/automation/partials/selenium_login.tt +3 -3
- data/lib/generators/templates/automation/partials/watir_login.tt +3 -3
- data/lib/generators/templates/automation/pdp_page.tt +22 -0
- data/lib/generators/templates/cucumber/feature.tt +9 -0
- data/lib/generators/templates/cucumber/partials/appium_env.tt +7 -5
- data/lib/generators/templates/cucumber/partials/driver_world.tt +1 -0
- data/lib/generators/templates/cucumber/partials/mobile_steps.tt +8 -11
- data/lib/generators/templates/cucumber/partials/watir_world.tt +1 -0
- data/lib/generators/templates/cucumber/partials/web_steps.tt +1 -1
- data/lib/generators/templates/cucumber/world.tt +5 -0
- data/lib/generators/templates/helpers/driver_helper.tt +0 -1
- data/lib/generators/templates/helpers/partials/select_driver.tt +5 -4
- data/lib/generators/templates/rspec/spec.tt +8 -13
- data/ruby_raider.gemspec +1 -1
- data/spec/automation_generator_spec.rb +87 -84
- data/spec/rspec_generator_spec.rb +22 -3
- metadata +8 -4
- data/lib/generators/templates/automation/confirmation_page.tt +0 -19
- data/lib/generators/templates/automation/partials/appium_login.tt +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 717ea9978a9909bc5d4d78f717b8da94ebc7e76945ec638ceeb35bb9aa5a9281
|
4
|
+
data.tar.gz: f6f390ee74bc484a763e4e0daf8f4cd08a5e8ed630d5284656a18efc0bffe91d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61718cc0edcd9dd89d65d25e0aa80032351921495bdcb3b4f69808e93ba448c1c859f2289e8008a94d7efd5987524fc510c8e17bc3e6a19ffa7b0dfa7828aa2c
|
7
|
+
data.tar.gz: ce72aba02cf4813232ba7c3e4b0f5ec8d7688b56194ab066d32c8cd6a95c76f5395b16c5fece33150408191d4c95e15e66dd929d1eab497beb0bd28ed895c87f
|
data/README.md
CHANGED
@@ -43,7 +43,11 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
|
43
43
|
|
44
44
|
* Generating a framework with Cucumber and Appium for IOS
|
45
45
|
|
46
|
-
|
46
|
+
* Generating a framework with Rspec and Appium for Android
|
47
|
+
|
48
|
+
* Generating a framework with Cucumber and Appium for Android
|
49
|
+
|
50
|
+
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
47
51
|
|
48
52
|
This works in all the platforms (Tested on Mac OS, Linux and Windows).
|
49
53
|
|
data/Rakefile
CHANGED
@@ -4,8 +4,8 @@ require_relative 'lib/ruby_raider'
|
|
4
4
|
require_relative 'lib/commands/scaffolding_commands'
|
5
5
|
|
6
6
|
desc 'Creates a new test project'
|
7
|
-
task :new do
|
8
|
-
|
7
|
+
task :new, [:name] do |_t, args|
|
8
|
+
system "bin/raider -n #{args.name}"
|
9
9
|
end
|
10
10
|
|
11
11
|
desc 'Creates a page'
|
@@ -4,6 +4,8 @@ require_relative 'generator'
|
|
4
4
|
|
5
5
|
class AutomationGenerator < Generator
|
6
6
|
def generate_login_page
|
7
|
+
return unless (@_initializer.first & %w[android ios]).empty?
|
8
|
+
|
7
9
|
template('automation/login_page.tt', "#{name}/page_objects/pages/login_page.rb")
|
8
10
|
end
|
9
11
|
|
@@ -12,30 +14,32 @@ class AutomationGenerator < Generator
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def generate_home_page
|
15
|
-
return
|
17
|
+
return if (@_initializer.first & %w[android ios]).empty?
|
16
18
|
|
17
19
|
template('automation/home_page.tt', "#{name}/page_objects/pages/home_page.rb")
|
18
20
|
end
|
19
21
|
|
22
|
+
def generate_pdp_page
|
23
|
+
return if (@_initializer.first & %w[android ios]).empty?
|
24
|
+
|
25
|
+
template('automation/pdp_page.tt', "#{name}/page_objects/pages/pdp_page.rb")
|
26
|
+
end
|
27
|
+
|
20
28
|
def generate_header_component
|
21
|
-
return
|
29
|
+
return unless (@_initializer.first & %w[android ios]).empty?
|
22
30
|
|
23
31
|
template('automation/component.tt', "#{name}/page_objects/components/header_component.rb")
|
24
32
|
end
|
25
33
|
|
26
34
|
def generate_abstract_component
|
27
|
-
return
|
35
|
+
return unless (@_initializer.first & %w[android ios]).empty?
|
28
36
|
|
29
37
|
template('automation/abstract_component.tt', "#{name}/page_objects/abstract/abstract_component.rb")
|
30
38
|
end
|
31
39
|
|
32
|
-
def generate_confirmation_page
|
33
|
-
return unless @_initializer.first.include?('appium_ios')
|
34
|
-
|
35
|
-
template('automation/confirmation_page.tt', "#{name}/page_objects/pages/confirmation_page.rb")
|
36
|
-
end
|
37
|
-
|
38
40
|
def generate_appium_settings
|
39
|
-
|
41
|
+
return if (@_initializer.first & %w[android ios]).empty?
|
42
|
+
|
43
|
+
template('automation/appium_settings.tt', "#{name}/appium.txt")
|
40
44
|
end
|
41
45
|
end
|
@@ -4,14 +4,22 @@ require_relative 'generator'
|
|
4
4
|
|
5
5
|
class CucumberGenerator < Generator
|
6
6
|
def generate_feature
|
7
|
-
template('cucumber/feature.tt', "#{name}/features
|
7
|
+
template('cucumber/feature.tt', "#{name}/features/#{template_name}.feature")
|
8
8
|
end
|
9
9
|
|
10
10
|
def generate_steps
|
11
|
-
template('cucumber/steps.tt', "#{name}/features/step_definitions
|
11
|
+
template('cucumber/steps.tt', "#{name}/features/step_definitions/#{template_name}_steps.rb")
|
12
12
|
end
|
13
13
|
|
14
14
|
def generate_env_file
|
15
15
|
template('cucumber/env.tt', "#{name}/features/support/env.rb")
|
16
16
|
end
|
17
|
+
|
18
|
+
def generate_world
|
19
|
+
template('cucumber/world.tt', "#{name}/world.rb")
|
20
|
+
end
|
21
|
+
|
22
|
+
def template_name
|
23
|
+
@template_name ||= (@_initializer.first & %w[android ios]).empty? ? 'login' : 'home'
|
24
|
+
end
|
17
25
|
end
|
@@ -39,8 +39,8 @@ class MenuGenerator
|
|
39
39
|
|
40
40
|
def choose_mobile_platform
|
41
41
|
prompt.select('Please select your mobile platform') do |menu|
|
42
|
-
menu.choice :iOS, -> { choose_test_framework '
|
43
|
-
menu.choice :Android, -> {
|
42
|
+
menu.choice :iOS, -> { choose_test_framework 'ios' }
|
43
|
+
menu.choice :Android, -> { choose_test_framework 'android' }
|
44
44
|
menu.choice :Cross_Platform, -> { error_handling('Cross Platform') }
|
45
45
|
menu.choice :Quit, -> { exit }
|
46
46
|
end
|
@@ -3,10 +3,18 @@
|
|
3
3
|
require_relative 'generator'
|
4
4
|
|
5
5
|
class RspecGenerator < Generator
|
6
|
-
def
|
6
|
+
def generate_login_spec
|
7
|
+
return unless (@_initializer.first & %w[android ios]).empty?
|
8
|
+
|
7
9
|
template('rspec/spec.tt', "#{name}/spec/login_page_spec.rb")
|
8
10
|
end
|
9
11
|
|
12
|
+
def generate_pdp_spec
|
13
|
+
return if (@_initializer.first & %w[android ios]).empty?
|
14
|
+
|
15
|
+
template('rspec/spec.tt', "#{name}/spec/pdp_page_spec.rb")
|
16
|
+
end
|
17
|
+
|
10
18
|
def generate_base_spec
|
11
19
|
template('rspec/base_spec.tt', "#{name}/spec/base_spec.rb")
|
12
20
|
end
|
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
[appium_lib]
|
8
|
-
server_url = "http://127.0.0.1:4723/wd/hub"
|
1
|
+
<% if automation == 'ios' %>
|
2
|
+
<%= ERB.new(File.read(File.expand_path('./partials/ios_settings.tt', __dir__))).result(binding) -%>
|
3
|
+
<% else %>
|
4
|
+
<%= ERB.new(File.read(File.expand_path('./partials/android_settings.tt', __dir__))).result(binding) -%>
|
5
|
+
<% end %>
|
@@ -4,17 +4,21 @@ require_relative '../abstract/abstract_page'
|
|
4
4
|
|
5
5
|
class HomePage < AbstractPage
|
6
6
|
|
7
|
-
#Actions
|
7
|
+
# Actions
|
8
8
|
|
9
|
-
def
|
10
|
-
|
9
|
+
def go_to_backpack_pdp
|
10
|
+
driver.wait { backpack_image }.click
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
15
|
# Elements
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def backpack_image
|
18
|
+
<% if automation == 'ios' %>
|
19
|
+
driver.find_element(predicate: 'label == "Sauce Labs Backpack"')
|
20
|
+
<% else %>
|
21
|
+
driver.find_element(xpath: '(//android.view.ViewGroup[@content-desc="store item"])[1]/android.view.ViewGroup[1]')
|
22
|
+
<% end %>
|
19
23
|
end
|
20
24
|
end
|
@@ -3,6 +3,4 @@
|
|
3
3
|
<%= ERB.new(File.read(File.expand_path('./partials/selenium_login.tt', __dir__))).result(binding) %>
|
4
4
|
<% when 'watir' -%>
|
5
5
|
<%= ERB.new(File.read(File.expand_path('./partials/watir_login.tt', __dir__))).result(binding) %>
|
6
|
-
<% else -%>
|
7
|
-
<%= ERB.new(File.read(File.expand_path('./partials/appium_login.tt', __dir__))).result(binding) %>
|
8
6
|
<% end -%>
|
@@ -27,14 +27,14 @@ class LoginPage < AbstractPage
|
|
27
27
|
# Elements
|
28
28
|
|
29
29
|
def username_field
|
30
|
-
|
30
|
+
driver.find_element(id: 'loginFrm_loginname')
|
31
31
|
end
|
32
32
|
|
33
33
|
def password_field
|
34
|
-
|
34
|
+
driver.find_element(id: 'loginFrm_password')
|
35
35
|
end
|
36
36
|
|
37
37
|
def login_button
|
38
|
-
|
38
|
+
driver.find_element(xpath: "//button[@title='Login']")
|
39
39
|
end
|
40
40
|
end
|
@@ -26,14 +26,14 @@ class LoginPage < AbstractPage
|
|
26
26
|
# Elements
|
27
27
|
|
28
28
|
def username_field
|
29
|
-
|
29
|
+
browser.text_field(id: 'loginFrm_loginname')
|
30
30
|
end
|
31
31
|
|
32
32
|
def password_field
|
33
|
-
|
33
|
+
browser.text_field(id: 'loginFrm_password')
|
34
34
|
end
|
35
35
|
|
36
36
|
def login_button
|
37
|
-
|
37
|
+
browser.button(xpath: "//button[@title='Login']")
|
38
38
|
end
|
39
39
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../abstract/abstract_page'
|
2
|
+
|
3
|
+
class PdpPage < AbstractPage
|
4
|
+
|
5
|
+
# Actions
|
6
|
+
|
7
|
+
def add_to_cart_text
|
8
|
+
driver.wait { add_to_cart_button }.text
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# Elements
|
14
|
+
|
15
|
+
def add_to_cart_button
|
16
|
+
<% if automation == 'ios' %>
|
17
|
+
driver.find_element(accessibility_id: 'Add To Cart button')
|
18
|
+
<% else %>
|
19
|
+
driver.find_element(xpath: '//android.view.ViewGroup[@content-desc="Add To Cart button"]/android.widget.TextView')
|
20
|
+
<% end %>
|
21
|
+
end
|
22
|
+
end
|
@@ -1,6 +1,15 @@
|
|
1
|
+
<% if %w[selenium watir].include? automation -%>
|
1
2
|
Feature: Login Page
|
2
3
|
|
3
4
|
Scenario: A user can login
|
4
5
|
Given I'm a registered user on the login page
|
5
6
|
When I login with my credentials
|
6
7
|
Then I can see the main page
|
8
|
+
<% else -%>
|
9
|
+
Feature: Home Page
|
10
|
+
|
11
|
+
Scenario: A user can go to the product details page
|
12
|
+
Given I'm an anonymous user on the home page
|
13
|
+
When I select one of the products
|
14
|
+
Then I'm redirected to the product details page
|
15
|
+
<% end %>
|
@@ -1,13 +1,15 @@
|
|
1
1
|
require_relative '../../helpers/driver_helper'
|
2
2
|
|
3
|
+
include Raider::DriverHelper
|
4
|
+
|
3
5
|
Before do
|
4
6
|
Raider::AllureHelper.configure
|
5
|
-
|
6
|
-
|
7
|
+
new_driver
|
8
|
+
driver.start_driver
|
7
9
|
end
|
8
10
|
|
9
11
|
After do |scenario|
|
10
|
-
|
12
|
+
driver.screenshot("allure-results/screenshots/#{scenario.name}.png")
|
11
13
|
Raider::AllureHelper.add_screenshot(scenario.name)
|
12
|
-
|
13
|
-
end
|
14
|
+
driver.quit_driver
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
World(DriverHelper)
|
@@ -1,20 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../../page_objects/pages/confirmation_page'
|
4
3
|
require_relative '../../page_objects/pages/home_page'
|
5
|
-
require_relative '../../page_objects/pages/
|
4
|
+
require_relative '../../page_objects/pages/pdp_page'
|
6
5
|
|
7
|
-
Given("I'm
|
8
|
-
home_page = HomePage.new(
|
9
|
-
home_page.go_to_login
|
6
|
+
Given("I'm an anonymous user on the home page") do
|
7
|
+
@home_page = HomePage.new(driver)
|
10
8
|
end
|
11
9
|
|
12
|
-
When('I
|
13
|
-
|
14
|
-
login_page.login('alice', 'mypassword')
|
10
|
+
When('I select one of the products') do
|
11
|
+
@home_page.go_to_backpack_pdp
|
15
12
|
end
|
16
13
|
|
17
|
-
When('
|
18
|
-
|
19
|
-
expect(
|
14
|
+
When("I'm redirected to the product details page") do
|
15
|
+
pdp_page = PdpPage.new(driver)
|
16
|
+
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
20
17
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
World(BrowserHelper)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative '../../page_objects/pages/login_page'
|
4
4
|
|
5
5
|
Given("I'm a registered user on the login page") do
|
6
|
-
@login_page = LoginPage.new(<% if automation == 'watir'
|
6
|
+
@login_page = LoginPage.new(<% if automation == 'watir'%>browser<% else %>driver<% end %>)
|
7
7
|
@login_page.visit
|
8
8
|
end
|
9
9
|
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<% if %w[watir].include? automation -%>
|
2
|
+
<%= ERB.new(File.read(File.expand_path('./partials/watir_world.tt', __dir__))).result(binding).strip! -%>
|
3
|
+
<% else -%>
|
4
|
+
<%= ERB.new(File.read(File.expand_path('./partials/driver_world.tt', __dir__))).result(binding).strip! -%>
|
5
|
+
<% end -%>
|
@@ -29,24 +29,19 @@ describe 'Login' do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
<% else -%>
|
32
|
-
require_relative '../page_objects/pages/confirmation_page'
|
33
32
|
require_relative '../page_objects/pages/home_page'
|
34
33
|
require_relative 'base_spec'
|
35
|
-
require_relative '../page_objects/pages/
|
34
|
+
require_relative '../page_objects/pages/pdp_page'
|
36
35
|
|
37
|
-
class
|
38
|
-
describe '
|
36
|
+
class PdpSpec < BaseSpec
|
37
|
+
describe 'PDP page' do
|
39
38
|
|
40
|
-
let(:
|
41
|
-
let(:
|
42
|
-
let(:login_page) { LoginPage.new(@driver) }
|
43
|
-
let(:home_page) { HomePage.new(@driver) }
|
44
|
-
let(:confirmation_page) { ConfirmationPage.new(@driver) }
|
39
|
+
let(:home_page) { HomePage.new(driver) }
|
40
|
+
let(:pdp_page) { PdpPage.new(driver) }
|
45
41
|
|
46
|
-
it '
|
47
|
-
home_page.
|
48
|
-
|
49
|
-
expect(confirmation_page.login_message).to eq 'You are logged in as alice'
|
42
|
+
it 'shows add to cart button' do
|
43
|
+
home_page.go_to_backpack_pdp
|
44
|
+
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
50
45
|
end
|
51
46
|
end
|
52
47
|
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.
|
5
|
+
s.version = '0.4.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']
|
@@ -58,34 +58,49 @@ describe AutomationGenerator do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
context 'with appium' do
|
61
|
+
context 'with rspec and appium on ios' do
|
62
62
|
before(:all) do
|
63
|
-
@name = 'rspec-appium'
|
64
|
-
AutomationGenerator.new(['
|
63
|
+
@name = 'rspec-appium-ios'
|
64
|
+
AutomationGenerator.new(['ios', 'rspec', @name]).invoke_all
|
65
65
|
end
|
66
66
|
|
67
|
-
it 'creates a
|
68
|
-
expect(File.exist?("#{@name}/page_objects/pages/
|
67
|
+
it 'creates a home page file' do
|
68
|
+
expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'creates an abstract page file' do
|
72
72
|
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
73
73
|
end
|
74
74
|
|
75
|
-
it
|
76
|
-
expect(File.exist?("#{@name}/page_objects/
|
75
|
+
it 'creates a pdp page file' do
|
76
|
+
expect(File.exist?("#{@name}/page_objects/pages/pdp_page.rb")).to be_truthy
|
77
77
|
end
|
78
78
|
|
79
|
-
it
|
80
|
-
expect(File.exist?("#{@name}/
|
79
|
+
it 'creates an appium config file' do
|
80
|
+
expect(File.exist?("#{@name}/appium.txt")).to be_truthy
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
after(:all) do
|
84
|
+
FileUtils.rm_rf(@name)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'with rspec and appium on android' do
|
89
|
+
before(:all) do
|
90
|
+
@name = 'rspec-appium-android'
|
91
|
+
AutomationGenerator.new(['android', 'rspec', @name]).invoke_all
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'creates a home page file' do
|
84
95
|
expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
|
85
96
|
end
|
86
97
|
|
87
|
-
it 'creates
|
88
|
-
expect(File.exist?("#{@name}/page_objects/
|
98
|
+
it 'creates an abstract page file' do
|
99
|
+
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'creates a pdp page file' do
|
103
|
+
expect(File.exist?("#{@name}/page_objects/pages/pdp_page.rb")).to be_truthy
|
89
104
|
end
|
90
105
|
|
91
106
|
it 'creates an appium config file' do
|
@@ -95,98 +110,86 @@ describe AutomationGenerator do
|
|
95
110
|
after(:all) do
|
96
111
|
FileUtils.rm_rf(@name)
|
97
112
|
end
|
113
|
+
end
|
98
114
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
it 'creates a login page file' do
|
106
|
-
expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'creates an abstract page file' do
|
110
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'creates an abstract component file' do
|
114
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
|
115
|
-
end
|
115
|
+
context 'with cucumber and selenium' do
|
116
|
+
before(:all) do
|
117
|
+
@name = 'cucumber-selenium'
|
118
|
+
AutomationGenerator.new(['selenium', 'cucumber', @name]).invoke_all
|
119
|
+
end
|
116
120
|
|
117
|
-
|
118
|
-
|
119
|
-
|
121
|
+
it 'creates a login page file' do
|
122
|
+
expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
|
123
|
+
end
|
120
124
|
|
121
|
-
|
122
|
-
|
123
|
-
end
|
125
|
+
it 'creates an abstract page file' do
|
126
|
+
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
124
127
|
end
|
125
128
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
AutomationGenerator.new(['watir', 'cucumber', @name]).invoke_all
|
130
|
-
end
|
129
|
+
it 'creates an abstract component file' do
|
130
|
+
expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
|
131
|
+
end
|
131
132
|
|
132
|
-
|
133
|
-
|
134
|
-
|
133
|
+
it 'creates a component file' do
|
134
|
+
expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
|
135
|
+
end
|
135
136
|
|
136
|
-
|
137
|
-
|
138
|
-
|
137
|
+
after(:all) do
|
138
|
+
FileUtils.rm_rf(@name)
|
139
|
+
end
|
140
|
+
end
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
-
|
142
|
+
context 'with cucumber and watir' do
|
143
|
+
before(:all) do
|
144
|
+
@name = 'cucumber-watir'
|
145
|
+
AutomationGenerator.new(['watir', 'cucumber', @name]).invoke_all
|
146
|
+
end
|
143
147
|
|
144
|
-
|
145
|
-
|
146
|
-
|
148
|
+
it 'creates a login page file' do
|
149
|
+
expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
|
150
|
+
end
|
147
151
|
|
148
|
-
|
149
|
-
|
150
|
-
end
|
152
|
+
it 'creates an abstract page file' do
|
153
|
+
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
151
154
|
end
|
152
155
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
AutomationGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
|
157
|
-
end
|
156
|
+
it 'creates an abstract component file' do
|
157
|
+
expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
|
158
|
+
end
|
158
159
|
|
159
|
-
|
160
|
-
|
161
|
-
|
160
|
+
it 'creates a component file' do
|
161
|
+
expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
|
162
|
+
end
|
162
163
|
|
163
|
-
|
164
|
-
|
165
|
-
|
164
|
+
after(:all) do
|
165
|
+
FileUtils.rm_rf(@name)
|
166
|
+
end
|
167
|
+
end
|
166
168
|
|
167
|
-
|
168
|
-
|
169
|
-
|
169
|
+
context 'with cucumber and appium' do
|
170
|
+
before(:all) do
|
171
|
+
@name = 'cucumber-appium'
|
172
|
+
AutomationGenerator.new(['ios', 'cucumber', @name]).invoke_all
|
173
|
+
end
|
170
174
|
|
171
|
-
|
172
|
-
|
173
|
-
|
175
|
+
it 'creates a home page file' do
|
176
|
+
expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
|
177
|
+
end
|
174
178
|
|
175
|
-
|
176
|
-
|
177
|
-
|
179
|
+
it 'creates an abstract page file' do
|
180
|
+
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
181
|
+
end
|
178
182
|
|
179
|
-
|
180
|
-
|
181
|
-
|
183
|
+
it 'creates a pdp page file' do
|
184
|
+
expect(File.exist?("#{@name}/page_objects/pages/pdp_page.rb")).to be_truthy
|
185
|
+
end
|
182
186
|
|
183
|
-
|
184
|
-
|
185
|
-
|
187
|
+
it 'creates an appium config file' do
|
188
|
+
expect(File.exist?("#{@name}/appium.txt")).to be_truthy
|
189
|
+
end
|
186
190
|
|
187
|
-
|
188
|
-
|
189
|
-
end
|
191
|
+
after(:all) do
|
192
|
+
FileUtils.rm_rf(@name)
|
190
193
|
end
|
191
194
|
end
|
192
195
|
end
|
@@ -42,14 +42,33 @@ describe RspecGenerator do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
context 'with appium' do
|
45
|
+
context 'with ios appium' do
|
46
46
|
before(:all) do
|
47
47
|
@name = 'rspec-appium'
|
48
|
-
RspecGenerator.new(['
|
48
|
+
RspecGenerator.new(['ios', 'rspec', @name]).invoke_all
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'creates a spec file' do
|
52
|
-
expect(File.exist?("#{@name}/spec/
|
52
|
+
expect(File.exist?("#{@name}/spec/pdp_page_spec.rb")).to be_truthy
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'creates the base spec file' do
|
56
|
+
expect(File.exist?("#{@name}/spec/base_spec.rb")).to be_truthy
|
57
|
+
end
|
58
|
+
|
59
|
+
after(:all) do
|
60
|
+
FileUtils.rm_rf(@name)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with android appium' do
|
65
|
+
before(:all) do
|
66
|
+
@name = 'rspec-appium'
|
67
|
+
RspecGenerator.new(['android', 'rspec', @name]).invoke_all
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'creates a spec file' do
|
71
|
+
expect(File.exist?("#{@name}/spec/pdp_page_spec.rb")).to be_truthy
|
53
72
|
end
|
54
73
|
|
55
74
|
it 'creates the base spec file' do
|
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.
|
4
|
+
version: 0.4.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: 2022-
|
11
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -143,17 +143,18 @@ files:
|
|
143
143
|
- lib/generators/templates/automation/abstract_page.tt
|
144
144
|
- lib/generators/templates/automation/appium_settings.tt
|
145
145
|
- lib/generators/templates/automation/component.tt
|
146
|
-
- lib/generators/templates/automation/confirmation_page.tt
|
147
146
|
- lib/generators/templates/automation/home_page.tt
|
148
147
|
- lib/generators/templates/automation/login_page.tt
|
149
|
-
- lib/generators/templates/automation/partials/
|
148
|
+
- lib/generators/templates/automation/partials/android_settings.tt
|
150
149
|
- lib/generators/templates/automation/partials/element.tt
|
151
150
|
- lib/generators/templates/automation/partials/initialize_selector.tt
|
151
|
+
- lib/generators/templates/automation/partials/ios_settings.tt
|
152
152
|
- lib/generators/templates/automation/partials/require_raider.tt
|
153
153
|
- lib/generators/templates/automation/partials/selenium_login.tt
|
154
154
|
- lib/generators/templates/automation/partials/url_methods.tt
|
155
155
|
- lib/generators/templates/automation/partials/visit_method.tt
|
156
156
|
- lib/generators/templates/automation/partials/watir_login.tt
|
157
|
+
- lib/generators/templates/automation/pdp_page.tt
|
157
158
|
- lib/generators/templates/common/config.tt
|
158
159
|
- lib/generators/templates/common/gemfile.tt
|
159
160
|
- lib/generators/templates/common/partials/automation_gems.tt
|
@@ -162,11 +163,14 @@ files:
|
|
162
163
|
- lib/generators/templates/cucumber/env.tt
|
163
164
|
- lib/generators/templates/cucumber/feature.tt
|
164
165
|
- lib/generators/templates/cucumber/partials/appium_env.tt
|
166
|
+
- lib/generators/templates/cucumber/partials/driver_world.tt
|
165
167
|
- lib/generators/templates/cucumber/partials/mobile_steps.tt
|
166
168
|
- lib/generators/templates/cucumber/partials/selenium_appium_env.tt
|
167
169
|
- lib/generators/templates/cucumber/partials/watir_env.tt
|
170
|
+
- lib/generators/templates/cucumber/partials/watir_world.tt
|
168
171
|
- lib/generators/templates/cucumber/partials/web_steps.tt
|
169
172
|
- lib/generators/templates/cucumber/steps.tt
|
173
|
+
- lib/generators/templates/cucumber/world.tt
|
170
174
|
- lib/generators/templates/helpers/allure_helper.tt
|
171
175
|
- lib/generators/templates/helpers/browser_helper.tt
|
172
176
|
- lib/generators/templates/helpers/driver_helper.tt
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../abstract/abstract_page'
|
4
|
-
|
5
|
-
class ConfirmationPage < AbstractPage
|
6
|
-
#Values
|
7
|
-
|
8
|
-
def login_message
|
9
|
-
@driver.wait { message_element }.text
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
# Elements
|
15
|
-
|
16
|
-
def message_element
|
17
|
-
@driver.find_element(accessibility_id: 'You are logged in as alice')
|
18
|
-
end
|
19
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require_relative '../abstract/abstract_page'
|
2
|
-
|
3
|
-
class LoginPage < AbstractPage
|
4
|
-
|
5
|
-
# Actions
|
6
|
-
|
7
|
-
def login(username, password)
|
8
|
-
username_field.send_keys username
|
9
|
-
password_field.send_keys password
|
10
|
-
login_button.click
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
# Elements
|
16
|
-
|
17
|
-
def username_field
|
18
|
-
@driver.find_element(xpath: "//XCUIElementTypeTextField[@name=\"username\"]")
|
19
|
-
end
|
20
|
-
|
21
|
-
def password_field
|
22
|
-
@driver.find_element(xpath: "//XCUIElementTypeSecureTextField[@name=\"password\"]")
|
23
|
-
end
|
24
|
-
|
25
|
-
def login_button
|
26
|
-
@driver.find_elements(xpath: "//XCUIElementTypeOther[@name=\"loginBtn\"]").last
|
27
|
-
end
|
28
|
-
end
|