ruby_raider 0.7.3 → 0.7.5
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 +4 -4
- data/.reek.yml +0 -4
- data/README.md +1 -1
- data/Rakefile +0 -6
- data/lib/generators/automation/automation_generator.rb +48 -1
- data/lib/generators/automation/templates/abstract_page.tt +4 -2
- data/lib/generators/automation/templates/partials/android_caps.tt +6 -4
- data/lib/generators/automation/templates/partials/cross_platform_caps.tt +11 -10
- data/lib/generators/automation/templates/partials/ios_caps.tt +7 -5
- data/lib/generators/common_generator.rb +1 -1
- data/lib/generators/cucumber/cucumber_generator.rb +16 -0
- data/lib/generators/cucumber/templates/partials/appium_env.tt +3 -4
- data/lib/generators/cucumber/templates/partials/driver_world.tt +2 -2
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +12 -10
- data/lib/generators/cucumber/templates/partials/watir_env.tt +4 -32
- data/lib/generators/cucumber/templates/partials/watir_world.tt +1 -1
- data/lib/generators/generator.rb +4 -0
- data/lib/generators/helper_generator.rb +0 -5
- data/lib/generators/invoke_generators.rb +0 -14
- data/lib/generators/menu_generator.rb +9 -23
- data/lib/generators/rspec/rspec_generator.rb +10 -2
- data/lib/generators/rspec/templates/spec.tt +3 -3
- data/lib/generators/templates/common/read_me.tt +1 -1
- data/lib/generators/templates/helpers/allure_helper.tt +19 -21
- data/lib/generators/templates/helpers/appium_helper.tt +19 -21
- data/lib/generators/templates/helpers/browser_helper.tt +12 -9
- data/lib/generators/templates/helpers/driver_helper.tt +16 -15
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +24 -19
- data/lib/generators/templates/helpers/spec_helper.tt +18 -18
- data/lib/generators/templates/helpers/visual_helper.tt +1 -3
- data/lib/generators/templates/helpers/visual_spec_helper.tt +2 -4
- data/lib/ruby_raider.rb +1 -8
- data/ruby_raider.gemspec +1 -2
- data/spec/automation_generator_spec.rb +14 -70
- data/spec/common_generator_spec.rb +2 -2
- data/spec/cucumber_generator_spec.rb +0 -32
- data/spec/helpers_generator_spec.rb +0 -8
- data/spec/rspec_generator_spec.rb +12 -31
- data/spec/spec_helper.rb +4 -4
- data/spec/support/settings_helper.rb +1 -3
- metadata +2 -26
- data/lib/desktop/components/base_component.rb +0 -18
- data/lib/desktop/components/runner_components.rb +0 -196
- data/lib/desktop/screens/runner_screen.rb +0 -20
- data/lib/generators/automation/automation_examples_generator.rb +0 -48
- data/lib/generators/automation/templates/partials/require_raider.tt +0 -5
- data/lib/generators/cucumber/cucumber_examples_generator.rb +0 -21
- data/lib/generators/rspec/rspec_examples_generator.rb +0 -17
- data/lib/generators/rspec/templates/base_spec.tt +0 -7
- data/lib/generators/templates/helpers/partials/select_driver.tt +0 -9
- data/lib/generators/templates/helpers/raider_helper.tt +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6187527f5296b729b6b97dfc897beb9d60809db17ab34fece7673c53a247be0f
|
4
|
+
data.tar.gz: 2ac25c14abdc3c038390cf6ca0b1b1a36cab72366adef86c7cdf6d32984aadec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d999412e75b3f5b595d3615bc4664c0bc2c059385d8d397e970cce48565caa11712223654b6c28ae2892ba1ce03c3e72ddb305f272d9c61228053d93a7b92e8e
|
7
|
+
data.tar.gz: 33f26594ee731b2dfce01861e13ee8423acca5411c583fe4d77784d54edea05f840cf95cdc85b70dcc15407ce041e8e3062dd46d35b9617a42c18e803dc5f276
|
data/.reek.yml
CHANGED
data/README.md
CHANGED
@@ -57,6 +57,7 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
|
57
57
|
* Generating a visual testing framework with Cucumber, Applitools and Selenium
|
58
58
|
|
59
59
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
60
|
+
***Remember to use the full path of the app that you download in the capabilities file***
|
60
61
|
|
61
62
|
***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read
|
62
63
|
more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.)
|
@@ -97,7 +98,6 @@ Commands :
|
|
97
98
|
raider generate # Provides access to all the generators commands
|
98
99
|
raider help [COMMAND] # Describe available commands or one specific command
|
99
100
|
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
100
|
-
raider open # It opens the desktop runner
|
101
101
|
raider open_ai # Provides access to all the open ai commands
|
102
102
|
raider utility # Provides access to all the utility commands
|
103
103
|
raider version # It shows the version of Ruby Raider you are currently using
|
data/Rakefile
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative 'lib/ruby_raider'
|
4
4
|
require_relative 'lib/commands/scaffolding_commands'
|
5
|
-
require_relative 'lib/desktop/screens/runner_screen'
|
6
5
|
|
7
6
|
desc 'Creates a new test project'
|
8
7
|
task :new, [:name] do |_t, args|
|
@@ -28,8 +27,3 @@ desc 'Download mobile builds'
|
|
28
27
|
task :builds, [:type] do |_t, args|
|
29
28
|
ScaffoldingCommands.new.invoke(:download_builds, nil, %W[#{args.type}])
|
30
29
|
end
|
31
|
-
|
32
|
-
desc 'Open the run screen'
|
33
|
-
task :runner do
|
34
|
-
RunnerScreen.new.launch
|
35
|
-
end
|
@@ -6,9 +6,13 @@ class AutomationGenerator < Generator
|
|
6
6
|
def generate_automation_files
|
7
7
|
if mobile?
|
8
8
|
generate_appium_settings
|
9
|
+
generate_home_page
|
10
|
+
generate_pdp_page
|
9
11
|
else
|
10
|
-
generate_abstract_component
|
11
12
|
generate_visual_options
|
13
|
+
generate_components
|
14
|
+
generate_model_files
|
15
|
+
generate_pages
|
12
16
|
end
|
13
17
|
|
14
18
|
generate_abstract_page
|
@@ -16,6 +20,21 @@ class AutomationGenerator < Generator
|
|
16
20
|
|
17
21
|
private
|
18
22
|
|
23
|
+
def generate_pages
|
24
|
+
generate_login_page
|
25
|
+
generate_account_page
|
26
|
+
end
|
27
|
+
|
28
|
+
def generate_components
|
29
|
+
generate_abstract_component
|
30
|
+
generate_header_component
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate_model_files
|
34
|
+
generate_model_factory
|
35
|
+
generate_model_data
|
36
|
+
end
|
37
|
+
|
19
38
|
def generate_abstract_page
|
20
39
|
template('abstract_page.tt', "#{name}/page_objects/abstract/abstract_page.rb")
|
21
40
|
end
|
@@ -33,4 +52,32 @@ class AutomationGenerator < Generator
|
|
33
52
|
|
34
53
|
template('visual_options.tt', "#{name}/config/options.yml")
|
35
54
|
end
|
55
|
+
|
56
|
+
def generate_login_page
|
57
|
+
template('login_page.tt', "#{name}/page_objects/pages/login_page.rb")
|
58
|
+
end
|
59
|
+
|
60
|
+
def generate_account_page
|
61
|
+
template('account_page.tt', "#{name}/page_objects/pages/account_page.rb")
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_home_page
|
65
|
+
template('home_page.tt', "#{name}/page_objects/pages/home_page.rb")
|
66
|
+
end
|
67
|
+
|
68
|
+
def generate_pdp_page
|
69
|
+
template('pdp_page.tt', "#{name}/page_objects/pages/pdp_page.rb")
|
70
|
+
end
|
71
|
+
|
72
|
+
def generate_header_component
|
73
|
+
template('component.tt', "#{name}/page_objects/components/header_component.rb")
|
74
|
+
end
|
75
|
+
|
76
|
+
def generate_model_factory
|
77
|
+
template('factory.tt', "#{name}/models/model_factory.rb")
|
78
|
+
end
|
79
|
+
|
80
|
+
def generate_model_data
|
81
|
+
template('data.tt', "#{name}/models/data/users.yml")
|
82
|
+
end
|
36
83
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
<%- if automation == 'cross_platform' -%>
|
2
|
+
require_relative '../../helpers/appium_helper'
|
3
|
+
<% end -%>
|
2
4
|
|
3
5
|
class AbstractPage
|
4
6
|
<% if automation == 'cross_platform' -%>
|
5
|
-
include
|
7
|
+
include AppiumHelper
|
6
8
|
<% end -%>
|
7
9
|
<%= ERB.new(File.read(File.expand_path('./partials/initialize_selector.tt', __dir__))).result(binding) -%>
|
8
10
|
<%= ERB.new(File.read(File.expand_path('./partials/visit_method.tt', __dir__))).result(binding) -%>
|
@@ -1,5 +1,7 @@
|
|
1
|
-
automationName: UiAutomator2
|
2
1
|
platformName: Android
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
appium:options:
|
3
|
+
url: http://localhost:4723/wd/hub
|
4
|
+
platformVersion: '12'
|
5
|
+
automationName: UiAutomator2
|
6
|
+
deviceName: Pixel 3 API 32
|
7
|
+
app: "Android-MyDemoAppRN.1.3.0.build-244.apk"
|
@@ -1,14 +1,15 @@
|
|
1
1
|
android:
|
2
|
-
automationName: UiAutomator2
|
3
2
|
platformName: Android
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
appium:options:
|
4
|
+
platformVersion: '12'
|
5
|
+
automationName: UiAutomator2
|
6
|
+
deviceName: Pixel 3 API 32
|
7
|
+
app: "Android-MyDemoAppRN.1.3.0.build-244.apk"
|
8
8
|
ios:
|
9
|
-
automationName: XCUITest
|
10
9
|
platformName: iOS
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
appium:options:
|
11
|
+
platformVersion: "14.0"
|
12
|
+
deviceName: iPhone 11
|
13
|
+
automationName: XCUITest
|
14
|
+
app: "MyRNDemoApp.app"
|
15
|
+
autoDismissAlerts: true
|
@@ -1,6 +1,8 @@
|
|
1
|
-
automationName: XCUITest
|
2
1
|
platformName: iOS
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
appium:options:
|
3
|
+
url: http://localhost:4723/wd/hub
|
4
|
+
platformVersion: "14.0"
|
5
|
+
deviceName: iPhone 11
|
6
|
+
automationName: XCUITest
|
7
|
+
app: "MyRNDemoApp.app"
|
8
|
+
autoDismissAlerts: true
|
@@ -3,6 +3,18 @@
|
|
3
3
|
require_relative '../generator'
|
4
4
|
|
5
5
|
class CucumberGenerator < Generator
|
6
|
+
def generate_feature
|
7
|
+
template('feature.tt', "#{name}/features/#{template_name}.feature")
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_steps
|
11
|
+
template('steps.tt', "#{name}/features/step_definitions/#{template_name}_steps.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate_user_factory
|
15
|
+
template('user_factory.tt', "#{name}/models/user_factory.rb")
|
16
|
+
end
|
17
|
+
|
6
18
|
def generate_env_file
|
7
19
|
template('env.tt', "#{name}/features/support/env.rb")
|
8
20
|
end
|
@@ -14,4 +26,8 @@ class CucumberGenerator < Generator
|
|
14
26
|
def generate_cucumber_file
|
15
27
|
template('cucumber.tt', "#{name}/cucumber.yml")
|
16
28
|
end
|
29
|
+
|
30
|
+
def template_name
|
31
|
+
@template_name ||= (@_initializer.first & %w[android ios cross_platform]).empty? ? 'login' : 'home'
|
32
|
+
end
|
17
33
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
require_relative '../../helpers/driver_helper'
|
2
2
|
|
3
|
-
include
|
3
|
+
include DriverHelper
|
4
4
|
|
5
5
|
Before do
|
6
|
-
|
7
|
-
new_driver
|
6
|
+
AllureHelper.configure
|
8
7
|
driver.start_driver
|
9
8
|
end
|
10
9
|
|
11
10
|
After do |scenario|
|
12
11
|
driver.screenshot("allure-results/screenshots/#{scenario.name}.png")
|
13
|
-
|
12
|
+
AllureHelper.add_screenshot(scenario.name)
|
14
13
|
driver.quit_driver
|
15
14
|
end
|
@@ -5,7 +5,7 @@ require_relative '../../helpers/visual_helper'
|
|
5
5
|
<%- if automation == 'selenium' -%>
|
6
6
|
require_relative '../../models/user_factory'
|
7
7
|
|
8
|
-
World(
|
8
|
+
World(DriverHelper<%- if visual_automation -%>, VisualHelper<%- end -%>)
|
9
9
|
<%- else -%>
|
10
|
-
World(
|
10
|
+
World(DriverHelper)
|
11
11
|
<%- end -%>
|
@@ -1,23 +1,24 @@
|
|
1
1
|
<%- if visual_automation -%>
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require_relative '../../helpers/allure_helper'
|
4
5
|
require_relative '../../helpers/driver_helper'
|
5
6
|
require_relative '../../helpers/visual_helper'
|
6
7
|
|
7
|
-
include
|
8
|
-
include
|
8
|
+
include DriverHelper
|
9
|
+
include VisualHelper
|
9
10
|
|
10
11
|
Before do
|
11
12
|
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
12
|
-
@grid_runner = create_grid_runner
|
13
|
-
@eyes = create_eyes(@grid_runner)
|
14
|
-
configure_eyes @eyes
|
15
|
-
@driver = @eyes.open(driver:
|
13
|
+
@grid_runner = VisualHelper.create_grid_runner
|
14
|
+
@eyes = VisualHelper.create_eyes(@grid_runner)
|
15
|
+
VisualHelper.configure_eyes @eyes
|
16
|
+
@driver = @eyes.open(driver: driver)
|
16
17
|
end
|
17
18
|
|
18
19
|
After do |scenario|
|
19
20
|
driver.save_screenshot("allure-results/screenshots/#{scenario.name}.png")
|
20
|
-
|
21
|
+
AllureHelper.add_screenshot(scenario.name)
|
21
22
|
@eyes.close
|
22
23
|
@driver.quit
|
23
24
|
@eyes.abort_async
|
@@ -29,16 +30,17 @@ end
|
|
29
30
|
# frozen_string_literal: true
|
30
31
|
|
31
32
|
require_relative '../../helpers/driver_helper'
|
33
|
+
require_relative '../../helpers/allure_helper'
|
32
34
|
|
33
|
-
include
|
35
|
+
include DriverHelper
|
34
36
|
|
35
37
|
Before do
|
36
|
-
|
38
|
+
driver
|
37
39
|
end
|
38
40
|
|
39
41
|
After do |scenario|
|
40
42
|
driver.save_screenshot("allure-results/screenshots/#{scenario.name}.png")
|
41
|
-
|
43
|
+
AllureHelper.add_screenshot(scenario.name)
|
42
44
|
driver.quit
|
43
45
|
end
|
44
46
|
<%- end -%>
|
@@ -1,44 +1,16 @@
|
|
1
|
-
<%- if visual_automation -%>
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
3
|
+
require_relative '../../helpers/allure_helper'
|
4
4
|
require_relative '../../helpers/browser_helper'
|
5
|
-
require_relative '../../helpers/visual_helper'
|
6
5
|
|
7
|
-
include
|
8
|
-
include Raider::VisualHelper
|
6
|
+
include BrowserHelper
|
9
7
|
|
10
8
|
Before do
|
11
|
-
|
12
|
-
@grid_runner = create_grid_runner
|
13
|
-
@eyes = create_eyes(@grid_runner)
|
14
|
-
configure_eyes @eyes
|
15
|
-
@browser = @eyes.open(driver: new_browser.driver)
|
9
|
+
browser
|
16
10
|
end
|
17
11
|
|
18
12
|
After do |scenario|
|
19
13
|
browser.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
|
20
|
-
|
21
|
-
@eyes.close
|
22
|
-
@browser.quit
|
23
|
-
@eyes.abort_async
|
24
|
-
results = @grid_runner.get_all_test_results
|
25
|
-
puts results
|
26
|
-
end
|
27
|
-
|
28
|
-
<%- else -%>
|
29
|
-
# frozen_string_literal: true
|
30
|
-
|
31
|
-
require_relative '../../helpers/browser_helper'
|
32
|
-
|
33
|
-
include Raider::BrowserHelper
|
34
|
-
|
35
|
-
Before do
|
36
|
-
new_browser
|
37
|
-
end
|
38
|
-
|
39
|
-
After do |scenario|
|
40
|
-
browser.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
|
41
|
-
Raider::AllureHelper.add_screenshot(scenario.name)
|
14
|
+
AllureHelper.add_screenshot(scenario.name)
|
42
15
|
browser.quit
|
43
16
|
end
|
44
|
-
<%- end -%>
|
data/lib/generators/generator.rb
CHANGED
@@ -4,7 +4,6 @@ require_relative 'generator'
|
|
4
4
|
|
5
5
|
class HelpersGenerator < Generator
|
6
6
|
def generate_helpers
|
7
|
-
generate_raider_helper
|
8
7
|
generate_browser_helper
|
9
8
|
generate_driver_helper
|
10
9
|
generate_appium_helper
|
@@ -20,10 +19,6 @@ class HelpersGenerator < Generator
|
|
20
19
|
|
21
20
|
private
|
22
21
|
|
23
|
-
def generate_raider_helper
|
24
|
-
template('helpers/raider_helper.tt', "#{name}/helpers/raider.rb")
|
25
|
-
end
|
26
|
-
|
27
22
|
def generate_allure_helper
|
28
23
|
template('helpers/allure_helper.tt', "#{name}/helpers/allure_helper.rb")
|
29
24
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
require_relative 'automation/automation_generator'
|
2
|
-
require_relative 'automation/automation_examples_generator'
|
3
2
|
require_relative 'common_generator'
|
4
3
|
require_relative 'cucumber/cucumber_generator'
|
5
|
-
require_relative 'cucumber/cucumber_examples_generator'
|
6
4
|
require_relative 'helper_generator'
|
7
5
|
require_relative 'rspec/rspec_generator'
|
8
|
-
require_relative 'rspec/rspec_examples_generator'
|
9
6
|
|
10
7
|
# :reek:FeatureEnvy { enabled: false }
|
11
8
|
# :reek:UtilityFunction { enabled: false }
|
@@ -14,7 +11,6 @@ module InvokeGenerators
|
|
14
11
|
generators = %w[Automation Common Helpers]
|
15
12
|
framework = structure[:framework]
|
16
13
|
add_generator(generators, framework.capitalize)
|
17
|
-
generators = add_examples(generators) if structure[:examples]
|
18
14
|
generators.each do |generator|
|
19
15
|
invoke_generator({
|
20
16
|
automation: structure[:automation],
|
@@ -30,16 +26,6 @@ module InvokeGenerators
|
|
30
26
|
gens.each { |generator| generators.push generator }
|
31
27
|
end
|
32
28
|
|
33
|
-
def add_examples(generators)
|
34
|
-
if generators.include?('Cucumber')
|
35
|
-
generators.push('CucumberExamples')
|
36
|
-
else
|
37
|
-
generators.push('RspecExamples')
|
38
|
-
end
|
39
|
-
|
40
|
-
generators.push('AutomationExamples')
|
41
|
-
end
|
42
|
-
|
43
29
|
def invoke_generator(structure = {})
|
44
30
|
Object.const_get("#{structure[:generator]}Generator")
|
45
31
|
.new([structure[:automation],
|
@@ -39,8 +39,7 @@ class MenuGenerator
|
|
39
39
|
automation: options[:automation],
|
40
40
|
framework: options[:framework],
|
41
41
|
name: @name,
|
42
|
-
visual: options[:visual_automation]
|
43
|
-
examples: options[:with_examples]
|
42
|
+
visual: options[:visual_automation]
|
44
43
|
}
|
45
44
|
generate_framework(structure)
|
46
45
|
system "cd #{name} && gem install bundler && bundle install"
|
@@ -59,36 +58,23 @@ class MenuGenerator
|
|
59
58
|
|
60
59
|
def select_test_framework(automation)
|
61
60
|
prompt.select('Please select your test framework') do |menu|
|
62
|
-
menu.choice :Cucumber, -> {
|
63
|
-
menu.choice :Rspec, -> {
|
61
|
+
menu.choice :Cucumber, -> { create_framework('Cucumber', automation) }
|
62
|
+
menu.choice :Rspec, -> { create_framework('Rspec', automation) }
|
64
63
|
menu.choice :Quit, -> { exit }
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
68
|
-
|
69
|
-
prompt.select('Would you like to create example files?') do |menu|
|
70
|
-
menu.choice :Yes, -> { framework_with_examples(framework, automation) }
|
71
|
-
menu.choice :No, -> { framework_without_examples(framework, automation) }
|
72
|
-
menu.choice :Quit, -> { exit }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
FrameworkOptions = Struct.new(:automation, :framework, :visual_automation, :with_examples)
|
67
|
+
FrameworkOptions = Struct.new(:automation, :framework, :visual_automation)
|
77
68
|
|
78
69
|
def create_framework_options(params)
|
79
|
-
FrameworkOptions.new(params[:automation], params[:framework], params[:visual_automation]
|
80
|
-
end
|
81
|
-
|
82
|
-
def framework_with_examples(framework, automation_type)
|
83
|
-
visual_automation = choose_visual_automation if %w[selenium].include?(automation_type)
|
84
|
-
options = create_framework_options(automation: automation_type, framework: framework.downcase, visual_automation: visual_automation, with_examples: true)
|
85
|
-
set_up_framework(options)
|
86
|
-
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
70
|
+
FrameworkOptions.new(params[:automation], params[:framework], params[:visual_automation])
|
87
71
|
end
|
88
72
|
|
89
|
-
def
|
73
|
+
def create_framework(framework, automation_type)
|
90
74
|
visual_automation = choose_visual_automation if %w[selenium].include?(automation_type)
|
91
|
-
options = create_framework_options(automation: automation_type,
|
75
|
+
options = create_framework_options(automation: automation_type,
|
76
|
+
framework: framework.downcase,
|
77
|
+
visual_automation: visual_automation)
|
92
78
|
set_up_framework(options)
|
93
79
|
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
94
80
|
end
|
@@ -3,7 +3,15 @@
|
|
3
3
|
require_relative '../generator'
|
4
4
|
|
5
5
|
class RspecGenerator < Generator
|
6
|
-
def
|
7
|
-
|
6
|
+
def generate_login_spec
|
7
|
+
return if mobile?
|
8
|
+
|
9
|
+
template('spec.tt', "#{name}/spec/login_page_spec.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_pdp_spec
|
13
|
+
return unless mobile?
|
14
|
+
|
15
|
+
template('spec.tt', "#{name}/spec/pdp_page_spec.rb")
|
8
16
|
end
|
9
17
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%- if %w[selenium watir].include? automation -%>
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative '
|
4
|
+
require_relative '../helpers/spec_helper'
|
5
5
|
require_relative '../models/model_factory'
|
6
6
|
require_relative '../page_objects/pages/account_page'
|
7
7
|
require_relative '../page_objects/pages/login_page'
|
@@ -43,11 +43,11 @@ describe 'Login' do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
<%- else -%>
|
46
|
+
require_relative '../helpers/spec_helper'
|
46
47
|
require_relative '../page_objects/pages/home_page'
|
47
|
-
require_relative 'base_spec'
|
48
48
|
require_relative '../page_objects/pages/pdp_page'
|
49
49
|
|
50
|
-
class PdpSpec
|
50
|
+
class PdpSpec
|
51
51
|
describe 'PDP page' do
|
52
52
|
|
53
53
|
let(:home_page) { HomePage.new(driver) }
|
@@ -53,6 +53,7 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
|
53
53
|
* Generating a visual testing framework with Cucumber, Applitools and Selenium
|
54
54
|
|
55
55
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
56
|
+
***Remember to use the full path of the app that you download in the capabilities file***
|
56
57
|
|
57
58
|
***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read
|
58
59
|
more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.)
|
@@ -93,7 +94,6 @@ Commands :
|
|
93
94
|
raider generate # Provides access to all the generators commands
|
94
95
|
raider help [COMMAND] # Describe available commands or one specific command
|
95
96
|
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
96
|
-
raider open # It opens the desktop runner
|
97
97
|
raider open_ai # Provides access to all the open ai commands
|
98
98
|
raider utility # Provides access to all the utility commands
|
99
99
|
raider version # It shows the version of Ruby Raider you are currently using
|
@@ -4,30 +4,28 @@
|
|
4
4
|
<%- allure = ERB.new(File.read(File.expand_path('./partials/allure_imports.tt', __dir__))).result(binding).strip! -%>
|
5
5
|
|
6
6
|
|
7
|
-
module
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
config.clean_results_directory = true
|
14
|
-
end
|
7
|
+
module AllureHelper
|
8
|
+
class << self
|
9
|
+
def configure
|
10
|
+
<%= allure %>.configure do |config|
|
11
|
+
config.results_directory = 'allure-results'
|
12
|
+
config.clean_results_directory = true
|
15
13
|
end
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
def add_screenshot(screenshot_name)
|
17
|
+
Allure.add_attachment(
|
18
|
+
name: name,
|
19
|
+
source: File.open("allure-results/screenshots/#{screenshot_name}.png"),
|
20
|
+
type: Allure::ContentType::PNG,
|
21
|
+
test_case: true
|
22
|
+
)
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
<%- end -%>
|
25
|
+
<%- if framework == 'rspec' -%>
|
26
|
+
def formatter
|
27
|
+
AllureRspecFormatter
|
31
28
|
end
|
29
|
+
<%- end -%>
|
32
30
|
end
|
33
31
|
end
|
@@ -1,29 +1,27 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
return driver.find_element(strategy(opts) => selector(opts)) if opts[os]
|
1
|
+
module AppiumHelper
|
2
|
+
def element(opts = {})
|
3
|
+
return driver.find_element(strategy(opts) => selector(opts)) if opts[os]
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
driver.find_element(opts)
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
def elements(opts = {})
|
9
|
+
return driver.find_elements(strategy(opts) => selector(opts)) if opts[os]
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
driver.find_elements(opts)
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def os
|
15
|
+
driver.appium_device
|
16
|
+
end
|
18
17
|
|
19
|
-
|
18
|
+
private
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def strategy(opts)
|
21
|
+
opts[os].keys.first
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
24
|
+
def selector(opts)
|
25
|
+
opts[os][strategy(opts)]
|
26
|
+
end
|
29
27
|
end
|