ruby_raider 0.2.9 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d575add5f8d018b9cab6a72968c22e2bf00808982e7ddde0e325ec7b7c0a909c
4
- data.tar.gz: b6536a04863e704a8e5a99220f956d43ab68ee3a459b184b0358756f834b6a58
3
+ metadata.gz: 3b40b177b2b89c4585ae988d6c1747e7eb58761d4817cac54a194ae532f80d77
4
+ data.tar.gz: e758ab9ef9922f963b5f3da0763713c7c1cba1890d1d6974b687a6fa62a7eaed
5
5
  SHA512:
6
- metadata.gz: fe3f887d46ccba5928977aedca472b3c530d60b4fce6a9dc11ec89f1f313a433cb44a32161acf1dd9f809ad86b8e3a9ee01cc957da01604e9b2e8a3ef13cfa9e
7
- data.tar.gz: 1fdf3654fcf68315a99b67b70814d3bfbc2766747e20f0b0f86d6052b200a9b092edf6c4f4cd45505a6ca69c51fe3b7882a49f2de0436cf4f4f456a254cf7af8
6
+ metadata.gz: 574e301014b379f362a08aba90a5dda00391210c602d751a0f6e953c37f19c9c07364c9556944eae47b5ef15a58f2170b1530436fef6c520454895de72f8c253
7
+ data.tar.gz: a2f4a9319b508daf6ffb39498eeeacb97b1544ddd44eb19e9832c2db69c121c8df7c784002de9e5847e9d6732db997b63996d98ea285eda8f4c10544f170f8dd
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ .
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1 @@
1
+ How to start contributing
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Agustin Pequeno
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
- # ruby_raider
2
- This is a gem to make setup and start of UI automation projects easier
3
- You can find more information and updates on releaseas in : https://ruby-raider.com/
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
@@ -1,97 +1,60 @@
1
- What is Raider?
2
- ===========
1
+ # Ruby Raider
3
2
 
4
- Raider is a tool to make the setup and start of automation projects in ruby easier, with one command you are ready to go
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
- # Pre-requisites:
6
+ Just do:
7
7
 
8
- Install RVM:
9
- https://rvm.io/rvm/install
8
+ **gem install ruby_raider**
10
9
 
11
- # How to use the framework:
10
+ then do:
12
11
 
