ruby_raider 0.3.0 → 0.3.1

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: 83e7e23f59e2e6864f53d64723ce6c381b48790be638f1a6a68a443066ec79b0
4
- data.tar.gz: 11e974c23bbea75f85cae9eeab28629e10bf29f2bf41666caf05e5f11131faa0
3
+ metadata.gz: 151af21fd6a33598fc5fef983b3d8277817e438445f8576d6f6135ce13d7cc4b
4
+ data.tar.gz: 0665e396c6246632ab922e62fac8dd3ef66701815b95bb8cdc03fa215b7a57b6
5
5
  SHA512:
6
- metadata.gz: e73135a4d13b39478976fd99beb0dfe42da3038518e7616b21f6aba3449bb82994770fa90df827ab30ae1febfd0eb5b38b22aa492efdebc6ebf1cbbf6d541925
7
- data.tar.gz: 69d1474035d9ac00aaae5bf940fc97856958a583b34514f088fbe0922144f1b9ded788ee9cf504d6c620345758676d1f49d01491fb647841b1b7cec5b9cbdbab
6
+ metadata.gz: 613640d0d946f4337bec680bdac7c86e4ae6f00534b7286d6e35a59788197b4f37dd110a4ee3990247e8b2dffee2f7eafc6d92de1b9a6f3216ae88343cd0cc43
7
+ data.tar.gz: 3391b2d3debb45de3d923954f64d8c866fb813f276312128c81a4fde78964a56084142ca6266399277b9c4280296da36f495ff3c9e754a4ef90fb16659fd3736
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,36 @@ 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 new [PROJECT_NAME] # Creates a new framework based on settings picked
35
+
36
+ raider page [PAGE_NAME] # Creates a new page object
37
+
38
+ raider path [PATH] # Sets the default path for scaffolding
39
+
40
+ raider raid # It runs all the tests in a project
41
+
42
+ raider spec [SPEC_NAME] # Creates a new spec
43
+
44
+ raider url [URL] # Sets the default url for a project
45
+ ```
46
+
47
+ It's possible to add the option --path or -p if you want to specify where to create your features, pages and specs.
48
+ And also it's possible to delete them using --delete or -d.
49
+
50
+ If you want to set the default path for the creation of your features, specs or pages you can do:
51
+
52
+ ```
53
+ raider path [PATH_NAME] --feature or -f
54
+ raider path [PATH_NAME] --spec or -s
55
+ ```
56
+
57
+ If you don't specify an option path will assume you want to change the default path for pages
@@ -1,97 +1,56 @@
1
- What is Raider?
2
- ===========
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 releases in : https://ruby-raider.com/
3
4
 
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
5
+ Just do:
5
6
 
6
- # Pre-requisites:
7
+ **gem install ruby_raider**
7
8
 
8
- Install RVM:
9
- https://rvm.io/rvm/install
9
+ then do:
10
10
 
11
- # How to use the framework:
11
+ **raider new [name_of_project]**
12
12
 
13
- If you want to run all the tests from your terminal do:
14
- *rspec spec/*
13
+ and you will have a new project in the folder you are in
15
14
 
16
- If you want to run all the tests in parallel do:
17
- *parallel_rspec spec/*
15
+ Currently we only support:
18
16
 
19
- # How are specs organized:
17
+ * Gerating a Selenium with both Cucumber and Rspec framework
18
+ * Gerating a Watir with both Cucumber and Rspec framework
19
+ * Generating an Appium project with Rspec and Cucumber on IOS
20
20
 
21
- We use 'context' as the highest grouping level to indicate in which part of the application we are as an example:
21
+ In order to run the appium tests, download the example [app](https://github.com/cloudgrey-io/the-app/releases/tag/v1.10.0)
22
22
 
23
- *context 'On the login page'/*
23
+ This works in all the platforms (Tested on Mac OS, Linux and Windows)
24
24
 
25
- We use 'describe' from the user perspective to describe an action that the user can or cannot take:
26
-
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
25
+ **Ruby raider provides the following list of commands**
53
26
  ```
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'
27
+ raider browser [BROWSER] # Sets the default browser for a project
55
28
 
