ruby_raider 0.3.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -5
- data/Rakefile +1 -1
- data/lib/generators/automation_generator.rb +13 -15
- data/lib/generators/common_generator.rb +0 -1
- data/lib/generators/cucumber_generator.rb +0 -1
- data/lib/generators/generator.rb +2 -2
- data/lib/generators/helper_generator.rb +8 -13
- data/lib/generators/rspec_generator.rb +0 -2
- data/lib/generators/templates/common/read_me.tt +34 -71
- data/lib/ruby_raider.rb +56 -20
- data/lib/scaffolding/scaffolding.rb +11 -1
- data/lib/scaffolding/templates/helper.tt +3 -0
- data/lib/utilities/utilities.rb +19 -3
- data/ruby_raider.gemspec +3 -4
- data/spec/ruby_raider_spec.rb +134 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07240bddaf0b3edae4d1d8202df31ac428c143941680f02fb51ea54a8b478d37
|
4
|
+
data.tar.gz: 887a4fc52c2c5899cc5999292a1edd3a357d1ecedbac9dea691edb06f980c6f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4cf0f65241e104cb96ee22ee79e61a24e049cf834aed0ea0098ea801f64cabe0a037d3846f50c5d60148b50e4a2621fa06329f1a697ea2ee8750b6656c78a49
|
7
|
+
data.tar.gz: ed34541a0df8cf638630d6db03617e1aff99a0fb7432378971ccd371242be91624c3940e94769acc9d5058194b27a946d40c15a955291ff2d5dee5de5d413e55
|
data/README.md
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# Ruby Raider
|
2
|
+
|
3
|
+
This is a gem to make setup and start of UI automation projects easier
|
4
|
+
You can find more information and updates on releases in : https://ruby-raider.com/
|
4
5
|
|
5
6
|
Just do:
|
6
7
|
|
7
8
|
**gem install ruby_raider**
|
8
9
|
|
9
|
-
then do:
|
10
|
+
then do:
|
10
11
|
|
11
|
-
**raider new [name_of_project]**
|
12
|
+
**raider new [name_of_project]**
|
12
13
|
|
13
14
|
and you will have a new project in the folder you are in
|
14
15
|
|
@@ -21,3 +22,39 @@ Currently we only support:
|
|
21
22
|
In order to run the appium tests, download the example [app](https://github.com/cloudgrey-io/the-app/releases/tag/v1.10.0)
|
22
23
|
|
23
24
|
This works in all the platforms (Tested on Mac OS, Linux and Windows)
|
25
|
+
|
26
|
+
**Ruby raider provides the following list of commands**
|
27
|
+
```
|
28
|
+
raider browser [BROWSER] # Sets the default browser for a project
|
29
|
+
|
30
|
+
raider feature [FEATURE_NAME] # Creates a new feature
|
31
|
+
|
32
|
+
raider help [COMMAND] # Describe available commands or one specific command
|
33
|
+
|
34
|
+
raider helper [HELPER_NAME] # Creates a new helper
|
35
|
+
|
36
|
+
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
37
|
+
|
38
|
+
raider page [PAGE_NAME] # Creates a new page object
|
39
|
+
|
40
|
+
raider path [PATH] # Sets the default path for scaffolding
|
41
|
+
|
42
|
+
raider raid # It runs all the tests in a project
|
43
|
+
|
44
|
+
raider spec [SPEC_NAME] # Creates a new spec
|
45
|
+
|
46
|
+
raider url [URL] # Sets the default url for a project
|
47
|
+
```
|
48
|
+
|
49
|
+
It's possible to add the option --path or -p if you want to specify where to create your features, pages, helpers and
|
50
|
+
specs.
|
51
|
+
|
52
|
+
If you want to set the default path for the creation of your features, helpers and specs:
|
53
|
+
|
54
|
+
```
|
55
|
+
raider path [PATH_NAME] --feature or -f
|
56
|
+
raider path [PATH_NAME] --spec or -s
|
57
|
+
raider path [PATH_NAME] --helper or -h
|
58
|
+
```
|
59
|
+
|
60
|
+
If you don't specify an option path will assume you want to change the default path for pages
|
data/Rakefile
CHANGED
@@ -12,32 +12,30 @@ class AutomationGenerator < Generator
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def generate_home_page
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
return unless @_initializer.first.include?('appium_ios')
|
16
|
+
|
17
|
+
template('automation/home_page.tt', "#{name}/page_objects/pages/home_page.rb")
|
18
18
|
end
|
19
19
|
|
20
20
|
def generate_header_component
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
return if @_initializer.first.include?('appium_ios')
|
22
|
+
|
23
|
+
template('automation/component.tt', "#{name}/page_objects/components/header_component.rb")
|
24
24
|
end
|
25
25
|
|
26
26
|
def generate_abstract_component
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
return if @_initializer.first.include?('appium_ios')
|
28
|
+
|
29
|
+
template('automation/abstract_component.tt', "#{name}/page_objects/abstract/abstract_component.rb")
|
30
30
|
end
|
31
31
|
|
32
32
|
def generate_confirmation_page
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
return unless @_initializer.first.include?('appium_ios')
|
34
|
+
|
35
|
+
template('automation/confirmation_page.tt', "#{name}/page_objects/pages/confirmation_page.rb")
|
36
36
|
end
|
37
37
|
|
38
38
|
def generate_appium_settings
|
39
|
-
if @_initializer.first.include?('appium_ios')
|
40
|
-
template('automation/appium_settings.tt', "#{name}/appium.txt")
|
41
|
-
end
|
39
|
+
template('automation/appium_settings.tt', "#{name}/appium.txt") if @_initializer.first.include?('appium_ios')
|
42
40
|
end
|
43
41
|
end
|
data/lib/generators/generator.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'thor'
|
3
4
|
|
4
5
|
class Generator < Thor::Group
|
@@ -9,7 +10,6 @@ class Generator < Thor::Group
|
|
9
10
|
argument :name
|
10
11
|
|
11
12
|
def self.source_root
|
12
|
-
File.dirname(__FILE__)
|
13
|
+
"#{File.dirname(__FILE__)}/templates"
|
13
14
|
end
|
14
15
|
end
|
15
|
-
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require_relative 'generator'
|
4
4
|
|
5
5
|
class HelpersGenerator < Generator
|
6
|
-
|
7
6
|
def generate_raider_helper
|
8
7
|
template('helpers/raider_helper.tt', "#{name}/helpers/raider.rb")
|
9
8
|
end
|
@@ -13,26 +12,22 @@ class HelpersGenerator < Generator
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def generate_browser_helper
|
16
|
-
if @_initializer.first.include?('watir')
|
17
|
-
template('helpers/browser_helper.tt', "#{name}/helpers/browser_helper.rb")
|
18
|
-
end
|
15
|
+
template('helpers/browser_helper.tt', "#{name}/helpers/browser_helper.rb") if @_initializer.first.include?('watir')
|
19
16
|
end
|
20
17
|
|
21
18
|
def generate_spec_helper
|
22
|
-
if @_initializer.first.include?('rspec')
|
23
|
-
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb")
|
24
|
-
end
|
19
|
+
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb") if @_initializer.first.include?('rspec')
|
25
20
|
end
|
26
21
|
|
27
22
|
def generate_selenium_helper
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
return unless @_initializer.first.include?('selenium')
|
24
|
+
|
25
|
+
template('helpers/selenium_helper.tt', "#{name}/helpers/selenium_helper.rb")
|
31
26
|
end
|
32
27
|
|
33
28
|
def generate_driver_helper
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
return if @_initializer.first.include?('watir')
|
30
|
+
|
31
|
+
template('helpers/driver_helper.tt', "#{name}/helpers/driver_helper.rb")
|
37
32
|
end
|
38
33
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require_relative 'generator'
|
4
4
|
|
5
5
|
class RspecGenerator < Generator
|
6
|
-
|
7
6
|
def generate_spec
|
8
7
|
template('rspec/spec.tt', "#{name}/spec/login_page_spec.rb")
|
9
8
|
end
|
@@ -12,4 +11,3 @@ class RspecGenerator < Generator
|
|
12
11
|
template('rspec/base_spec.tt', "#{name}/spec/base_spec.rb")
|
13
12
|
end
|
14
13
|
end
|
15
|
-
|
@@ -1,97 +1,60 @@
|
|
1
|
-
|
2
|
-
===========
|
1
|
+
# Ruby Raider
|
3
2
|
|
4
|
-
|
3
|
+
This is a gem to make setup and start of UI automation projects easier
|
4
|
+
You can find more information and updates on releases in : https://ruby-raider.com/
|
5
5
|
|
6
|
-
|
6
|
+
Just do:
|
7
7
|
|
8
|
-
|
9
|
-
https://rvm.io/rvm/install
|
8
|
+
**gem install ruby_raider**
|
10
9
|
|
11
|
-
|
10
|
+
then do:
|
12
11
|
|
13
|
-
|
14
|
-
*rspec spec/*
|
12
|
+
**raider new [name_of_project]**
|
15
13
|
|
16
|
-
|
17
|
-
*parallel_rspec spec/*
|
14
|
+
and you will have a new project in the folder you are in
|
18
15
|
|
19
|
-
|
16
|
+
Currently we only support:
|
20
17
|
|
21
|
-
|
18
|
+
* Gerating a Selenium with both Cucumber and Rspec framework
|
19
|
+
* Gerating a Watir with both Cucumber and Rspec framework
|
20
|
+
* Generating an Appium project with Rspec and Cucumber on IOS
|
22
21
|
|
23
|
-
|
22
|
+
In order to run the appium tests, download the example [app](https://github.com/cloudgrey-io/the-app/releases/tag/v1.10.0)
|
24
23
|
|
25
|
-
|
24
|
+
This works in all the platforms (Tested on Mac OS, Linux and Windows)
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
or
|
30
|
-
|
31
|
-
*describe 'A user cannot'/*
|
32
|
-
|
33
|
-
This saves us repetition and forces us into an structure
|
34
|
-
|
35
|
-
At last we use 'it' for the specific action the user can or cannot perform:
|
36
|
-
|
37
|
-
it 'login with right credentials'
|
38
|
-
|
39
|
-
If we group all of this together it will look like
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
context 'On the login page' do
|
43
|
-
describe 'A user can' do
|
44
|
-
it 'login with the right credentials' do
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'A user cannot' do
|
49
|
-
it 'login with the wrong credentials' do
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
26
|
+
**Ruby raider provides the following list of commands**
|
53
27
|
```
|
54
|
-
|
28
|
+
raider browser [BROWSER] # Sets the default browser for a project
|
55
29
|
|
56
|
-
#
|
30
|
+
raider feature [FEATURE_NAME] # Creates a new feature
|
57
31
|
|
58
|
-
|
59
|
-
require_relative '../abstract/base_page'
|
32
|
+
raider help [COMMAND] # Describe available commands or one specific command
|
60
33
|
|
61
|
-
|
34
|
+
raider helper [HELPER_NAME] # Creates a new helper
|
62
35
|
|
63
|
-
|
36
|
+
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
64
37
|
|
65
|
-
|
66
|
-
'/'
|
67
|
-
end
|
38
|
+
raider page [PAGE_NAME] # Creates a new page object
|
68
39
|
|
69
|
-
#
|
40
|
+
raider path [PATH] # Sets the default path for scaffolding
|
70
41
|
|
71
|
-
|
72
|
-
currency_dropdown.select currency
|
73
|
-
end
|
42
|
+
raider raid # It runs all the tests in a project
|
74
43
|
|
75
|
-
#
|
44
|
+
raider spec [SPEC_NAME] # Creates a new spec
|
76
45
|
|
77
|
-
|
78
|
-
|
79
|
-
end
|
46
|
+
raider url [URL] # Sets the default url for a project
|
47
|
+
```
|
80
48
|
|
81
|
-
|
49
|
+
It's possible to add the option --path or -p if you want to specify where to create your features, pages, helpers and
|
50
|
+
specs.
|
82
51
|
|
83
|
-
|
52
|
+
If you want to set the default path for the creation of your features, helpers and specs:
|
84
53
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
54
|
+
```
|
55
|
+
raider path [PATH_NAME] --feature or -f
|
56
|
+
raider path [PATH_NAME] --spec or -s
|
57
|
+
raider path [PATH_NAME] --helper or -h
|
89
58
|
```
|
90
59
|
|
91
|
-
|
92
|
-
Each page has to have a url define, and each page is using the module WatirHelper to add methods on runtime to the Watir elements
|
93
|
-
|
94
|
-
# Mobile:
|
95
|
-
|
96
|
-
For the appium base project to work you need to have [appium](https://appium.io)
|
97
|
-
and download [the example app](https://github.com/cloudgrey-io/the-app/releases/tag/v1.10.0)
|
60
|
+
If you don't specify an option path will assume you want to change the default path for pages
|
data/lib/ruby_raider.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
require 'yaml'
|
3
5
|
require_relative 'generators/menu_generator'
|
@@ -5,20 +7,20 @@ require_relative '../lib/scaffolding/scaffolding'
|
|
5
7
|
require_relative '../lib/utilities/utilities'
|
6
8
|
|
7
9
|
class RubyRaider < Thor
|
8
|
-
desc
|
10
|
+
desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
|
9
11
|
|
10
12
|
def new(project_name)
|
11
13
|
MenuGenerator.generate_choice_menu(project_name)
|
12
14
|
end
|
13
15
|
|
14
|
-
desc
|
16
|
+
desc 'page [PAGE_NAME]', 'Creates a new page object'
|
15
17
|
option :path,
|
16
|
-
:
|
18
|
+
type: :string, required: false, desc: 'The path where your page will be created', aliases: '-p'
|
17
19
|
option :delete,
|
18
|
-
:
|
20
|
+
type: :boolean, required: false, desc: 'This will delete the selected page', aliases: '-d'
|
19
21
|
|
20
22
|
def page(name)
|
21
|
-
path = options[:path].nil? ? load_config_path : options[:path]
|
23
|
+
path = options[:path].nil? ? load_config_path('page') : options[:path]
|
22
24
|
if options[:delete]
|
23
25
|
Scaffolding.new([name, path]).delete_class
|
24
26
|
else
|
@@ -26,14 +28,14 @@ class RubyRaider < Thor
|
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
desc
|
31
|
+
desc 'feature [FEATURE_NAME]', 'Creates a new feature'
|
30
32
|
option :path,
|
31
|
-
:
|
33
|
+
type: :string, required: false, desc: 'The path where your feature will be created', aliases: '-p'
|
32
34
|
option :delete,
|
33
|
-
:
|
35
|
+
type: :boolean, required: false, desc: 'This will delete the selected feature', aliases: '-d'
|
34
36
|
|
35
37
|
def feature(name)
|
36
|
-
path = options[:path].nil? ? load_config_path : options[:path]
|
38
|
+
path = options[:path].nil? ? load_config_path('feature') : options[:path]
|
37
39
|
if options[:delete]
|
38
40
|
Scaffolding.new([name, path]).delete_feature
|
39
41
|
else
|
@@ -41,14 +43,14 @@ class RubyRaider < Thor
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
desc
|
46
|
+
desc 'spec [SPEC_NAME]', 'Creates a new spec'
|
45
47
|
option :path,
|
46
|
-
:
|
48
|
+
type: :string, required: false, desc: 'The path where your spec will be created', aliases: '-p'
|
47
49
|
option :delete,
|
48
|
-
:
|
50
|
+
type: :boolean, required: false, desc: 'This will delete the selected spec', aliases: '-d'
|
49
51
|
|
50
52
|
def spec(name)
|
51
|
-
path = options[:path].nil? ? load_config_path : options[:path]
|
53
|
+
path = options[:path].nil? ? load_config_path('spec') : options[:path]
|
52
54
|
if options[:delete]
|
53
55
|
Scaffolding.new([name, path]).delete_spec
|
54
56
|
else
|
@@ -56,33 +58,67 @@ class RubyRaider < Thor
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
59
|
-
desc
|
61
|
+
desc 'helper [HELPER_NAME]', 'Creates a new helper'
|
62
|
+
option :path,
|
63
|
+
type: :string, required: false, desc: 'The path where your helper will be created', aliases: '-p'
|
64
|
+
option :delete,
|
65
|
+
type: :boolean, required: false, desc: 'This will delete the selected helper', aliases: '-d'
|
66
|
+
|
67
|
+
def helper(name)
|
68
|
+
path = options[:path].nil? ? load_config_path('helper') : options[:path]
|
69
|
+
if options[:delete]
|
70
|
+
Scaffolding.new([name, path]).delete_helper
|
71
|
+
else
|
72
|
+
Scaffolding.new([name, path]).generate_helper
|
73
|
+
end
|
74
|
+
end
|
60
75
|
|
76
|
+
desc 'path [PATH]', 'Sets the default path for scaffolding'
|
77
|
+
option :feature,
|
78
|
+
type: :boolean, required: false, desc: 'The default path for your features', aliases: '-f'
|
79
|
+
option :helper,
|
80
|
+
type: :boolean, required: false, desc: 'The default path for your helpers', aliases: '-h'
|
81
|
+
option :spec,
|
82
|
+
type: :boolean, required: false, desc: 'The default path for your specs', aliases: '-s'
|
61
83
|
def path(default_path)
|
62
|
-
|
84
|
+
type = options.empty? ? 'page' : options.keys.first
|
85
|
+
Utilities.new.send("#{type}_path=", default_path)
|
63
86
|
end
|
64
87
|
|
65
|
-
desc
|
88
|
+
desc 'url [URL]', 'Sets the default url for a project'
|
66
89
|
|
67
90
|
def url(default_url)
|
68
91
|
Utilities.new.url = default_url
|
69
92
|
end
|
70
93
|
|
71
|
-
desc
|
94
|
+
desc 'browser [BROWSER]', 'Sets the default browser for a project'
|
72
95
|
|
73
96
|
def browser(default_browser)
|
74
97
|
Utilities.new.browser = default_browser
|
75
98
|
end
|
76
99
|
|
77
|
-
desc
|
100
|
+
desc 'raid', 'It runs all the tests in a project'
|
78
101
|
|
79
102
|
def raid
|
80
103
|
Utilities.new.run
|
81
104
|
end
|
82
105
|
|
106
|
+
desc 'scaffold [SCAFFOLD_NAME]', 'It generates everything needed to start automating'
|
107
|
+
def scaffold(name)
|
108
|
+
if Pathname.new('spec').exist? && !Pathname.new('features').exist?
|
109
|
+
Scaffolding.new([name, load_config_path('spec')]).generate_spec
|
110
|
+
Scaffolding.new([name, load_config_path('page')]).generate_class
|
111
|
+
elsif Pathname.new('features').exist?
|
112
|
+
Scaffolding.new([name, load_config_path('feature')]).generate_feature
|
113
|
+
Scaffolding.new([name, load_config_path('page')]).generate_class
|
114
|
+
else
|
115
|
+
raise 'No features or spec folders where found. We are not sure which type of project you are running'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
83
119
|
no_commands do
|
84
|
-
def load_config_path
|
85
|
-
YAML.load_file('config/config.yml')[
|
120
|
+
def load_config_path(type)
|
121
|
+
YAML.load_file('config/config.yml')["#{type}_path"] unless YAML.load_file('config/config.yml').nil?
|
86
122
|
end
|
87
123
|
end
|
88
124
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
|
3
5
|
class Scaffolding < Thor::Group
|
@@ -7,7 +9,7 @@ class Scaffolding < Thor::Group
|
|
7
9
|
argument :path, optional: true
|
8
10
|
|
9
11
|
def self.source_root
|
10
|
-
File.dirname(__FILE__)
|
12
|
+
"#{File.dirname(__FILE__)}/templates"
|
11
13
|
end
|
12
14
|
|
13
15
|
def generate_class
|
@@ -22,6 +24,10 @@ class Scaffolding < Thor::Group
|
|
22
24
|
template('spec.tt', default_path("spec/#{name}_spec.rb", '_spec.rb'))
|
23
25
|
end
|
24
26
|
|
27
|
+
def generate_helper
|
28
|
+
template('helper.tt', default_path("helpers/#{name}_helper.rb", '_helper.rb'))
|
29
|
+
end
|
30
|
+
|
25
31
|
def delete_class
|
26
32
|
remove_file(default_path("page_objects/pages/#{name}_page.rb", '_page.rb'))
|
27
33
|
end
|
@@ -34,6 +40,10 @@ class Scaffolding < Thor::Group
|
|
34
40
|
remove_file(default_path("spec/#{name}_spec.rb", '_spec.rb'))
|
35
41
|
end
|
36
42
|
|
43
|
+
def delete_helper
|
44
|
+
remove_file(default_path("helpers/#{name}_helper.rb", '_helper.rb'))
|
45
|
+
end
|
46
|
+
|
37
47
|
def default_path(standard_path, file_type)
|
38
48
|
path.nil? ? standard_path : "#{path}/#{name}#{file_type}"
|
39
49
|
end
|
data/lib/utilities/utilities.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
|
3
5
|
class Utilities
|
4
|
-
|
5
6
|
def initialize
|
6
7
|
@path = 'config/config.yml'
|
7
8
|
@config = YAML.load_file(@path)
|
@@ -12,8 +13,23 @@ class Utilities
|
|
12
13
|
overwrite_yaml
|
13
14
|
end
|
14
15
|
|
15
|
-
def
|
16
|
-
@config['
|
16
|
+
def page_path=(path)
|
17
|
+
@config['page_path'] = path
|
18
|
+
overwrite_yaml
|
19
|
+
end
|
20
|
+
|
21
|
+
def spec_path=(path)
|
22
|
+
@config['spec_path'] = path
|
23
|
+
overwrite_yaml
|
24
|
+
end
|
25
|
+
|
26
|
+
def feature_path=(path)
|
27
|
+
@config['feature_path'] = path
|
28
|
+
overwrite_yaml
|
29
|
+
end
|
30
|
+
|
31
|
+
def helper_path=(path)
|
32
|
+
@config['helper_path'] = path
|
17
33
|
overwrite_yaml
|
18
34
|
end
|
19
35
|
|
data/ruby_raider.gemspec
CHANGED
@@ -2,13 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ruby_raider'
|
5
|
-
s.version = '0.3.
|
5
|
+
s.version = '0.3.3'
|
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']
|
9
9
|
s.email = 'agustin.pe94@gmail.com'
|
10
|
-
s.homepage = '
|
11
|
-
s.files = %w[bin/* lib/* lib/**/*]
|
10
|
+
s.homepage = 'https://github.com/RubyRaider/ruby_raider'
|
12
11
|
s.license = 'MIT'
|
13
12
|
s.required_ruby_version = '>= 3.0.0'
|
14
13
|
s.files = `git ls-files -z`.split("\x0")
|
@@ -16,9 +15,9 @@ Gem::Specification.new do |s|
|
|
16
15
|
s.executables << 'raider'
|
17
16
|
s.add_development_dependency 'rake', '~> 13.0.6'
|
18
17
|
s.add_development_dependency 'reek', '~> 6.1.0'
|
18
|
+
s.add_development_dependency 'rspec', '~> 3.11.0'
|
19
19
|
s.add_development_dependency 'rubocop', '~> 1.27'
|
20
20
|
s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
|
21
|
-
s.add_development_dependency 'rspec', '~> 3.11.0'
|
22
21
|
|
23
22
|
s.add_runtime_dependency 'highline', '~> 2.0.3'
|
24
23
|
s.add_runtime_dependency 'thor', '~> 1.2.1'
|
data/spec/ruby_raider_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'yaml'
|
2
3
|
require_relative 'spec_helper'
|
3
4
|
require_relative '../lib/ruby_raider'
|
4
5
|
require_relative '../lib/generators/common_generator'
|
@@ -28,6 +29,11 @@ describe RubyRaider do
|
|
28
29
|
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
29
30
|
end
|
30
31
|
|
32
|
+
it 'creates a helper' do
|
33
|
+
raider.new.invoke(:helper, nil, %W[#{name}])
|
34
|
+
expect(Pathname.new("helpers/#{name}_helper.rb")).to be_file
|
35
|
+
end
|
36
|
+
|
31
37
|
it 'deletes a page' do
|
32
38
|
raider.new.invoke(:page, nil, %W[#{name}])
|
33
39
|
raider.new.invoke(:page, nil, %W[#{name} --delete])
|
@@ -46,8 +52,14 @@ describe RubyRaider do
|
|
46
52
|
expect(Pathname.new("spec/#{name}_spec.rb")).to_not be_file
|
47
53
|
end
|
48
54
|
|
55
|
+
it 'deletes a helper' do
|
56
|
+
raider.new.invoke(:helper, nil, %W[#{name}])
|
57
|
+
raider.new.invoke(:helper, nil, %W[#{name} --delete])
|
58
|
+
expect(Pathname.new("helpers/#{name}_helper.rb")).to_not be_file
|
59
|
+
end
|
60
|
+
|
49
61
|
after(:all) do
|
50
|
-
folders = %w[test config page_objects features]
|
62
|
+
folders = %w[test config page_objects features helpers]
|
51
63
|
folders.each do |folder|
|
52
64
|
FileUtils.rm_rf(folder)
|
53
65
|
end
|
@@ -73,8 +85,129 @@ describe RubyRaider do
|
|
73
85
|
expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
|
74
86
|
end
|
75
87
|
|
88
|
+
it 'creates a helper' do
|
89
|
+
raider.new.invoke(:helper, nil, %W[#{name} --path #{path}])
|
90
|
+
expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
|
91
|
+
end
|
92
|
+
|
76
93
|
after(:each) do
|
77
94
|
FileUtils.rm_rf(path)
|
78
95
|
end
|
79
96
|
end
|
97
|
+
|
98
|
+
context 'changes the default path' do
|
99
|
+
let(:path) { 'test_folder' }
|
100
|
+
|
101
|
+
before(:all) do
|
102
|
+
CommonGenerator.new(%w[rspec cucumber test]).invoke(:generate_config_file)
|
103
|
+
FileUtils.cp_lr('test/config', './')
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'changes the path for pages' do
|
107
|
+
raider.new.invoke(:path, nil, %W[#{path}])
|
108
|
+
config = YAML.load_file('config/config.yml')
|
109
|
+
expect(config['page_path']).to eql path
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'changes the path for features' do
|
113
|
+
raider.new.invoke(:path, nil, %W[#{path} -f])
|
114
|
+
config = YAML.load_file('config/config.yml')
|
115
|
+
expect(config['feature_path']).to eql path
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'changes the path for specs' do
|
119
|
+
raider.new.invoke(:path, nil, %W[#{path} -s])
|
120
|
+
config = YAML.load_file('config/config.yml')
|
121
|
+
expect(config['spec_path']).to eql path
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'creates page' do
|
125
|
+
raider.new.invoke(:path, nil, %W[#{path}])
|
126
|
+
raider.new.invoke(:page, nil, %W[#{name}])
|
127
|
+
expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'creates feature' do
|
131
|
+
raider.new.invoke(:path, nil, %W[#{path} -f])
|
132
|
+
raider.new.invoke(:feature, nil, %W[#{name}])
|
133
|
+
expect(Pathname.new("#{path}/#{name}.feature")).to be_file
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'creates spec' do
|
137
|
+
raider.new.invoke(:path, nil, %W[#{path} -s])
|
138
|
+
raider.new.invoke(:spec, nil, %W[#{name}])
|
139
|
+
expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'creates spec' do
|
143
|
+
raider.new.invoke(:path, nil, %W[#{path} -h])
|
144
|
+
raider.new.invoke(:helper, nil, %W[#{name}])
|
145
|
+
expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
|
146
|
+
end
|
147
|
+
|
148
|
+
after(:all) do
|
149
|
+
folders = %w[test_folder test config]
|
150
|
+
folders.each do |folder|
|
151
|
+
FileUtils.rm_rf(folder)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context 'updates the config file' do
|
157
|
+
before(:all) do
|
158
|
+
CommonGenerator.new(%w[rspec selenium test]).invoke(:generate_config_file)
|
159
|
+
FileUtils.cp_lr('test/config', './')
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'updates the url' do
|
163
|
+
raider.new.invoke(:url, nil, %W[test.com])
|
164
|
+
config = YAML.load_file('config/config.yml')
|
165
|
+
expect(config['url']).to eql 'test.com'
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'updates the browser' do
|
169
|
+
raider.new.invoke(:browser, nil, %W[:firefox])
|
170
|
+
config = YAML.load_file('config/config.yml')
|
171
|
+
expect(config['browser']).to eql ':firefox'
|
172
|
+
end
|
173
|
+
|
174
|
+
after(:all) do
|
175
|
+
folders = %w[test config]
|
176
|
+
folders.each do |folder|
|
177
|
+
FileUtils.rm_rf(folder)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
context 'scaffolding' do
|
183
|
+
before(:all) do
|
184
|
+
CommonGenerator.new(%w[rspec selenium test]).invoke(:generate_config_file)
|
185
|
+
FileUtils.cp_lr('test/config', './')
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'with a spec folder' do
|
189
|
+
it 'scaffolds for rspec' do
|
190
|
+
raider.new.invoke(:scaffold, nil, %W[#{name}])
|
191
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
192
|
+
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'with a features folder' do
|
197
|
+
it 'scaffolds for cucumber' do
|
198
|
+
FileUtils.mkdir 'features'
|
199
|
+
raider.new.invoke(:scaffold, nil, %W[#{name}])
|
200
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
201
|
+
expect(Pathname.new("features/#{name}.feature")).to be_file
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
after(:all) do
|
206
|
+
folders = %w[test config page_objects features]
|
207
|
+
folders.each do |folder|
|
208
|
+
FileUtils.rm_rf(folder)
|
209
|
+
end
|
210
|
+
FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
|
211
|
+
end
|
212
|
+
end
|
80
213
|
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.3.
|
4
|
+
version: 0.3.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-06-
|
11
|
+
date: 2022-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -39,47 +39,47 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 6.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.11.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.11.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
56
|
+
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '1.27'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '1.27'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
70
|
+
name: rubocop-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.9.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.9.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- lib/ruby_raider.rb
|
181
181
|
- lib/scaffolding/scaffolding.rb
|
182
182
|
- lib/scaffolding/templates/feature.tt
|
183
|
+
- lib/scaffolding/templates/helper.tt
|
183
184
|
- lib/scaffolding/templates/page_object.tt
|
184
185
|
- lib/scaffolding/templates/spec.tt
|
185
186
|
- lib/utilities/utilities.rb
|
@@ -191,7 +192,7 @@ files:
|
|
191
192
|
- spec/rspec_generator_spec.rb
|
192
193
|
- spec/ruby_raider_spec.rb
|
193
194
|
- spec/spec_helper.rb
|
194
|
-
homepage:
|
195
|
+
homepage: https://github.com/RubyRaider/ruby_raider
|
195
196
|
licenses:
|
196
197
|
- MIT
|
197
198
|
metadata: {}
|