13
- If you want to run all the tests from your terminal do:
14
- *rspec spec/*
12
+ **raider new [name_of_project]**
15
13
 
16
- If you want to run all the tests in parallel do:
17
- *parallel_rspec spec/*
14
+ and you will have a new project in the folder you are in
18
15
 
19
- # How are specs organized:
16
+ Currently we only support:
20
17
 
21
- We use 'context' as the highest grouping level to indicate in which part of the application we are as an example:
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
- *context 'On the login page'/*
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
- We use 'describe' from the user perspective to describe an action that the user can or cannot take:
24
+ This works in all the platforms (Tested on Mac OS, Linux and Windows)
26
25
 
27
- *describe 'A user can'/*
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
- This is readed as 'On the login page a user can login with the right credentials' and 'On the login page a user cannot login with the wrong credentials'
28
+ raider browser [BROWSER] # Sets the default browser for a project
55
29
 
56
- # How pages are organized:
30
+ raider feature [FEATURE_NAME] # Creates a new feature
57
31
 
58
- ```ruby#{' '}
59
- require_relative '../abstract/base_page'
32
+ raider help [COMMAND] # Describe available commands or one specific command
60
33
 
61
- class MainPage < BasePage
34
+ raider helper [HELPER_NAME] # Creates a new helper
62
35
 
63
- using Raider::WatirHelper
36
+ raider new [PROJECT_NAME] # Creates a new framework based on settings picked
64
37
 
65
- def url(_page)
66
- '/'
67
- end
38
+ raider page [PAGE_NAME] # Creates a new page object
68
39
 
69
- # Actions
40
+ raider path [PATH] # Sets the default path for scaffolding
70
41
 
71
- def change_currency(currency)
72
- currency_dropdown.select currency
73
- end
42
+ raider raid # It runs all the tests in a project
74
43
 
75
- # Validations
44
+ raider spec [SPEC_NAME] # Creates a new spec
76
45
 
77
- def validate_currency(currency)
78
- expect(currency_dropdown.include?(currency)).to be true
79
- end
46
+ raider url [URL] # Sets the default url for a project
47
+ ```
80
48
 
81
- private
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
- # Elements
52
+ If you want to set the default path for the creation of your features, helpers and specs:
84
53
 
85
- def currency_dropdown
86
- browser.select(class: %w[dropdown-menu currency])
87
- end
88
- end
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
- Pages are organized in Actions (things a user can perform on the page), Validations (assertions), and Elements.
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
@@ -6,48 +6,104 @@ require_relative '../lib/utilities/utilities'
6
6
 
7
7
  class RubyRaider < Thor
8
8
  desc "new [PROJECT_NAME]", "Creates a new framework based on settings picked"
9
+
9
10
  def new(project_name)
10
11
  MenuGenerator.generate_choice_menu(project_name)
11
12
  end
12
13
 
13
14
  desc "page [PAGE_NAME]", "Creates a new page object"
15
+ option :path,
16
+ :type => :string, :required => false, :desc => 'The path where your page will be created', :aliases => '-p'
17
+ option :delete,
18
+ :type => :boolean, :required => false, :desc => 'This will delete the selected page', :aliases => '-d'
19
+
14
20
  def page(name)
15
- Scaffolding.new([name, load_config_path]).generate_class
21
+ path = options[:path].nil? ? load_config_path('page') : options[:path]
22
+ if options[:delete]
23
+ Scaffolding.new([name, path]).delete_class
24
+ else
25
+ Scaffolding.new([name, path]).generate_class
26
+ end
16
27
  end
17
28
 
18
29
  desc "feature [FEATURE_NAME]", "Creates a new feature"
30
+ option :path,
31
+ :type => :string, :required => false, :desc => 'The path where your feature will be created', :aliases => '-p'
32
+ option :delete,
33
+ :type => :boolean, :required => false, :desc => 'This will delete the selected feature', :aliases => '-d'
34
+
19
35
  def feature(name)
20
- Scaffolding.new([name, load_config_path]).generate_feature
36
+ path = options[:path].nil? ? load_config_path('feature') : options[:path]
37
+ if options[:delete]
38
+ Scaffolding.new([name, path]).delete_feature
39
+ else
40
+ Scaffolding.new([name, path]).generate_feature
41
+ end
21
42
  end
22
43
 
23
44
  desc "spec [SPEC_NAME]", "Creates a new spec"
45
+ option :path,
46
+ :type => :string, :required => false, :desc => 'The path where your spec will be created', :aliases => '-p'
47
+ option :delete,
48
+ :type => :boolean, :required => false, :desc => 'This will delete the selected spec', :aliases => '-d'
49
+
24
50
  def spec(name)
25
- Scaffolding.new([name, load_config_path]).generate_spec
51
+ path = options[:path].nil? ? load_config_path('spec') : options[:path]
52
+ if options[:delete]
53
+ Scaffolding.new([name, path]).delete_spec
54
+ else
55
+ Scaffolding.new([name, path]).generate_spec
56
+ end
57
+ end
58
+
59
+ desc "helper [HELPER_NAME]", "Creates a new helper"
60
+ option :path,
61
+ :type => :string, :required => false, :desc => 'The path where your helper will be created', :aliases => '-p'
62
+ option :delete,
63
+ :type => :boolean, :required => false, :desc => 'This will delete the selected helper', :aliases => '-d'
64
+
65
+ def helper(name)
66
+ path = options[:path].nil? ? load_config_path('helper') : options[:path]
67
+ if options[:delete]
68
+ Scaffolding.new([name, path]).delete_helper
69
+ else
70
+ Scaffolding.new([name, path]).generate_helper
71
+ end
26
72
  end
27
73
 
28
74
  desc "path [PATH]", "Sets the default path for scaffolding"
75
+ option :feature,
76
+ :type => :boolean, :required => false, :desc => 'The default path for your features', :aliases => '-f'
77
+ option :helper,
78
+ :type => :boolean, :required => false, :desc => 'The default path for your helpers', :aliases => '-h'
79
+ option :spec,
80
+ :type => :boolean, :required => false, :desc => 'The default path for your specs', :aliases => '-s'
29
81
  def path(default_path)
30
- Utilities.new.path = default_path
82
+ type = options.empty? ? 'page' : options.keys.first
83
+ Utilities.new.send("#{type}_path=", default_path)
31
84
  end
32
85
 
33
86
  desc "url [URL]", "Sets the default url for a project"
87
+
34
88
  def url(default_url)
35
89
  Utilities.new.url = default_url
36
90
  end
37
91
 
38
92
  desc "browser [BROWSER]", "Sets the default browser for a project"
93
+
39
94
  def browser(default_browser)
40
95
  Utilities.new.browser = default_browser
41
96
  end
42
97
 
43
98
  desc "raid", "It runs all the tests in a project"
99
+
44
100
  def raid
45
101
  Utilities.new.run
46
102
  end
47
103
 
48
104
  no_commands do
49
- def load_config_path
50
- YAML.load_file('config/config.yml')['path']
105
+ def load_config_path(type)
106
+ YAML.load_file('config/config.yml')["#{type}_path"] unless YAML.load_file('config/config.yml').nil?
51
107
  end
52
108
  end
53
- end
109
+ end
@@ -11,18 +11,38 @@ class Scaffolding < Thor::Group
11
11
  end
12
12
 
13
13
  def generate_class
14
- template('page_object.tt', default_path("page_objects/pages/#{name}_page.rb") )
14
+ template('page_object.tt', default_path("page_objects/pages/#{name}_page.rb", '_page.rb'))
15
15
  end
16
16
 
17
17
  def generate_feature
18
- template('feature.tt', default_path("features/#{name}.feature"))
18
+ template('feature.tt', default_path("features/#{name}.feature", '.feature'))
19
19
  end
20
20
 
21
21
  def generate_spec
22
- template('spec.tt', default_path("./spec/#{name}_page.rb"))
22
+ template('spec.tt', default_path("spec/#{name}_spec.rb", '_spec.rb'))
23
23
  end
24
24
 
25
- def default_path(standard_path)
26
- path.nil? ? standard_path : "#{path}/#{name}"
25
+ def generate_helper
26
+ template('helper.tt', default_path("helpers/#{name}_helper.rb", '_helper.rb'))
27
+ end
28
+
29
+ def delete_class
30
+ remove_file(default_path("page_objects/pages/#{name}_page.rb", '_page.rb'))
31
+ end
32
+
33
+ def delete_feature
34
+ remove_file(default_path("features/#{name}.feature", '.feature'))
35
+ end
36
+
37
+ def delete_spec
38
+ remove_file(default_path("spec/#{name}_spec.rb", '_spec.rb'))
39
+ end
40
+
41
+ def delete_helper
42
+ remove_file(default_path("helpers/#{name}_helper.rb", '_helper.rb'))
43
+ end
44
+
45
+ def default_path(standard_path, file_type)
46
+ path.nil? ? standard_path : "#{path}/#{name}#{file_type}"
27
47
  end
28
48
  end
@@ -0,0 +1,3 @@
1
+ module <%= name.split('_').map {|word| word.capitalize }.join + 'Helper' %>
2
+ # Add your helper code here
3
+ end
@@ -4,7 +4,7 @@ require_relative '../abstract/abstract_page'
4
4
 
5
5
  class <%= name.split('_').map {|word| word.capitalize }.join + 'Page' %> < AbstractPage
6
6
 
7
- #Actions
7
+ # Actions
8
8
 
9
9
  private
10
10
 
@@ -1,7 +1,6 @@
1
1
  require 'yaml'
2
2
 
3
3
  class Utilities
4
-
5
4
  def initialize
6
5
  @path = 'config/config.yml'
7
6
  @config = YAML.load_file(@path)
@@ -12,8 +11,23 @@ class Utilities
12
11
  overwrite_yaml
13
12
  end
14
13
 
15
- def path=(path)
16
- @config['path'] = path
14
+ def page_path=(path)
15
+ @config['page_path'] = path
16
+ overwrite_yaml
17
+ end
18
+
19
+ def spec_path=(path)
20
+ @config['spec_path'] = path
21
+ overwrite_yaml
22
+ end
23
+
24
+ def feature_path=(path)
25
+ @config['feature_path'] = path
26
+ overwrite_yaml
27
+ end
28
+
29
+ def helper_path=(path)
30
+ @config['helper_path'] = path
17
31
  overwrite_yaml
18
32
  end
19
33
 
data/ruby_raider.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ruby_raider'
5
- s.version = '0.2.9'
5
+ s.version = '0.3.2'
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 = 'http://github.com/aguspe/ruby_raider'
10
+ s.homepage = 'https://github.com/RubyRaider/ruby_raider'
11
11
  s.files = %w[bin/* lib/* lib/**/*]