56
- # How pages are organized:
29
+ raider feature [FEATURE_NAME] # Creates a new feature
57
30
 
58
- ```ruby#{' '}
59
- require_relative '../abstract/base_page'
31
+ raider help [COMMAND] # Describe available commands or one specific command
60
32
 
61
- class MainPage < BasePage
33
+ raider new [PROJECT_NAME] # Creates a new framework based on settings picked
62
34
 
63
- using Raider::WatirHelper
35
+ raider page [PAGE_NAME] # Creates a new page object
64
36
 
65
- def url(_page)
66
- '/'
67
- end
37
+ raider path [PATH] # Sets the default path for scaffolding
68
38
 
69
- # Actions
39
+ raider raid # It runs all the tests in a project
70
40
 
71
- def change_currency(currency)
72
- currency_dropdown.select currency
73
- end
41
+ raider spec [SPEC_NAME] # Creates a new spec
74
42
 
75
- # Validations
76
-
77
- def validate_currency(currency)
78
- expect(currency_dropdown.include?(currency)).to be true
79
- end
43
+ raider url [URL] # Sets the default url for a project
44
+ ```
80
45
 
81
- private
46
+ It's possible to add the option --path or -p if you want to specify where to create your features, pages and specs.
47
+ And also it's possible to delete them using --delete or -d.
82
48
 
83
- # Elements
49
+ If you want to set the default path for the creation of your features, specs or pages you can do:
84
50
 
85
- def currency_dropdown
86
- browser.select(class: %w[dropdown-menu currency])
87
- end
88
- end
51
+ ```
52
+ raider path [PATH_NAME] --feature or -f
53
+ raider path [PATH_NAME] --spec or -s
89
54
  ```
90
55
 
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)
56
+ 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
@@ -18,7 +18,7 @@ class RubyRaider < Thor
18
18
  :type => :boolean, :required => false, :desc => 'This will delete the selected page', :aliases => '-d'
19
19
 
20
20
  def page(name)
21
- path = options[:path].nil? ? load_config_path : options[:path]
21
+ path = options[:path].nil? ? load_config_path('page') : options[:path]
22
22
  if options[:delete]
23
23
  Scaffolding.new([name, path]).delete_class
24
24
  else
@@ -33,7 +33,7 @@ class RubyRaider < Thor
33
33
  :type => :boolean, :required => false, :desc => 'This will delete the selected feature', :aliases => '-d'
34
34
 
35
35
  def feature(name)
36
- path = options[:path].nil? ? load_config_path : options[:path]
36
+ path = options[:path].nil? ? load_config_path('feature') : options[:path]
37
37
  if options[:delete]
38
38
  Scaffolding.new([name, path]).delete_feature
39
39
  else
@@ -48,7 +48,7 @@ class RubyRaider < Thor
48
48
  :type => :boolean, :required => false, :desc => 'This will delete the selected spec', :aliases => '-d'
49
49
 
50
50
  def spec(name)
51
- path = options[:path].nil? ? load_config_path : options[:path]
51
+ path = options[:path].nil? ? load_config_path('spec') : options[:path]
52
52
  if options[:delete]
53
53
  Scaffolding.new([name, path]).delete_spec
54
54
  else
@@ -57,9 +57,13 @@ class RubyRaider < Thor
57
57
  end
58
58
 
59
59
  desc "path [PATH]", "Sets the default path for scaffolding"
60
-
60
+ option :feature,
61
+ :type => :boolean, :required => false, :desc => 'The default path for your features', :aliases => '-f'
62
+ option :spec,
63
+ :type => :boolean, :required => false, :desc => 'The default path for your specs', :aliases => '-s'
61
64
  def path(default_path)
62
- Utilities.new.path = default_path
65
+ type = options.empty? ? 'page' : options.keys.first
66
+ Utilities.new.send("#{type}_path=", default_path)
63
67
  end
64
68
 
65
69
  desc "url [URL]", "Sets the default url for a project"
@@ -81,8 +85,8 @@ class RubyRaider < Thor
81
85
  end
82
86
 
83
87
  no_commands do
