ruby_raider 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/helper_generator.rb +2 -10
- data/lib/generators/templates/automation/abstract_page.tt +4 -6
- data/lib/generators/templates/automation/appium_settings.tt +1 -1
- data/lib/generators/templates/automation/confirmation_page.tt +2 -2
- data/lib/generators/templates/automation/home_page.tt +2 -2
- data/lib/generators/templates/automation/login_page.tt +4 -4
- data/lib/generators/templates/automation/partials/appium_login.tt +3 -3
- data/lib/generators/templates/automation/partials/element.tt +5 -5
- data/lib/generators/templates/automation/partials/initialize_selector.tt +9 -0
- data/lib/generators/templates/automation/partials/selenium_login.tt +4 -4
- data/lib/generators/templates/automation/partials/visit_method.tt +1 -5
- data/lib/generators/templates/automation/partials/watir_login.tt +7 -9
- data/lib/generators/templates/common/gemfile.tt +6 -6
- data/lib/generators/templates/cucumber/env.tt +4 -4
- data/lib/generators/templates/cucumber/partials/appium_env.tt +4 -4
- data/lib/generators/templates/cucumber/partials/mobile_steps.tt +6 -3
- data/lib/generators/templates/cucumber/partials/selenium_appium_env.tt +3 -5
- data/lib/generators/templates/cucumber/partials/watir_env.tt +3 -4
- data/lib/generators/templates/cucumber/partials/web_steps.tt +4 -3
- data/lib/generators/templates/cucumber/steps.tt +3 -3
- data/lib/generators/templates/helpers/allure_helper.tt +1 -1
- data/lib/generators/templates/helpers/driver_helper.tt +3 -3
- data/lib/generators/templates/helpers/partials/require_automation.tt +0 -2
- data/lib/generators/templates/helpers/partials/screenshot.tt +3 -3
- data/lib/generators/templates/helpers/partials/select_driver.tt +8 -0
- data/lib/generators/templates/helpers/raider_helper.tt +5 -6
- data/lib/generators/templates/helpers/spec_helper.tt +4 -11
- data/lib/generators/templates/rspec/spec.tt +34 -18
- data/ruby_raider.gemspec +1 -1
- data/spec/cucumber_generator_spec.rb +8 -0
- data/spec/helpers_generator_spec.rb +8 -16
- metadata +4 -6
- data/lib/generators/templates/automation/partials/driver_selector.tt +0 -9
- data/lib/generators/templates/helpers/partials/driver_requirements.tt +0 -14
- data/lib/generators/templates/helpers/pom_helper.tt +0 -19
- data/lib/generators/templates/helpers/watir_helper.tt +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56bd6a11e678cd280d2652e3f09772b3e30079c713870e1822047b68794a632b
|
4
|
+
data.tar.gz: 668dd6b2cf904d2a5f1c2dd917930fc0108a8d63aad8a41a71accff6a25552b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a8aa084abb9dfb11ad52834f55b0f7d2c2f19df7e70bdfe2565faeaf831e1efd47e5e068f79d5d93323eee6808fc7ecded2669c62063d46cc3df2aa8dd00dc7
|
7
|
+
data.tar.gz: 31d7142a4b46e74ed855cc757d8038ae7dc8e2c60007d7847b705c17dc01bd3f879341b179a1840370ed9296dbdb59b51ea1ab5fe8f6e4e6bd8883f85af70881
|
@@ -19,17 +19,9 @@ module RubyRaider
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def generate_pom_helper
|
23
|
-
template('helpers/pom_helper.tt', "#{name}/helpers/pom_helper.rb")
|
24
|
-
end
|
25
|
-
|
26
22
|
def generate_spec_helper
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def generate_watir_helper
|
31
|
-
if @_initializer.first.include?('watir')
|
32
|
-
template('helpers/watir_helper.tt', "#{name}/helpers/watir_helper.rb")
|
23
|
+
if @_initializer.first.include?('rspec')
|
24
|
+
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb")
|
33
25
|
end
|
34
26
|
end
|
35
27
|
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'rspec'
|
2
|
-
<%= ERB.new(File.read(File.expand_path('./partials/require_raider.tt', __dir__))).result(binding)
|
2
|
+
<%= ERB.new(File.read(File.expand_path('./partials/require_raider.tt', __dir__)), nil, '-').result(binding) -%>
|
3
3
|
|
4
4
|
class AbstractPage
|
5
|
-
|
6
|
-
|
7
|
-
<%= ERB.new(File.read(File.expand_path('./partials/
|
8
|
-
<%= ERB.new(File.read(File.expand_path('./partials/visit_method.tt', __dir__))).result(binding) %>
|
9
|
-
<%= ERB.new(File.read(File.expand_path('./partials/url_methods.tt', __dir__))).result(binding) %>
|
5
|
+
<%= ERB.new(File.read(File.expand_path('./partials/initialize_selector.tt', __dir__))).result(binding) -%>
|
6
|
+
<%= ERB.new(File.read(File.expand_path('./partials/visit_method.tt', __dir__))).result(binding) -%>
|
7
|
+
<%= ERB.new(File.read(File.expand_path('./partials/url_methods.tt', __dir__))).result(binding) -%>
|
10
8
|
end
|
@@ -6,7 +6,7 @@ class ConfirmationPage < AbstractPage
|
|
6
6
|
#Values
|
7
7
|
|
8
8
|
def login_message
|
9
|
-
driver.wait { message_element }.text
|
9
|
+
@driver.wait { message_element }.text
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -14,6 +14,6 @@ class ConfirmationPage < AbstractPage
|
|
14
14
|
# Elements
|
15
15
|
|
16
16
|
def message_element
|
17
|
-
driver.find_element(accessibility_id: 'You are logged in as alice')
|
17
|
+
@driver.find_element(accessibility_id: 'You are logged in as alice')
|
18
18
|
end
|
19
19
|
end
|
@@ -7,7 +7,7 @@ class HomePage < AbstractPage
|
|
7
7
|
#Actions
|
8
8
|
|
9
9
|
def go_to_login
|
10
|
-
driver.wait { login_button_navigator }.click
|
10
|
+
@driver.wait { login_button_navigator }.click
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
@@ -15,6 +15,6 @@ class HomePage < AbstractPage
|
|
15
15
|
# Elements
|
16
16
|
|
17
17
|
def login_button_navigator
|
18
|
-
driver.find_element(accessibility_id: 'Login Screen')
|
18
|
+
@driver.find_element(accessibility_id: 'Login Screen')
|
19
19
|
end
|
20
20
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% case automation
|
2
|
-
when 'selenium'
|
2
|
+
when 'selenium' -%>
|
3
3
|
<%= ERB.new(File.read(File.expand_path('./partials/selenium_login.tt', __dir__))).result(binding) %>
|
4
|
-
<% when 'watir'
|
4
|
+
<% when 'watir' -%>
|
5
5
|
<%= ERB.new(File.read(File.expand_path('./partials/watir_login.tt', __dir__))).result(binding) %>
|
6
|
-
<% else
|
6
|
+
<% else -%>
|
7
7
|
<%= ERB.new(File.read(File.expand_path('./partials/appium_login.tt', __dir__))).result(binding) %>
|
8
|
-
<% end
|
8
|
+
<% end -%>
|
@@ -15,14 +15,14 @@ class LoginPage < AbstractPage
|
|
15
15
|
# Elements
|
16
16
|
|
17
17
|
def username_field
|
18
|
-
driver.find_element(xpath: "//XCUIElementTypeTextField[@name=\"username\"]")
|
18
|
+
@driver.find_element(xpath: "//XCUIElementTypeTextField[@name=\"username\"]")
|
19
19
|
end
|
20
20
|
|
21
21
|
def password_field
|
22
|
-
driver.find_element(xpath: "//XCUIElementTypeSecureTextField[@name=\"password\"]")
|
22
|
+
@driver.find_element(xpath: "//XCUIElementTypeSecureTextField[@name=\"password\"]")
|
23
23
|
end
|
24
24
|
|
25
25
|
def login_button
|
26
|
-
driver.find_elements(xpath: "//XCUIElementTypeOther[@name=\"loginBtn\"]").last
|
26
|
+
@driver.find_elements(xpath: "//XCUIElementTypeOther[@name=\"loginBtn\"]").last
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<% if %w[selenium appium_ios].include?(automation)
|
2
|
-
driver.find_element
|
3
|
-
<% else
|
4
|
-
browser.element
|
5
|
-
<% end
|
1
|
+
<% if %w[selenium appium_ios].include?(automation) -%>
|
2
|
+
@driver.find_element
|
3
|
+
<% else -%>
|
4
|
+
@browser.element
|
5
|
+
<% end -%>
|
@@ -19,7 +19,7 @@ class LoginPage < AbstractPage
|
|
19
19
|
# Components
|
20
20
|
|
21
21
|
def header
|
22
|
-
HeaderComponent.new(driver.find_element(class: 'menu_text'))
|
22
|
+
HeaderComponent.new(@driver.find_element(class: 'menu_text'))
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -27,14 +27,14 @@ class LoginPage < AbstractPage
|
|
27
27
|
# Elements
|
28
28
|
|
29
29
|
def username_field
|
30
|
-
driver.find_element(id: 'loginFrm_loginname')
|
30
|
+
@driver.find_element(id: 'loginFrm_loginname')
|
31
31
|
end
|
32
32
|
|
33
33
|
def password_field
|
34
|
-
driver.find_element(id: 'loginFrm_password')
|
34
|
+
@driver.find_element(id: 'loginFrm_password')
|
35
35
|
end
|
36
36
|
|
37
37
|
def login_button
|
38
|
-
driver.find_element(xpath: "//button[@title='Login']")
|
38
|
+
@driver.find_element(xpath: "//button[@title='Login']")
|
39
39
|
end
|
40
40
|
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
<% if %w[selenium watir].include? automation %>
|
2
2
|
def visit(*page)
|
3
|
-
<% if automation == 'selenium' %>
|
4
|
-
driver.navigate.to full_url(page.first)
|
5
|
-
<% else %>
|
6
|
-
browser.goto full_url(page.first)
|
7
|
-
<% end %>
|
3
|
+
<% if automation == 'selenium' %>@driver.navigate.to full_url(page.first) <% else %>@browser.goto full_url(page.first)<% end %>
|
8
4
|
end
|
9
5
|
<% end %>
|
@@ -2,7 +2,6 @@ require_relative '../abstract/abstract_page'
|
|
2
2
|
require_relative '../components/header_component'
|
3
3
|
|
4
4
|
class LoginPage < AbstractPage
|
5
|
-
using Raider::WatirHelper
|
6
5
|
|
7
6
|
def url(_page)
|
8
7
|
'index.php?rt=account/login'
|
@@ -11,16 +10,15 @@ class LoginPage < AbstractPage
|
|
11
10
|
# Actions
|
12
11
|
|
13
12
|
def login(username, password)
|
14
|
-
username_field.
|
15
|
-
password_field.
|
16
|
-
login_button.
|
13
|
+
username_field.set username
|
14
|
+
password_field.set password
|
15
|
+
login_button.click
|
17
16
|
end
|
18
17
|
|
19
18
|
# Components
|
20
19
|
|
21
|
-
|
22
20
|
def header
|
23
|
-
HeaderComponent.new(browser.element(class: 'menu_text'))
|
21
|
+
HeaderComponent.new(@browser.element(class: 'menu_text'))
|
24
22
|
end
|
25
23
|
|
26
24
|
private
|
@@ -28,14 +26,14 @@ class LoginPage < AbstractPage
|
|
28
26
|
# Elements
|
29
27
|
|
30
28
|
def username_field
|
31
|
-
browser.
|
29
|
+
@browser.text_field(id: 'loginFrm_loginname')
|
32
30
|
end
|
33
31
|
|
34
32
|
def password_field
|
35
|
-
browser.
|
33
|
+
@browser.text_field(id: 'loginFrm_password')
|
36
34
|
end
|
37
35
|
|
38
36
|
def login_button
|
39
|
-
browser.
|
37
|
+
@browser.button(xpath: "//button[@title='Login']")
|
40
38
|
end
|
41
39
|
end
|
@@ -3,17 +3,17 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'activesupport'
|
4
4
|
gem 'allure-rspec'
|
5
5
|
gem 'allure-ruby-commons'
|
6
|
-
<% if framework == 'cucumber'
|
6
|
+
<% if framework == 'cucumber' -%>
|
7
7
|
gem 'allure-cucumber'
|
8
|
-
<% end
|
8
|
+
<% end -%>
|
9
9
|
gem 'parallel_split_test'
|
10
10
|
gem 'parallel_tests'
|
11
11
|
gem 'rake'
|
12
12
|
gem '<%= framework %>'
|
13
|
-
<% if framework == 'cucumber'
|
13
|
+
<% if framework == 'cucumber' -%>
|
14
14
|
gem 'rspec'
|
15
|
-
<% end
|
15
|
+
<% end -%>
|
16
16
|
<%= ERB.new(File.read(File.expand_path('./partials/automation_gems.tt', __dir__))).result(binding).strip! %>
|
17
|
-
<% if %w[selenium watir].include? automation
|
17
|
+
<% if %w[selenium watir].include? automation -%>
|
18
18
|
gem 'webdrivers'
|
19
|
-
<% end
|
19
|
+
<% end -%>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% case automation
|
2
|
-
when 'selenium'
|
2
|
+
when 'selenium' -%>
|
3
3
|
<%= ERB.new(File.read(File.expand_path('./partials/selenium_appium_env.tt', __dir__))).result(binding).strip! -%>
|
4
|
-
<% when 'watir'
|
4
|
+
<% when 'watir' -%>
|
5
5
|
<%= ERB.new(File.read(File.expand_path('./partials/watir_env.tt', __dir__))).result(binding).strip! -%>
|
6
|
-
<% else
|
6
|
+
<% else -%>
|
7
7
|
<%= ERB.new(File.read(File.expand_path('./partials/appium_env.tt', __dir__))).result(binding).strip! -%>
|
8
|
-
<% end
|
8
|
+
<% end -%>
|
@@ -2,12 +2,12 @@ require_relative '../../helpers/driver_helper'
|
|
2
2
|
|
3
3
|
Before do
|
4
4
|
Raider::AllureHelper.configure
|
5
|
-
Raider::DriverHelper.new_driver
|
6
|
-
|
5
|
+
@driver = Raider::DriverHelper.new_driver
|
6
|
+
@driver.start_driver
|
7
7
|
end
|
8
8
|
|
9
9
|
After do |scenario|
|
10
|
-
|
10
|
+
@driver.screenshot("allure-results/screenshots/#{scenario.name}.png")
|
11
11
|
Raider::AllureHelper.add_screenshot(scenario.name)
|
12
|
-
|
12
|
+
@driver.quit_driver
|
13
13
|
end
|
@@ -5,13 +5,16 @@ require_relative '../../page_objects/pages/home_page'
|
|
5
5
|
require_relative '../../page_objects/pages/login_page'
|
6
6
|
|
7
7
|
Given("I'm a registered user on the login page") do
|
8
|
-
HomePage.
|
8
|
+
home_page = HomePage.new(@driver)
|
9
|
+
home_page.go_to_login
|
9
10
|
end
|
10
11
|
|
11
12
|
When('I login with my credentials') do
|
12
|
-
LoginPage.
|
13
|
+
login_page = LoginPage.new(@driver)
|
14
|
+
login_page.login('alice', 'mypassword')
|
13
15
|
end
|
14
16
|
|
15
17
|
When('I can see the main page') do
|
16
|
-
|
18
|
+
confirmation_page = ConfirmationPage.new(@driver)
|
19
|
+
expect(confirmation_page.login_message).to eq 'You are logged in as alice'
|
17
20
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require_relative '../../helpers/driver_helper'
|
2
2
|
|
3
3
|
Before do
|
4
|
-
Raider::
|
5
|
-
Raider::DriverHelper.new_driver
|
4
|
+
@driver = Raider::DriverHelper.new_driver
|
6
5
|
end
|
7
6
|
|
8
7
|
After do |scenario|
|
9
|
-
driver
|
10
|
-
driver.save_screenshot("allure-results/screenshots/#{scenario.name}.png")
|
8
|
+
@driver.save_screenshot("allure-results/screenshots/#{scenario.name}.png")
|
11
9
|
Raider::AllureHelper.add_screenshot(scenario.name)
|
12
|
-
driver.quit
|
10
|
+
@driver.quit
|
13
11
|
end
|
@@ -2,12 +2,11 @@ require_relative '../../helpers/browser_helper'
|
|
2
2
|
|
3
3
|
Before do
|
4
4
|
Raider::AllureHelper.configure
|
5
|
-
Raider::BrowserHelper.new_browser
|
5
|
+
@browser = Raider::BrowserHelper.new_browser
|
6
6
|
end
|
7
7
|
|
8
8
|
After do |scenario|
|
9
|
-
browser
|
10
|
-
browser.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
|
9
|
+
@browser.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
|
11
10
|
Raider::AllureHelper.add_screenshot(scenario.name)
|
12
|
-
browser.quit
|
11
|
+
@browser.quit
|
13
12
|
end
|
@@ -3,13 +3,14 @@
|
|
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
|
-
LoginPage.
|
6
|
+
@login_page = LoginPage.new(<% if automation == 'watir'%>@browser<% else %>@driver<% end %>)
|
7
|
+
@login_page.visit
|
7
8
|
end
|
8
9
|
|
9
10
|
When('I login with my credentials') do
|
10
|
-
|
11
|
+
@login_page.login('aguspe', '12341234')
|
11
12
|
end
|
12
13
|
|
13
14
|
When('I can see the main page') do
|
14
|
-
expect(
|
15
|
+
expect(@login_page.header.customer_name).to eq 'Welcome back Agustin'
|
15
16
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<% if %w[selenium watir].include? automation
|
1
|
+
<% if %w[selenium watir].include? automation -%>
|
2
2
|
<%= ERB.new(File.read(File.expand_path('./partials/web_steps.tt', __dir__))).result(binding).strip! -%>
|
3
|
-
<% else
|
3
|
+
<% else -%>
|
4
4
|
<%= ERB.new(File.read(File.expand_path('./partials/mobile_steps.tt', __dir__))).result(binding).strip! -%>
|
5
|
-
<% end
|
5
|
+
<% end -%>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
<%= ERB.new(File.read(File.expand_path('./partials/allure_requirements.tt', __dir__))).result(binding).strip!
|
3
|
+
<%= ERB.new(File.read(File.expand_path('./partials/allure_requirements.tt', __dir__))).result(binding).strip! -%>
|
4
4
|
<% allure = ERB.new(File.read(File.expand_path('./partials/allure_imports.tt', __dir__))).result(binding).strip! %>
|
5
5
|
|
6
6
|
module Raider
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
<% if automation == 'selenium'
|
3
|
+
<% if automation == 'selenium' -%>
|
4
4
|
require 'webdrivers'
|
5
|
-
<% else
|
5
|
+
<% else -%>
|
6
6
|
require 'appium_lib'
|
7
|
-
<% end
|
7
|
+
<% end -%>
|
8
8
|
require_relative 'driver_helper'
|
9
9
|
|
10
10
|
module Raider
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% case automation
|
2
2
|
when 'selenium' %>
|
3
|
-
driver.save_screenshot("allure-results/screenshots/#{example_name}.png") if status == :failed
|
3
|
+
@driver.save_screenshot("allure-results/screenshots/#{example_name}.png") if status == :failed
|
4
4
|
<% when 'watir' %>
|
5
|
-
browser.save_screenshot("allure-results/screenshots/#{example_name}.png") if status == :failed
|
5
|
+
@browser.save_screenshot("allure-results/screenshots/#{example_name}.png") if status == :failed
|
6
6
|
<% else %>
|
7
|
-
driver.screenshot("allure-results/screenshots/#{example_name}.png") if status == :failed
|
7
|
+
@driver.screenshot("allure-results/screenshots/#{example_name}.png") if status == :failed
|
8
8
|
<% end %>
|
@@ -1,15 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Raider
|
4
|
-
|
4
|
+
<% if framework == 'rspec' -%>
|
5
5
|
require_relative 'spec_helper'
|
6
|
-
|
6
|
+
<% end -%>
|
7
7
|
<%= ERB.new(File.read(File.expand_path('./partials/require_automation.tt', __dir__))).result(binding).strip! %>
|
8
|
-
|
9
|
-
<% if automation == 'watir' %>
|
8
|
+
<% if automation == 'watir' -%>
|
10
9
|
require_relative 'browser_helper'
|
11
|
-
|
10
|
+
<% else -%>
|
12
11
|
require_relative 'driver_helper'
|
13
|
-
|
12
|
+
<% end -%>
|
14
13
|
require_relative 'allure_helper'
|
15
14
|
end
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
require 'rspec'
|
4
4
|
require_relative 'allure_helper'
|
5
|
-
<% if automation == 'watir'
|
5
|
+
<% if automation == 'watir' -%>
|
6
6
|
require_relative 'browser_helper'
|
7
|
-
<% else
|
7
|
+
<% else -%>
|
8
8
|
require_relative 'driver_helper'
|
9
|
-
<% end
|
9
|
+
<% end -%>
|
10
10
|
|
11
11
|
module Raider
|
12
12
|
module SpecHelper
|
@@ -15,14 +15,7 @@ module Raider
|
|
15
15
|
RSpec.configure do |config|
|
16
16
|
config.formatter = AllureHelper.formatter
|
17
17
|
config.before(:each) do
|
18
|
-
|
19
|
-
BrowserHelper.new_browser
|
20
|
-
<% else %>
|
21
|
-
DriverHelper.new_driver
|
22
|
-
<% end %>
|
23
|
-
<% if %w[appium_ios].include? automation %>
|
24
|
-
DriverHelper.driver.start_driver
|
25
|
-
<% end %>
|
18
|
+
<%= ERB.new(File.read(File.expand_path('./partials/select_driver.tt', __dir__))).result(binding).strip! %>
|
26
19
|
end
|
27
20
|
|
28
21
|
config.after(:each) do
|
@@ -1,25 +1,34 @@
|
|
1
|
-
<% if %w[selenium watir].include? automation
|
1
|
+
<% if %w[selenium watir].include? automation -%>
|
2
2
|
require_relative 'base_spec'
|
3
3
|
require_relative '../page_objects/pages/login_page'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
describe 'Login' do
|
6
|
+
let(:user_name) { 'aguspe' }
|
7
|
+
let(:login_page) { LoginPage.new(<% if automation == 'watir' -%>@browser<% else -%>@driver<% end -%>) }
|
8
|
+
subject { login_page.header.customer_name }
|
9
|
+
|
10
|
+
before(:example) do
|
11
|
+
login_page.visit
|
12
|
+
login_page.login(user_name, password)
|
13
|
+
end
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
15
|
+
context 'with right credentials' do
|
16
|
+
let(:password) { '12341234' }
|
17
|
+
|
18
|
+
it 'can successfully log in' do
|
19
|
+
expect(subject).to eq 'Welcome back Agustin'
|
14
20
|
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with wrong credentials' do
|
24
|
+
let(:password) { 'wrongPassword' }
|
15
25
|
|
16
|
-
it 'cannot login
|
17
|
-
|
18
|
-
expect(LoginPage.header.customer_name).to be_empty
|
26
|
+
it 'it cannot login in' do
|
27
|
+
expect(subject).to be_empty
|
19
28
|
end
|
20
29
|
end
|
21
30
|
end
|
22
|
-
<% else
|
31
|
+
<% else -%>
|
23
32
|
require_relative '../page_objects/pages/confirmation_page'
|
24
33
|
require_relative '../page_objects/pages/home_page'
|
25
34
|
require_relative 'base_spec'
|
@@ -27,11 +36,18 @@ require_relative '../page_objects/pages/login_page'
|
|
27
36
|
|
28
37
|
class LoginSpec < BaseSpec
|
29
38
|
describe 'Login' do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
|
40
|
+
let(:user_name) { 'alice' }
|
41
|
+
let(:password) { 'mypassword' }
|
42
|
+
let(:login_page) { LoginPage.new(@driver) }
|
43
|
+
let(:home_page) { HomePage.new(@driver) }
|
44
|
+
let(:confirmation_page) { ConfirmationPage.new(@driver) }
|
45
|
+
|
46
|
+
it 'can login' do
|
47
|
+
home_page.go_to_login
|
48
|
+
login_page.login(user_name, password)
|
49
|
+
expect(confirmation_page.login_message).to eq 'You are logged in as alice'
|
34
50
|
end
|
35
51
|
end
|
36
52
|
end
|
37
|
-
<% end
|
53
|
+
<% 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.2.
|
5
|
+
s.version = '0.2.3'
|
6
6
|
s.summary = 'A gem to make setup and start of UI automation projects easier'
|
7
7
|
s.description = 'This gem contents everything you need to start doing web automation in one simple package'
|
8
8
|
s.authors = ['Agustin Pequeno']
|
@@ -22,6 +22,10 @@ describe RubyRaider::CucumberGenerator do
|
|
22
22
|
expect(File.exist?("#{@name}/features/support/env.rb")).to be_truthy
|
23
23
|
end
|
24
24
|
|
25
|
+
it 'does not create a spec file' do
|
26
|
+
expect(File.exist?("#{@name}/spec/login_spec.rb")).to be_falsey
|
27
|
+
end
|
28
|
+
|
25
29
|
after(:all) do
|
26
30
|
FileUtils.rm_rf(@name)
|
27
31
|
end
|
@@ -44,6 +48,10 @@ describe RubyRaider::CucumberGenerator do
|
|
44
48
|
it 'creates an env file' do
|
45
49
|
expect(File.exist?("#{@name}/features/support/env.rb")).to be_truthy
|
46
50
|
end
|
51
|
+
|
52
|
+
after(:all) do
|
53
|
+
FileUtils.rm_rf(@name)
|
54
|
+
end
|
47
55
|
end
|
48
56
|
|
49
57
|
context 'with appium' do
|
@@ -14,10 +14,6 @@ describe RubyRaider::HelpersGenerator do
|
|
14
14
|
expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
|
15
15
|
end
|
16
16
|
|
17
|
-
it 'creates a pom helper file' do
|
18
|
-
expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
|
19
|
-
end
|
20
|
-
|
21
17
|
it 'creates an allure helper file' do
|
22
18
|
expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
|
23
19
|
end
|
@@ -45,10 +41,6 @@ describe RubyRaider::HelpersGenerator do
|
|
45
41
|
expect(File.exist?("#{@name}/helpers/browser_helper.rb")).to be_truthy
|
46
42
|
end
|
47
43
|
|
48
|
-
it 'creates a pom helper file' do
|
49
|
-
expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
|
50
|
-
end
|
51
|
-
|
52
44
|
it 'creates a raider file' do
|
53
45
|
expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
|
54
46
|
end
|
@@ -72,10 +64,6 @@ describe RubyRaider::HelpersGenerator do
|
|
72
64
|
expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
|
73
65
|
end
|
74
66
|
|
75
|
-
it 'creates a pom helper file' do
|
76
|
-
expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
|
77
|
-
end
|
78
|
-
|
79
67
|
it 'creates an allure helper file' do
|
80
68
|
expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
|
81
69
|
end
|
@@ -94,10 +82,6 @@ describe RubyRaider::HelpersGenerator do
|
|
94
82
|
RubyRaider::HelpersGenerator.new(['selenium', 'cucumber', @name]).invoke_all
|
95
83
|
end
|
96
84
|
|
97
|
-
it 'creates a pom helper file' do
|
98
|
-
expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
|
99
|
-
end
|
100
|
-
|
101
85
|
it 'creates an allure helper file' do
|
102
86
|
expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
|
103
87
|
end
|
@@ -106,6 +90,10 @@ describe RubyRaider::HelpersGenerator do
|
|
106
90
|
expect(File.exist?("#{@name}/helpers/driver_helper.rb")).to be_truthy
|
107
91
|
end
|
108
92
|
|
93
|
+
it 'does not create a spec helper' do
|
94
|
+
expect(File.exist?("#{@name}/helpers/spec_helper.rb")).to be_falsey
|
95
|
+
end
|
96
|
+
|
109
97
|
after(:all) do
|
110
98
|
FileUtils.rm_rf(@name)
|
111
99
|
end
|
@@ -125,6 +113,10 @@ describe RubyRaider::HelpersGenerator do
|
|
125
113
|
expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
|
126
114
|
end
|
127
115
|
|
116
|
+
it 'does not create a spec helper' do
|
117
|
+
expect(File.exist?("#{@name}/helpers/spec_helper.rb")).to be_falsey
|
118
|
+
end
|
119
|
+
|
128
120
|
after(:all) do
|
129
121
|
FileUtils.rm_rf(@name)
|
130
122
|
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.2.
|
4
|
+
version: 0.2.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: 2022-05-
|
11
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -138,8 +138,8 @@ files:
|
|
138
138
|
- lib/generators/templates/automation/home_page.tt
|
139
139
|
- lib/generators/templates/automation/login_page.tt
|
140
140
|
- lib/generators/templates/automation/partials/appium_login.tt
|
141
|
-
- lib/generators/templates/automation/partials/driver_selector.tt
|
142
141
|
- lib/generators/templates/automation/partials/element.tt
|
142
|
+
- lib/generators/templates/automation/partials/initialize_selector.tt
|
143
143
|
- lib/generators/templates/automation/partials/require_raider.tt
|
144
144
|
- lib/generators/templates/automation/partials/selenium_login.tt
|
145
145
|
- lib/generators/templates/automation/partials/url_methods.tt
|
@@ -163,16 +163,14 @@ files:
|
|
163
163
|
- lib/generators/templates/helpers/driver_helper.tt
|
164
164
|
- lib/generators/templates/helpers/partials/allure_imports.tt
|
165
165
|
- lib/generators/templates/helpers/partials/allure_requirements.tt
|
166
|
-
- lib/generators/templates/helpers/partials/driver_requirements.tt
|
167
166
|
- lib/generators/templates/helpers/partials/new_driver.tt
|
168
167
|
- lib/generators/templates/helpers/partials/quit_driver.tt
|
169
168
|
- lib/generators/templates/helpers/partials/require_automation.tt
|
170
169
|
- lib/generators/templates/helpers/partials/screenshot.tt
|
171
|
-
- lib/generators/templates/helpers/
|
170
|
+
- lib/generators/templates/helpers/partials/select_driver.tt
|
172
171
|
- lib/generators/templates/helpers/raider_helper.tt
|
173
172
|
- lib/generators/templates/helpers/selenium_helper.tt
|
174
173
|
- lib/generators/templates/helpers/spec_helper.tt
|
175
|
-
- lib/generators/templates/helpers/watir_helper.tt
|
176
174
|
- lib/generators/templates/rspec/base_spec.tt
|
177
175
|
- lib/generators/templates/rspec/spec.tt
|
178
176
|
- lib/ruby_raider.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Raider
|
4
|
-
module PomHelper
|
5
|
-
def instance
|
6
|
-
@instance ||= new
|
7
|
-
end
|
8
|
-
|
9
|
-
def method_missing(message, *args, &block)
|
10
|
-
return super unless instance.respond_to?(message)
|
11
|
-
|
12
|
-
instance.public_send(message, *args, &block)
|
13
|
-
end
|
14
|
-
|
15
|
-
def respond_to_missing?(method, *_args, &block)
|
16
|
-
instance.respond_to?(method) || super
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|