12
12
  s.license = 'MIT'
13
13
  s.required_ruby_version = '>= 3.0.0'
@@ -3,11 +3,11 @@
3
3
  require_relative '../lib/generators/automation_generator'
4
4
  require_relative 'spec_helper'
5
5
 
6
- describe RubyRaider::AutomationGenerator do
6
+ describe AutomationGenerator do
7
7
  context 'with selenium' do
8
8
  before(:all) do
9
9
  @name = 'rspec-selenium'
10
- RubyRaider::AutomationGenerator.new(['selenium', 'rspec', @name]).invoke_all
10
+ AutomationGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
11
  end
12
12
 
13
13
  it 'creates a login page file' do
@@ -34,7 +34,7 @@ describe RubyRaider::AutomationGenerator do
34
34
  context 'with watir' do
35
35
  before(:all) do
36
36
  @name = 'rspec-watir'
37
- RubyRaider::AutomationGenerator.new(['watir', 'rspec', @name]).invoke_all
37
+ AutomationGenerator.new(['watir', 'rspec', @name]).invoke_all
38
38
  end
39
39
 
40
40
  it 'creates a login page file' do
@@ -61,7 +61,7 @@ describe RubyRaider::AutomationGenerator do
61
61
  context 'with appium' do
62
62
  before(:all) do