84
- def load_config_path
85
- YAML.load_file('config/config.yml')['path'] unless YAML.load_file('config/config.yml').nil?
88
+ def load_config_path(type)
89
+ YAML.load_file('config/config.yml')["#{type}_path"] unless YAML.load_file('config/config.yml').nil?
86
90
  end
87
91
  end
88
92
  end
@@ -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,18 @@ 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
17
26
  overwrite_yaml
18
27
  end
19
28
 
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.3.0'
5
+ s.version = '0.3.1'
6
6
  s.summary = 'A gem to make setup and start of UI automation projects easier'
7
7
  s.description = 'This gem has everything you need to start working with test automation'
8
8
  s.authors = ['Agustin Pequeno']
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'
@@ -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'
@@ -77,4 +78,82 @@ describe RubyRaider do
77
78
  FileUtils.rm_rf(path)
78
79
  end
79
80
  end
81
+
82
+ context 'changes the default path' do
83
+ let(:path) { 'test_folder' }
84
+
85
+ before(:all) do
86
+ CommonGenerator.new(%w[rspec cucumber test]).invoke(:generate_config_file)
87
+ FileUtils.cp_lr('test/config', './')
88
+ end
89
+
90
+ it 'changes the path for pages' do
91
+ raider.new.invoke(:path, nil, %W[#{path}])
92
+ config = YAML.load_file('config/config.yml')
93
+ expect(config['page_path']).to eql path
94
+ end
95
+
96
+ it 'changes the path for features' do
97
+ raider.new.invoke(:path, nil, %W[#{path} -f])
98
+ config = YAML.load_file('config/config.yml')
99
+ expect(config['feature_path']).to eql path
100
+ end
101
+
102
+ it 'changes the path for specs' do
103
+ raider.new.invoke(:path, nil, %W[#{path} -s])
104
+ config = YAML.load_file('config/config.yml')
105
+ expect(config['spec_path']).to eql path
106
+ end
107
+
108
+ it 'creates page' do
109
+ raider.new.invoke(:path, nil, %W[#{path}])
110
+ raider.new.invoke(:page, nil, %W[#{name}])
111
+ expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
112
+ end
113
+
114
+ it 'creates feature' do
115
+ raider.new.invoke(:path, nil, %W[#{path} -f])
116
+ raider.new.invoke(:feature, nil, %W[#{name}])
117
+ expect(Pathname.new("#{path}/#{name}.feature")).to be_file
118
+ end
119
+
120
+ it 'creates feature' do
121
+ raider.new.invoke(:path, nil, %W[#{path} -s])
122
+ raider.new.invoke(:spec, nil, %W[#{name}])
123
+ expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
124
+ end
125
+
126
+ after(:all) do
127
+ folders = %w[test_folder test config]
128
+ folders.each do |folder|
129
+ FileUtils.rm_rf(folder)
130
+ end
131
+ end
132
+ end
133
+
134
+ context 'updates the config file' do
135
+ before(:all) do
136
+ CommonGenerator.new(%w[rspec cucumber test]).invoke(:generate_config_file)
137
+ FileUtils.cp_lr('test/config', './')
138
+ end
139
+
140
+ it 'updates the url' do
141
+ raider.new.invoke(:url, nil, %W[test.com])
142
+ config = YAML.load_file('config/config.yml')
143
+ expect(config['url']).to eql 'test.com'
144
+ end
145
+
146
+ it 'updates the browser' do
147
+ raider.new.invoke(:browser, nil, %W[:firefox])
148
+ config = YAML.load_file('config/config.yml')
149
+ expect(config['browser']).to eql ':firefox'
150
+ end
151
+
152
+ after(:all) do
153
+ folders = %w[test config]
154
+ folders.each do |folder|
155
+ FileUtils.rm_rf(folder)
156
+ end
157
+ end
158
+ end
80
159
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_raider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
@@ -191,7 +191,7 @@ files:
191
191
  - spec/rspec_generator_spec.rb
192
192
  - spec/ruby_raider_spec.rb
193
193
  - spec/spec_helper.rb
194
- homepage: http://github.com/aguspe/ruby_raider
194
+ homepage: https://github.com/RubyRaider/ruby_raider
195
195
  licenses:
196
196
  - MIT
197
197
  metadata: {}