63
63
  @name = 'rspec-appium'
64
- RubyRaider::AutomationGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
64
+ AutomationGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
65
65
  end
66
66
 
67
67
  it 'creates a login page file' do
@@ -99,7 +99,7 @@ describe RubyRaider::AutomationGenerator do
99
99
  context 'with cucumber and selenium' do
100
100
  before(:all) do
101
101
  @name = 'cucumber-selenium'
102
- RubyRaider::AutomationGenerator.new(['selenium', 'cucumber', @name]).invoke_all
102
+ AutomationGenerator.new(['selenium', 'cucumber', @name]).invoke_all
103
103
  end
104
104
 
105
105
  it 'creates a login page file' do
@@ -126,7 +126,7 @@ describe RubyRaider::AutomationGenerator do
126
126
  context 'with cucumber and watir' do
127
127
  before(:all) do
128
128
  @name = 'cucumber-watir'
129
- RubyRaider::AutomationGenerator.new(['watir', 'cucumber', @name]).invoke_all
129
+ AutomationGenerator.new(['watir', 'cucumber', @name]).invoke_all
130
130
  end
131
131
 
132
132
  it 'creates a login page file' do
@@ -153,7 +153,7 @@ describe RubyRaider::AutomationGenerator do
153
153
  context 'with cucumber and appium' do
154
154
  before(:all) do
155
155
  @name = 'cucumber-appium'
156
- RubyRaider::AutomationGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
156
+ AutomationGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
157
157
  end
158
158
 
159
159
  it 'creates a login page file' do
@@ -3,11 +3,11 @@
3
3
  require_relative '../lib/generators/common_generator'
4
4
  require_relative 'spec_helper'
5
5
 
6
- describe RubyRaider::CommonGenerator do
6
+ describe CommonGenerator do
7
7
  context 'with selenium' do
8
8
  before(:all) do
9
9
  @name = 'rspec-selenium'
10
- RubyRaider::CommonGenerator.new(['selenium', 'rspec', @name]).invoke_all
10
+ CommonGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
11
  end
12
12
 
13
13
  it 'creates a config file' do
@@ -34,7 +34,7 @@ describe RubyRaider::CommonGenerator do
34
34
  context 'with watir' do
35
35
  before(:all) do
36
36
  @name = 'rspec-watir'
37
- RubyRaider::CommonGenerator.new(['watir', 'rspec', @name]).invoke_all
37
+ CommonGenerator.new(['watir', 'rspec', @name]).invoke_all
38
38
  end
39
39
 
40
40
  it 'creates a config file' do
@@ -61,7 +61,7 @@ describe RubyRaider::CommonGenerator do
61
61
  context 'with appium' do
62
62
  before(:all) do
63
63
  @name = 'rspec-appium'
64
- RubyRaider::CommonGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
64
+ CommonGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
65
65
  end
66
66
 
67
67
  it 'creates a config file' do
@@ -87,7 +87,7 @@ describe RubyRaider::CommonGenerator do
87
87
  context 'with cucumber and selenium' do
88
88
  before(:all) do
89
89
  @name = 'cucumber-selenium'
90
- RubyRaider::CommonGenerator.new(['selenium', 'cucumber', @name]).invoke_all
90
+ CommonGenerator.new(['selenium', 'cucumber', @name]).invoke_all
91
91
  end
92
92
 
93
93
  it 'creates a config file' do
@@ -114,7 +114,7 @@ describe RubyRaider::CommonGenerator do
114
114
  context 'with cucumber and watir' do
115
115
  before(:all) do
116
116
  @name = 'cucumber-watir'
117
- RubyRaider::CommonGenerator.new(['watir', 'cucumber', @name]).invoke_all
117
+ CommonGenerator.new(['watir', 'cucumber', @name]).invoke_all
118
118
  end
119
119
 
120
120
  it 'creates a config file' do
@@ -3,11 +3,11 @@
3
3
  require_relative '../lib/generators/cucumber_generator'
4
4
  require_relative 'spec_helper'
5
5
 
6
- describe RubyRaider::CucumberGenerator do
6
+ describe CucumberGenerator do
7
7
  context 'with selenium' do
8
8
  before(:all) do
9
9
  @name = 'cucumber-selenium'
10
- RubyRaider::CucumberGenerator.new(['selenium', 'cucumber', @name]).invoke_all
10
+ CucumberGenerator.new(['selenium', 'cucumber', @name]).invoke_all
11
11
  end
12
12
 
13
13
  it 'creates a feature file' do
@@ -34,7 +34,7 @@ describe RubyRaider::CucumberGenerator do
34
34
  context 'with watir' do
35
35
  before(:all) do
36
36
  @name = 'cucumber-watir'
37
- RubyRaider::CucumberGenerator.new(['watir', 'cucumber', @name]).invoke_all
37
+ CucumberGenerator.new(['watir', 'cucumber', @name]).invoke_all
38
38
  end
39
39
 
40
40
  it 'creates a feature file' do
@@ -57,7 +57,7 @@ describe RubyRaider::CucumberGenerator do
57
57
  context 'with appium' do
58
58
  before(:all) do
59
59
  @name = 'cucumber-appium'
60
- RubyRaider::CucumberGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
60
+ CucumberGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
61
61
  end
62
62
 
63
63
  it 'creates a feature file' do
@@ -3,11 +3,11 @@
3
3
  require_relative '../lib/generators/helper_generator'
4
4
  require_relative 'spec_helper'
5
5
 
6
- describe RubyRaider::HelpersGenerator do
6
+ describe HelpersGenerator do
7
7
  context 'with selenium' do
8
8
  before(:all) do
9
9
  @name = 'rspec-selenium'
10
- RubyRaider::HelpersGenerator.new(['selenium', 'rspec', @name]).invoke_all
10
+ HelpersGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
11
  end
12
12
 
13
13
  it 'creates a raider file' do
@@ -34,7 +34,7 @@ describe RubyRaider::HelpersGenerator do
34
34
  context 'with watir' do
35
35
  before(:all) do
36
36
  @name = 'rspec-watir'
37
- RubyRaider::HelpersGenerator.new(['watir', 'rspec', @name]).invoke_all
37
+ HelpersGenerator.new(['watir', 'rspec', @name]).invoke_all
38
38
  end
39
39
 
40
40
  it 'creates a browser helper file', :watir do
@@ -57,7 +57,7 @@ describe RubyRaider::HelpersGenerator do
57
57
  context 'with appium' do
58
58
  before(:all) do
59
59
  @name = 'rspec-appium'
60
- RubyRaider::HelpersGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
60
+ HelpersGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
61
61
  end
62
62
 
63
63
  it 'creates a raider file' do
@@ -79,7 +79,7 @@ describe RubyRaider::HelpersGenerator do
79
79
  context 'with cucumber and selenium' do
80
80
  before(:all) do
81
81
  @name = 'cucumber-selenium'
82
- RubyRaider::HelpersGenerator.new(['selenium', 'cucumber', @name]).invoke_all
82
+ HelpersGenerator.new(['selenium', 'cucumber', @name]).invoke_all
83
83
  end
84
84
 
85
85
  it 'creates an allure helper file' do
@@ -102,7 +102,7 @@ describe RubyRaider::HelpersGenerator do
102
102
  context 'with cucumber and watir' do
103
103
  before(:all) do
104
104
  @name = 'cucumber-watir'
105
- RubyRaider::HelpersGenerator.new(['watir', 'cucumber', @name]).invoke_all
105
+ HelpersGenerator.new(['watir', 'cucumber', @name]).invoke_all
106
106
  end
107
107
 
108
108
  it 'creates a browser helper file', :watir do
@@ -3,11 +3,11 @@
3
3
  require_relative '../lib/generators/rspec_generator'
4
4
  require_relative 'spec_helper'
5
5
 
6
- describe RubyRaider::RspecGenerator do
6
+ describe RspecGenerator do
7
7
  context 'with selenium' do
8
8
  before(:all) do
9
9
  @name = 'rspec-selenium'
10
- RubyRaider::RspecGenerator.new(['selenium', 'rspec', @name]).invoke_all
10
+ RspecGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
11
  end
12
12
 
13
13
  it 'creates a spec file' do
@@ -26,7 +26,7 @@ describe RubyRaider::RspecGenerator do
26
26
  context 'with watir' do
27
27
  before(:all) do
28
28
  @name = 'rspec-watir'
29
- RubyRaider::RspecGenerator.new(['watir', 'rspec', @name]).invoke_all
29
+ RspecGenerator.new(['watir', 'rspec', @name]).invoke_all
30
30
  end
31
31
 
32
32
  it 'creates a spec file' do
@@ -45,7 +45,7 @@ describe RubyRaider::RspecGenerator do
45
45
  context 'with appium' do
46
46
  before(:all) do
47
47
  @name = 'rspec-appium'
48
- RubyRaider::RspecGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
48
+ RspecGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
49
49
  end
50
50
 
51
51
  it 'creates a spec file' do
@@ -0,0 +1,181 @@
1
+ require 'pathname'
2
+ require 'yaml'
3
+ require_relative 'spec_helper'
4
+ require_relative '../lib/ruby_raider'
5
+ require_relative '../lib/generators/common_generator'
6
+
7
+ describe RubyRaider do
8
+ let(:raider) { RubyRaider }
9
+ let(:name) {'test'}
10
+
11
+ context 'with path from config file' do
12
+ before(:all) do
13
+ CommonGenerator.new(%w[rspec cucumber test]).invoke(:generate_config_file)
14
+ FileUtils.cp_lr('test/config', './')
15
+ end
16
+
17
+ it 'creates a page' do
18
+ raider.new.invoke(:page, nil, %W[#{name}])
19
+ expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
20
+ end
21
+
22
+ it 'creates a feature' do
23
+ raider.new.invoke(:feature, nil, %W[#{name}])
24
+ expect(Pathname.new("features/#{name}.feature")).to be_file
25
+ end
26
+
27
+ it 'creates a spec' do
28
+ raider.new.invoke(:spec, nil, %W[#{name}])
29
+ expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
30
+ end
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
+
37
+ it 'deletes a page' do
38
+ raider.new.invoke(:page, nil, %W[#{name}])
39
+ raider.new.invoke(:page, nil, %W[#{name} --delete])
40
+ expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to_not be_file
41
+ end
42
+
43
+ it 'deletes a feature' do
44
+ raider.new.invoke(:feature, nil, %W[#{name}])
45
+ raider.new.invoke(:feature, nil, %W[#{name} --delete])
46
+ expect(Pathname.new("features/#{name}.feature")).to_not be_file
47
+ end
48
+
49
+ it 'deletes a spec' do
50
+ raider.new.invoke(:spec, nil, %W[#{name}])
51
+ raider.new.invoke(:spec, nil, %W[#{name} --delete])
52
+ expect(Pathname.new("spec/#{name}_spec.rb")).to_not be_file
53
+ end
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
+
61
+ after(:all) do
62
+ folders = %w[test config page_objects features helpers]
63
+ folders.each do |folder|
64
+ FileUtils.rm_rf(folder)
65
+ end
66
+ FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
67
+ end
68
+ end
69
+
70
+ context 'with path option' do
71
+ let(:path) { 'test_folder' }
72
+
73
+ it 'creates a page' do
74
+ raider.new.invoke(:page, nil, %W[#{name} --path #{path}])
75
+ expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
76
+ end
77
+
78
+ it 'creates a feature' do
79
+ raider.new.invoke(:feature, nil, %W[#{name} --path #{path}])
80
+ expect(Pathname.new("#{path}/#{name}.feature")).to be_file
81
+ end
82
+
83
+ it 'creates a spec' do
84
+ raider.new.invoke(:spec, nil, %W[#{name} --path #{path}])
85
+ expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
86
+ end
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
+
93
+ after(:each) do
94
+ FileUtils.rm_rf(path)
95
+ end
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 cucumber 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
+ 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.9
4
+ version: 0.3.2
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-26 00:00:00.000000000 Z
11
+ date: 2022-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -115,10 +115,15 @@ executables:
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
119
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
118
120
  - ".gitignore"
119
121
  - ".reek.yml"
120
122
  - ".rubocop.yml"
123
+ - CODE_OF_CONDUCT.md
124
+ - CONTRIBUTING.md
121
125
  - Gemfile
126
+ - LICENSE
122
127
  - README.md
123
128
  - Rakefile
124
129
  - bin/raider
@@ -175,6 +180,7 @@ files:
175
180
  - lib/ruby_raider.rb
176
181
  - lib/scaffolding/scaffolding.rb
177
182
  - lib/scaffolding/templates/feature.tt
183
+ - lib/scaffolding/templates/helper.tt
178
184
  - lib/scaffolding/templates/page_object.tt
179
185
  - lib/scaffolding/templates/spec.tt
180
186
  - lib/utilities/utilities.rb
@@ -184,8 +190,9 @@ files:
184
190
  - spec/cucumber_generator_spec.rb
185
191
  - spec/helpers_generator_spec.rb
186
192
  - spec/rspec_generator_spec.rb
193
+ - spec/ruby_raider_spec.rb
187
194
  - spec/spec_helper.rb
188
- homepage: http://github.com/aguspe/ruby_raider
195
+ homepage: https://github.com/RubyRaider/ruby_raider
189
196
  licenses:
190
197
  - MIT
191
198
  metadata: {}