ruby_raider 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -6
- data/lib/commands/scaffolding_commands.rb +2 -2
- data/lib/generators/menu_generator.rb +8 -4
- data/ruby_raider.gemspec +2 -1
- data/spec/automation_generator_spec.rb +28 -149
- data/spec/common_generator_spec.rb +27 -112
- data/spec/cucumber_generator_spec.rb +15 -54
- data/spec/helpers_generator_spec.rb +57 -94
- data/spec/rspec_generator_spec.rb +12 -62
- data/spec/scaffolding_commands_spec.rb +162 -0
- data/spec/spec_helper.rb +20 -0
- metadata +17 -3
- data/spec/scaffolding_spec.rb +0 -234
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a92cf556575579c0fd4b96bde582b6f19d0715224467dae8276a7b5a367d611
|
4
|
+
data.tar.gz: c4327f646e1f7dc87657da33e7cf2a075103fe605a953cb9e0a2c4f0a8bef24f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2a91f76d5f338b7cd2e79ae0c3af2012a4ff4a46802c3f90b8d1e79724c30fb9127790a89ceac5592ac74e039863993f62c7205e732fa714b3a3ae4309c4e3
|
7
|
+
data.tar.gz: d61169f5255b2f0e12a9cd62cb312c81dabc696ad9285d0863c62d46cdaaa4e9cea152e68985ff063450fc0c9c5d55cf752f5d06ae4cf245647c0ce924906ec9
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
require:
|
2
|
-
|
3
|
-
AllCops:
|
4
|
-
Exclude:
|
5
|
-
- './spec/*'
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
6
3
|
|
7
4
|
# Layout
|
8
5
|
Layout/CaseIndentation:
|
@@ -86,7 +83,7 @@ Style/HashTransformValues:
|
|
86
83
|
|
87
84
|
Style/SafeNavigation:
|
88
85
|
Description: "Use &. instead of checking if an object exists"
|
89
|
-
Enabled:
|
86
|
+
Enabled: true
|
90
87
|
|
91
88
|
Style/SingleLineBlockParams:
|
92
89
|
Description: 'Enforces the names of some block params.'
|
@@ -86,7 +86,7 @@ class ScaffoldingCommands < UtilityCommands
|
|
86
86
|
def scaffold(name)
|
87
87
|
if Pathname.new('spec').exist? && !Pathname.new('features').exist?
|
88
88
|
Scaffolding.new([name, load_config_path('spec')]).generate_spec
|
89
|
-
|
89
|
+
else
|
90
90
|
Scaffolding.new([name, load_config_path('feature')]).generate_feature
|
91
91
|
end
|
92
92
|
Scaffolding.new([name, load_config_path('page')]).generate_class
|
@@ -110,7 +110,7 @@ class ScaffoldingCommands < UtilityCommands
|
|
110
110
|
|
111
111
|
no_commands do
|
112
112
|
def load_config_path(type)
|
113
|
-
YAML.load_file('config/config.yml')["#{type}_path"] if
|
113
|
+
YAML.load_file('config/config.yml')["#{type}_path"] if Pathname.new('config/config.yml').exist?
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -31,9 +31,8 @@ class MenuGenerator
|
|
31
31
|
select_test_framework(automation)
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
36
|
-
generators.each { |generator| invoke_generator(automation, framework, generator) }
|
34
|
+
def set_up_framework(automation, framework)
|
35
|
+
generate_framework(automation, framework)
|
37
36
|
system "cd #{name} && gem install bundler && bundle install"
|
38
37
|
end
|
39
38
|
|
@@ -46,6 +45,11 @@ class MenuGenerator
|
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
48
|
+
def generate_framework(automation, framework)
|
49
|
+
add_generator framework.capitalize
|
50
|
+
generators.each { |generator| invoke_generator(automation, framework, generator) }
|
51
|
+
end
|
52
|
+
|
49
53
|
protected
|
50
54
|
|
51
55
|
def add_generator(*opts)
|
@@ -55,7 +59,7 @@ class MenuGenerator
|
|
55
59
|
private
|
56
60
|
|
57
61
|
def framework_choice(framework, automation_type)
|
58
|
-
|
62
|
+
set_up_framework(automation_type, framework.downcase)
|
59
63
|
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
60
64
|
end
|
61
65
|
|
data/ruby_raider.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ruby_raider'
|
5
|
-
s.version = '0.4.
|
5
|
+
s.version = '0.4.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']
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_development_dependency 'reek', '~> 6.1.0'
|
18
18
|
s.add_development_dependency 'rspec', '~> 3.11.0'
|
19
19
|
s.add_development_dependency 'rubocop', '~> 1.27'
|
20
|
+
s.add_development_dependency 'rubocop-performance', '~> 1.15.0'
|
20
21
|
s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
|
21
22
|
|
22
23
|
s.add_runtime_dependency 'thor', '~> 1.2.1'
|
@@ -4,192 +4,71 @@ require_relative '../lib/generators/automation_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe AutomationGenerator do
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
@name = 'rspec-selenium'
|
10
|
-
AutomationGenerator.new(['selenium', 'rspec', @name]).invoke_all
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'creates a login page file' do
|
14
|
-
expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'creates an abstract page file' do
|
18
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'creates an abstract component file' do
|
22
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'creates a component file' do
|
26
|
-
expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
|
27
|
-
end
|
28
|
-
|
29
|
-
after(:all) do
|
30
|
-
FileUtils.rm_rf(@name)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with watir' do
|
35
|
-
before(:all) do
|
36
|
-
@name = 'rspec-watir'
|
37
|
-
AutomationGenerator.new(['watir', 'rspec', @name]).invoke_all
|
38
|
-
end
|
39
|
-
|
7
|
+
shared_examples 'creates web automation files' do |name|
|
40
8
|
it 'creates a login page file' do
|
41
|
-
expect(File.exist
|
9
|
+
expect(File).to exist("#{name}/page_objects/pages/login_page.rb")
|
42
10
|
end
|
43
11
|
|
44
12
|
it 'creates an abstract page file' do
|
45
|
-
expect(File.exist
|
13
|
+
expect(File).to exist("#{name}/page_objects/abstract/abstract_page.rb")
|
46
14
|
end
|
47
15
|
|
48
16
|
it 'creates an abstract component file' do
|
49
|
-
expect(File.exist
|
17
|
+
expect(File).to exist("#{name}/page_objects/abstract/abstract_component.rb")
|
50
18
|
end
|
51
19
|
|
52
20
|
it 'creates a component file' do
|
53
|
-
expect(File.exist
|
54
|
-
end
|
55
|
-
|
56
|
-
after(:all) do
|
57
|
-
FileUtils.rm_rf(@name)
|
21
|
+
expect(File).to exist("#{name}/page_objects/components/header_component.rb")
|
58
22
|
end
|
59
23
|
end
|
60
24
|
|
61
|
-
|
62
|
-
before(:all) do
|
63
|
-
@name = 'rspec-appium-ios'
|
64
|
-
AutomationGenerator.new(['ios', 'rspec', @name]).invoke_all
|
65
|
-
end
|
66
|
-
|
25
|
+
shared_examples 'creates mobile automation files' do |name|
|
67
26
|
it 'creates a home page file' do
|
68
|
-
expect(File.exist
|
27
|
+
expect(File).to exist("#{name}/page_objects/pages/home_page.rb")
|
69
28
|
end
|
70
29
|
|
71
30
|
it 'creates an abstract page file' do
|
72
|
-
expect(File.exist
|
31
|
+
expect(File).to exist("#{name}/page_objects/abstract/abstract_page.rb")
|
73
32
|
end
|
74
33
|
|
75
34
|
it 'creates a pdp page file' do
|
76
|
-
expect(File.exist
|
35
|
+
expect(File).to exist("#{name}/page_objects/pages/pdp_page.rb")
|
77
36
|
end
|
78
37
|
|
79
38
|
it 'creates an appium config file' do
|
80
|
-
expect(File.exist
|
81
|
-
end
|
82
|
-
|
83
|
-
after(:all) do
|
84
|
-
FileUtils.rm_rf(@name)
|
39
|
+
expect(File).to exist("#{name}/appium.txt")
|
85
40
|
end
|
86
41
|
end
|
87
42
|
|
88
|
-
context 'with rspec and
|
89
|
-
|
90
|
-
|
91
|
-
AutomationGenerator.new(['android', 'rspec', @name]).invoke_all
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'creates a home page file' do
|
95
|
-
expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'creates an abstract page file' do
|
99
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'creates a pdp page file' do
|
103
|
-
expect(File.exist?("#{@name}/page_objects/pages/pdp_page.rb")).to be_truthy
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'creates an appium config file' do
|
107
|
-
expect(File.exist?("#{@name}/appium.txt")).to be_truthy
|
108
|
-
end
|
43
|
+
context 'with rspec and selenium' do
|
44
|
+
include_examples 'creates web automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
45
|
+
end
|
109
46
|
|
110
|
-
|
111
|
-
|
112
|
-
end
|
47
|
+
context 'with rspec and watir' do
|
48
|
+
include_examples 'creates web automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
113
49
|
end
|
114
50
|
|
115
51
|
context 'with cucumber and selenium' do
|
116
|
-
|
117
|
-
@name = 'cucumber-selenium'
|
118
|
-
AutomationGenerator.new(['selenium', 'cucumber', @name]).invoke_all
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'creates a login page file' do
|
122
|
-
expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'creates an abstract page file' do
|
126
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'creates an abstract component file' do
|
130
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'creates a component file' do
|
134
|
-
expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
|
135
|
-
end
|
136
|
-
|
137
|
-
after(:all) do
|
138
|
-
FileUtils.rm_rf(@name)
|
139
|
-
end
|
52
|
+
include_examples 'creates web automation files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
140
53
|
end
|
141
54
|
|
142
55
|
context 'with cucumber and watir' do
|
143
|
-
|
144
|
-
@name = 'cucumber-watir'
|
145
|
-
AutomationGenerator.new(['watir', 'cucumber', @name]).invoke_all
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'creates a login page file' do
|
149
|
-
expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'creates an abstract page file' do
|
153
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'creates an abstract component file' do
|
157
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'creates a component file' do
|
161
|
-
expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
|
162
|
-
end
|
163
|
-
|
164
|
-
after(:all) do
|
165
|
-
FileUtils.rm_rf(@name)
|
166
|
-
end
|
56
|
+
include_examples 'creates web automation files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
167
57
|
end
|
168
58
|
|
169
|
-
context 'with
|
170
|
-
|
171
|
-
|
172
|
-
AutomationGenerator.new(['ios', 'cucumber', @name]).invoke_all
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'creates a home page file' do
|
176
|
-
expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'creates an abstract page file' do
|
180
|
-
expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
|
181
|
-
end
|
59
|
+
context 'with rspec and appium android' do
|
60
|
+
include_examples 'creates mobile automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
|
61
|
+
end
|
182
62
|
|
183
|
-
|
184
|
-
|
185
|
-
|
63
|
+
context 'with rspec and appium ios' do
|
64
|
+
include_examples 'creates mobile automation files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
|
65
|
+
end
|
186
66
|
|
187
|
-
|
188
|
-
|
189
|
-
|
67
|
+
context 'with cucumber and appium android' do
|
68
|
+
include_examples 'creates mobile automation files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
|
69
|
+
end
|
190
70
|
|
191
|
-
|
192
|
-
|
193
|
-
end
|
71
|
+
context 'with cucumber and appium ios' do
|
72
|
+
include_examples 'creates mobile automation files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
|
194
73
|
end
|
195
74
|
end
|
@@ -4,138 +4,53 @@ require_relative '../lib/generators/common_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe CommonGenerator do
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
@name = 'rspec-selenium'
|
10
|
-
CommonGenerator.new(['selenium', 'rspec', @name]).invoke_all
|
11
|
-
end
|
12
|
-
|
7
|
+
shared_examples 'creates common files' do |name|
|
13
8
|
it 'creates a config file' do
|
14
|
-
expect(File.exist
|
9
|
+
expect(File).to exist("#{name}/config/config.yml")
|
15
10
|
end
|
16
11
|
|
17
12
|
it 'creates a rake file' do
|
18
|
-
expect(File.exist
|
13
|
+
expect(File).to exist("#{name}/Rakefile")
|
19
14
|
end
|
20
15
|
|
21
16
|
it 'creates a readMe file' do
|
22
|
-
expect(File.exist
|
17
|
+
expect(File).to exist("#{name}/Readme.md")
|
23
18
|
end
|
24
19
|
|
25
20
|
it 'creates a gemfile file' do
|
26
|
-
expect(File.exist
|
27
|
-
end
|
28
|
-
|
29
|
-
after(:all) do
|
30
|
-
FileUtils.rm_rf(@name)
|
21
|
+
expect(File).to exist("#{name}/Gemfile")
|
31
22
|
end
|
32
23
|
end
|
33
24
|
|
34
|
-
context 'with
|
35
|
-
|
36
|
-
@name = 'rspec-watir'
|
37
|
-
CommonGenerator.new(['watir', 'rspec', @name]).invoke_all
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'creates a config file' do
|
41
|
-
expect(File.exist?("#{@name}/config/config.yml")).to be_truthy
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'creates a rake file' do
|
45
|
-
expect(File.exist?("#{@name}/Rakefile")).to be_truthy
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'creates a readMe file' do
|
49
|
-
expect(File.exist?("#{@name}/Readme.md")).to be_truthy
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'creates a gemfile file' do
|
53
|
-
expect(File.exist?("#{@name}/Gemfile")).to be_truthy
|
54
|
-
end
|
55
|
-
|
56
|
-
after(:all) do
|
57
|
-
FileUtils.rm_rf(@name)
|
58
|
-
end
|
25
|
+
context 'with rspec and selenium' do
|
26
|
+
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
59
27
|
end
|
60
28
|
|
61
|
-
context 'with
|
62
|
-
|
63
|
-
|
64
|
-
CommonGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'creates a config file' do
|
68
|
-
expect(File.exist?("#{@name}/config/config.yml")).to be_truthy
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'creates a rake file' do
|
72
|
-
expect(File.exist?("#{@name}/Rakefile")).to be_truthy
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'creates a readMe file' do
|
76
|
-
expect(File.exist?("#{@name}/Readme.md")).to be_truthy
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'creates a gemfile file' do
|
80
|
-
expect(File.exist?("#{@name}/Gemfile")).to be_truthy
|
81
|
-
end
|
82
|
-
|
83
|
-
after(:all) do
|
84
|
-
FileUtils.rm_rf(@name)
|
85
|
-
end
|
86
|
-
|
87
|
-
context 'with cucumber and selenium' do
|
88
|
-
before(:all) do
|
89
|
-
@name = 'cucumber-selenium'
|
90
|
-
CommonGenerator.new(['selenium', 'cucumber', @name]).invoke_all
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'creates a config file' do
|
94
|
-
expect(File.exist?("#{@name}/config/config.yml")).to be_truthy
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'creates a rake file' do
|
98
|
-
expect(File.exist?("#{@name}/Rakefile")).to be_truthy
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'creates a readMe file' do
|
102
|
-
expect(File.exist?("#{@name}/Readme.md")).to be_truthy
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'creates a gemfile file' do
|
106
|
-
expect(File.exist?("#{@name}/Gemfile")).to be_truthy
|
107
|
-
end
|
108
|
-
|
109
|
-
after(:all) do
|
110
|
-
FileUtils.rm_rf(@name)
|
111
|
-
end
|
112
|
-
end
|
29
|
+
context 'with rspec and watir' do
|
30
|
+
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
31
|
+
end
|
113
32
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
CommonGenerator.new(['watir', 'cucumber', @name]).invoke_all
|
118
|
-
end
|
33
|
+
context 'with cucumber and selenium' do
|
34
|
+
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
35
|
+
end
|
119
36
|
|
120
|
-
|
121
|
-
|
122
|
-
|
37
|
+
context 'with cucumber and watir' do
|
38
|
+
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
39
|
+
end
|
123
40
|
|
124
|
-
|
125
|
-
|
126
|
-
|
41
|
+
context 'with rspec and appium android' do
|
42
|
+
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
|
43
|
+
end
|
127
44
|
|
128
|
-
|
129
|
-
|
130
|
-
|
45
|
+
context 'with rspec and appium ios' do
|
46
|
+
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
|
47
|
+
end
|
131
48
|
|
132
|
-
|
133
|
-
|
134
|
-
|
49
|
+
context 'with cucumber and appium android' do
|
50
|
+
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
|
51
|
+
end
|
135
52
|
|
136
|
-
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
53
|
+
context 'with cucumber and appium ios' do
|
54
|
+
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
|
140
55
|
end
|
141
56
|
end
|
@@ -4,76 +4,37 @@ require_relative '../lib/generators/cucumber_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe CucumberGenerator do
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
@name = 'cucumber-selenium'
|
10
|
-
CucumberGenerator.new(['selenium', 'cucumber', @name]).invoke_all
|
11
|
-
end
|
12
|
-
|
7
|
+
shared_examples 'creates cucumber files' do |project_name, file_name|
|
13
8
|
it 'creates a feature file' do
|
14
|
-
expect(File.exist
|
9
|
+
expect(File).to exist("#{project_name}/features/#{file_name}.feature")
|
15
10
|
end
|
16
11
|
|
17
12
|
it 'creates a step definitions file' do
|
18
|
-
expect(File.exist
|
13
|
+
expect(File).to exist("#{project_name}/features/step_definitions/#{file_name}_steps.rb")
|
19
14
|
end
|
20
15
|
|
21
16
|
it 'creates an env file' do
|
22
|
-
expect(File.exist
|
17
|
+
expect(File).to exist("#{project_name}/features/support/env.rb")
|
23
18
|
end
|
24
19
|
|
25
20
|
it 'does not create a spec file' do
|
26
|
-
expect(File.exist
|
27
|
-
end
|
28
|
-
|
29
|
-
after(:all) do
|
30
|
-
FileUtils.rm_rf(@name)
|
21
|
+
expect(File).not_to exist("#{project_name}/spec/home_spec.rb")
|
31
22
|
end
|
32
23
|
end
|
33
24
|
|
34
|
-
context 'with
|
35
|
-
|
36
|
-
@name = 'cucumber-watir'
|
37
|
-
CucumberGenerator.new(['watir', 'cucumber', @name]).invoke_all
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'creates a feature file' do
|
41
|
-
expect(File.exist?("#{@name}/features/login.feature")).to be_truthy
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'creates a step definitions file' do
|
45
|
-
expect(File.exist?("#{@name}/features/step_definitions/login_steps.rb")).to be_truthy
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'creates an env file' do
|
49
|
-
expect(File.exist?("#{@name}/features/support/env.rb")).to be_truthy
|
50
|
-
end
|
51
|
-
|
52
|
-
after(:all) do
|
53
|
-
FileUtils.rm_rf(@name)
|
54
|
-
end
|
25
|
+
context 'with cucumber and appium android' do
|
26
|
+
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}", 'home'
|
55
27
|
end
|
56
28
|
|
57
|
-
context 'with appium' do
|
58
|
-
|
59
|
-
|
60
|
-
CucumberGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'creates a feature file' do
|
64
|
-
expect(File.exist?("#{@name}/features/login.feature")).to be_truthy
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'creates a step definitions file' do
|
68
|
-
expect(File.exist?("#{@name}/features/step_definitions/login_steps.rb")).to be_truthy
|
69
|
-
end
|
29
|
+
context 'with cucumber and appium ios' do
|
30
|
+
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}", 'home'
|
31
|
+
end
|
70
32
|
|
71
|
-
|
72
|
-
|
73
|
-
|
33
|
+
context 'with cucumber and selenium' do
|
34
|
+
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}", 'login'
|
35
|
+
end
|
74
36
|
|
75
|
-
|
76
|
-
|
77
|
-
end
|
37
|
+
context 'with cucumber and watir' do
|
38
|
+
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}", 'login'
|
78
39
|
end
|
79
40
|
end
|
@@ -4,122 +4,85 @@ require_relative '../lib/generators/helper_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe HelpersGenerator do
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
@name = 'rspec-selenium'
|
10
|
-
HelpersGenerator.new(['selenium', 'rspec', @name]).invoke_all
|
11
|
-
end
|
12
|
-
|
7
|
+
shared_examples 'creates common helpers' do |name|
|
13
8
|
it 'creates a raider file' do
|
14
|
-
expect(File.exist
|
9
|
+
expect(File).to exist("#{name}/helpers/raider.rb")
|
15
10
|
end
|
16
11
|
|
17
12
|
it 'creates an allure helper file' do
|
18
|
-
expect(File.exist
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'creates a driver helper file', :watir do
|
22
|
-
expect(File.exist?("#{@name}/helpers/driver_helper.rb")).to be_truthy
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'creates a spec helper file' do
|
26
|
-
expect(File.exist?("#{@name}/helpers/spec_helper.rb")).to be_truthy
|
27
|
-
end
|
28
|
-
|
29
|
-
after(:all) do
|
30
|
-
FileUtils.rm_rf(@name)
|
13
|
+
expect(File).to exist("#{name}/helpers/allure_helper.rb")
|
31
14
|
end
|
32
15
|
end
|
33
16
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
HelpersGenerator.new(['watir', 'rspec', @name]).invoke_all
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'creates a browser helper file', :watir do
|
41
|
-
expect(File.exist?("#{@name}/helpers/browser_helper.rb")).to be_truthy
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'creates a raider file' do
|
45
|
-
expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'creates an allure helper file' do
|
49
|
-
expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
|
50
|
-
end
|
51
|
-
|
52
|
-
after(:all) do
|
53
|
-
FileUtils.rm_rf(@name)
|
17
|
+
shared_examples 'creates selenium helpers' do |name|
|
18
|
+
it 'creates a driver helper file' do
|
19
|
+
expect(File).to exist("#{name}/helpers/driver_helper.rb")
|
54
20
|
end
|
55
21
|
end
|
56
22
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
HelpersGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'creates a raider file' do
|
64
|
-
expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'creates an allure helper file' do
|
68
|
-
expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
|
23
|
+
shared_examples 'creates watir helpers' do |name|
|
24
|
+
it 'creates a browser helper file' do
|
25
|
+
expect(File).to exist("#{name}/helpers/browser_helper.rb")
|
69
26
|
end
|
27
|
+
end
|
70
28
|
|
71
|
-
|
72
|
-
|
29
|
+
shared_examples 'creates rspec helpers' do |name|
|
30
|
+
it 'creates a spec helper file' do
|
31
|
+
expect(File).to exist("#{name}/helpers/spec_helper.rb")
|
73
32
|
end
|
33
|
+
end
|
74
34
|
|
75
|
-
|
76
|
-
|
35
|
+
shared_examples 'creates cucumber helpers' do |name|
|
36
|
+
it 'does not create a spec helper' do
|
37
|
+
expect(File).not_to exist("#{name}/helpers/spec_helper.rb")
|
77
38
|
end
|
39
|
+
end
|
78
40
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
it 'creates an allure helper file' do
|
86
|
-
expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'creates a driver helper file', :watir do
|
90
|
-
expect(File.exist?("#{@name}/helpers/driver_helper.rb")).to be_truthy
|
91
|
-
end
|
41
|
+
context 'with rspec and selenium' do
|
42
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
43
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
44
|
+
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
45
|
+
end
|
92
46
|
|
93
|
-
|
94
|
-
|
95
|
-
|
47
|
+
context 'with rspec and watir' do
|
48
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
49
|
+
include_examples 'creates watir helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
50
|
+
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
51
|
+
end
|
96
52
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
53
|
+
context 'with cucumber and selenium' do
|
54
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
55
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
56
|
+
include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
57
|
+
end
|
101
58
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
59
|
+
context 'with cucumber and watir' do
|
60
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
61
|
+
include_examples 'creates watir helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
62
|
+
include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
63
|
+
end
|
107
64
|
|
108
|
-
|
109
|
-
|
110
|
-
|
65
|
+
context 'with rspec and appium android' do
|
66
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
|
67
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
|
68
|
+
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
|
69
|
+
end
|
111
70
|
|
112
|
-
|
113
|
-
|
114
|
-
|
71
|
+
context 'with rspec and appium ios' do
|
72
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
|
73
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
|
74
|
+
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
|
75
|
+
end
|
115
76
|
|
116
|
-
|
117
|
-
|
118
|
-
|
77
|
+
context 'with cucumber and appium android' do
|
78
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
|
79
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
|
80
|
+
include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
|
81
|
+
end
|
119
82
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
83
|
+
context 'with cucumber and appium ios' do
|
84
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
|
85
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
|
86
|
+
include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
|
124
87
|
end
|
125
88
|
end
|
@@ -4,79 +4,29 @@ require_relative '../lib/generators/rspec_generator'
|
|
4
4
|
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
describe RspecGenerator do
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
@name = 'rspec-selenium'
|
10
|
-
RspecGenerator.new(['selenium', 'rspec', @name]).invoke_all
|
11
|
-
end
|
12
|
-
|
7
|
+
shared_examples 'creates rspec files' do |project_name, file_name|
|
13
8
|
it 'creates a spec file' do
|
14
|
-
expect(File.exist
|
9
|
+
expect(File).to exist("#{project_name}/spec/#{file_name}_page_spec.rb")
|
15
10
|
end
|
16
11
|
|
17
12
|
it 'creates the base spec file' do
|
18
|
-
expect(File.exist
|
19
|
-
end
|
20
|
-
|
21
|
-
after(:all) do
|
22
|
-
FileUtils.rm_rf(@name)
|
13
|
+
expect(File).to exist("#{project_name}/spec/base_spec.rb")
|
23
14
|
end
|
24
15
|
end
|
25
16
|
|
26
|
-
context 'with
|
27
|
-
|
28
|
-
@name = 'rspec-watir'
|
29
|
-
RspecGenerator.new(['watir', 'rspec', @name]).invoke_all
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'creates a spec file' do
|
33
|
-
expect(File.exist?("#{@name}/spec/login_page_spec.rb")).to be_truthy
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'creates the base spec file' do
|
37
|
-
expect(File.exist?("#{@name}/spec/base_spec.rb")).to be_truthy
|
38
|
-
end
|
39
|
-
|
40
|
-
after(:all) do
|
41
|
-
FileUtils.rm_rf(@name)
|
42
|
-
end
|
17
|
+
context 'with rspec and selenium' do
|
18
|
+
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}", 'login'
|
43
19
|
end
|
44
20
|
|
45
|
-
context 'with
|
46
|
-
|
47
|
-
@name = 'rspec-appium'
|
48
|
-
RspecGenerator.new(['ios', 'rspec', @name]).invoke_all
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'creates a spec file' do
|
52
|
-
expect(File.exist?("#{@name}/spec/pdp_page_spec.rb")).to be_truthy
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'creates the base spec file' do
|
56
|
-
expect(File.exist?("#{@name}/spec/base_spec.rb")).to be_truthy
|
57
|
-
end
|
58
|
-
|
59
|
-
after(:all) do
|
60
|
-
FileUtils.rm_rf(@name)
|
61
|
-
end
|
21
|
+
context 'with rspec and watir' do
|
22
|
+
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}", 'login'
|
62
23
|
end
|
63
24
|
|
64
|
-
context 'with
|
65
|
-
|
66
|
-
|
67
|
-
RspecGenerator.new(['android', 'rspec', @name]).invoke_all
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'creates a spec file' do
|
71
|
-
expect(File.exist?("#{@name}/spec/pdp_page_spec.rb")).to be_truthy
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'creates the base spec file' do
|
75
|
-
expect(File.exist?("#{@name}/spec/base_spec.rb")).to be_truthy
|
76
|
-
end
|
25
|
+
context 'with rspec and appium android' do
|
26
|
+
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}", 'pdp'
|
27
|
+
end
|
77
28
|
|
78
|
-
|
79
|
-
|
80
|
-
end
|
29
|
+
context 'with rspec and appium ios' do
|
30
|
+
include_examples 'creates rspec files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}", 'pdp'
|
81
31
|
end
|
82
32
|
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../lib/generators/common_generator'
|
4
|
+
require_relative '../lib/commands/scaffolding_commands'
|
5
|
+
require_relative '../lib/scaffolding/scaffolding'
|
6
|
+
require_relative 'spec_helper'
|
7
|
+
|
8
|
+
describe ScaffoldingCommands do
|
9
|
+
let(:scaffold) { described_class }
|
10
|
+
let(:name) { 'test' }
|
11
|
+
|
12
|
+
orig_dir = Dir.pwd
|
13
|
+
|
14
|
+
after do
|
15
|
+
Dir.chdir orig_dir
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'with a spec folder' do
|
19
|
+
let(:new_path) { 'test_folder' }
|
20
|
+
|
21
|
+
path = "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
22
|
+
|
23
|
+
before do
|
24
|
+
Dir.chdir path
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'scaffolds for rspec creating a spec' do
|
28
|
+
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
29
|
+
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'scaffolds for rspec creating a page' do
|
33
|
+
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
34
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'deletes a spec' do
|
38
|
+
scaffold.new.invoke(:spec, nil, %w[login --delete])
|
39
|
+
expect(Pathname.new('spec/login_spec.rb')).not_to be_file
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'deletes a helper' do
|
43
|
+
scaffold.new.invoke(:helper, nil, %w[driver --delete])
|
44
|
+
expect(Pathname.new('helpers/driver_helper.rb')).not_to be_file
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'creates a page' do
|
48
|
+
scaffold.new.invoke(:page, nil, %W[#{name}])
|
49
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'changes the path for specs' do
|
53
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -s])
|
54
|
+
config = YAML.load_file('config/config.yml')
|
55
|
+
expect(config['spec_path']).to eql path
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'updates the url' do
|
59
|
+
scaffold.new.invoke(:url, nil, %w[test.com])
|
60
|
+
config = YAML.load_file('config/config.yml')
|
61
|
+
expect(config['url']).to eql 'test.com'
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'updates the browser' do
|
65
|
+
scaffold.new.invoke(:browser, nil, %w[:firefox])
|
66
|
+
config = YAML.load_file('config/config.yml')
|
67
|
+
expect(config['browser']).to eql ':firefox'
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'updates the browser options' do
|
71
|
+
scaffold.new.invoke(:browser, nil, %w[:firefox --opts headless start-maximized start-fullscreen])
|
72
|
+
config = YAML.load_file('config/config.yml')
|
73
|
+
expect(config['browser_options']).to eql %w[headless start-maximized start-fullscreen]
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'creates a page with a path' do
|
77
|
+
scaffold.new.invoke(:page, nil, %W[#{name} --path #{new_path}])
|
78
|
+
expect(Pathname.new("#{new_path}/#{name}_page.rb")).to be_file
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'creates a spec' do
|
82
|
+
scaffold.new.invoke(:spec, nil, %W[#{name} --path #{new_path}])
|
83
|
+
expect(Pathname.new("#{new_path}/#{name}_spec.rb")).to be_file
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'with a features folder' do
|
88
|
+
let(:new_path) { 'test_folder' }
|
89
|
+
|
90
|
+
path = "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
91
|
+
|
92
|
+
before do
|
93
|
+
Dir.chdir path
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'scaffolds for cucumber creating a feature' do
|
97
|
+
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
98
|
+
expect(Pathname.new("features/#{name}.feature")).to be_file
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'scaffolds for cucumber creating a page' do
|
102
|
+
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
103
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'creates a helper' do
|
107
|
+
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
108
|
+
expect(Pathname.new("helpers/#{name}_helper.rb")).to be_file
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'deletes a page' do
|
112
|
+
scaffold.new.invoke(:page, nil, %w[login --delete])
|
113
|
+
expect(Pathname.new('page_objects/pages/login_page.rb')).not_to be_file
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'deletes a feature' do
|
117
|
+
scaffold.new.invoke(:feature, nil, %w[login --delete])
|
118
|
+
expect(Pathname.new('features/login.feature')).not_to be_file
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'changes the path for pages' do
|
122
|
+
scaffold.new.invoke(:path, nil, %W[#{path}])
|
123
|
+
config = YAML.load_file('config/config.yml')
|
124
|
+
expect(config['page_path']).to eql path
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'changes the path for features' do
|
128
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -f])
|
129
|
+
config = YAML.load_file('config/config.yml')
|
130
|
+
expect(config['feature_path']).to eql path
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'updates only the browser options' do
|
134
|
+
scaffold.new.invoke(:browser, nil, %w[:firefox --opts headless])
|
135
|
+
config = YAML.load_file('config/config.yml')
|
136
|
+
expect(config['browser_options']).to eql %w[headless]
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'deletes the browser options when passed with the delete parameter' do
|
140
|
+
scaffold.new.invoke(:browser, nil, %w[:firefox --opts headless --delete])
|
141
|
+
config = YAML.load_file('config/config.yml')
|
142
|
+
expect(config['browser_options']).to be_nil
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'deletes the browser options' do
|
146
|
+
scaffold.new.invoke(:browser, nil, %w[:firefox --opts headless])
|
147
|
+
scaffold.new.invoke(:browser, nil, %w[--delete])
|
148
|
+
config = YAML.load_file('config/config.yml')
|
149
|
+
expect(config['browser_options']).to be_nil
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'creates a feature' do
|
153
|
+
scaffold.new.invoke(:feature, nil, %W[#{name} --path #{new_path}])
|
154
|
+
expect(Pathname.new("#{new_path}/#{name}.feature")).to be_file
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'creates a helper with a path' do
|
158
|
+
scaffold.new.invoke(:helper, nil, %W[#{name} --path #{new_path}])
|
159
|
+
expect(Pathname.new("#{new_path}/#{name}_helper.rb")).to be_file
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,3 +2,23 @@
|
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'rspec'
|
5
|
+
require_relative '../lib/generators/menu_generator'
|
6
|
+
|
7
|
+
AUTOMATION_TYPES = %w[android ios selenium watir].freeze
|
8
|
+
FRAMEWORKS = %w[cucumber rspec].freeze
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.before(:all) do
|
12
|
+
FRAMEWORKS.each do |framework|
|
13
|
+
AUTOMATION_TYPES.each do |automation|
|
14
|
+
MenuGenerator.new("#{framework}_#{automation}").generate_framework(automation, framework)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
config.after(:all) do
|
20
|
+
FRAMEWORKS.each do |framework|
|
21
|
+
AUTOMATION_TYPES.each { |automation| FileUtils.rm_rf("#{framework}_#{automation}") }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
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.4.
|
4
|
+
version: 0.4.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-10-
|
11
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.27'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-performance
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.15.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.15.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop-rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,7 +213,7 @@ files:
|
|
199
213
|
- spec/cucumber_generator_spec.rb
|
200
214
|
- spec/helpers_generator_spec.rb
|
201
215
|
- spec/rspec_generator_spec.rb
|
202
|
-
- spec/
|
216
|
+
- spec/scaffolding_commands_spec.rb
|
203
217
|
- spec/spec_helper.rb
|
204
218
|
homepage: https://github.com/RubyRaider/ruby_raider
|
205
219
|
licenses:
|
data/spec/scaffolding_spec.rb
DELETED
@@ -1,234 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'yaml'
|
3
|
-
require_relative '../lib/generators/common_generator'
|
4
|
-
require_relative '../lib/commands/scaffolding_commands'
|
5
|
-
require_relative 'spec_helper'
|
6
|
-
|
7
|
-
describe ScaffoldingCommands do
|
8
|
-
let(:scaffold) { ScaffoldingCommands }
|
9
|
-
let(:name) { 'test' }
|
10
|
-
|
11
|
-
context 'with a spec folder' do
|
12
|
-
before(:all) do
|
13
|
-
ScaffoldingCommands.new.invoke(:config)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'scaffolds for rspec' do
|
17
|
-
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
18
|
-
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
19
|
-
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'with a features folder' do
|
24
|
-
it 'scaffolds for cucumber' do
|
25
|
-
FileUtils.mkdir 'features'
|
26
|
-
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
27
|
-
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
28
|
-
expect(Pathname.new("features/#{name}.feature")).to be_file
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
after(:all) do
|
33
|
-
folders = %w[test config page_objects features]
|
34
|
-
folders.each do |folder|
|
35
|
-
FileUtils.rm_rf(folder)
|
36
|
-
end
|
37
|
-
FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'with path from config file' do
|
41
|
-
before(:all) do
|
42
|
-
ScaffoldingCommands.new.invoke(:config)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'creates a page' do
|
46
|
-
scaffold.new.invoke(:page, nil, %W[#{name}])
|
47
|
-
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'creates a feature' do
|
51
|
-
scaffold.new.invoke(:feature, nil, %W[#{name}])
|
52
|
-
expect(Pathname.new("features/#{name}.feature")).to be_file
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'creates a spec' do
|
56
|
-
scaffold.new.invoke(:spec, nil, %W[#{name}])
|
57
|
-
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'creates a helper' do
|
61
|
-
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
62
|
-
expect(Pathname.new("helpers/#{name}_helper.rb")).to be_file
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'deletes a page' do
|
66
|
-
scaffold.new.invoke(:page, nil, %W[#{name}])
|
67
|
-
scaffold.new.invoke(:page, nil, %W[#{name} --delete])
|
68
|
-
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to_not be_file
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'deletes a feature' do
|
72
|
-
scaffold.new.invoke(:feature, nil, %W[#{name}])
|
73
|
-
scaffold.new.invoke(:feature, nil, %W[#{name} --delete])
|
74
|
-
expect(Pathname.new("features/#{name}.feature")).to_not be_file
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'deletes a spec' do
|
78
|
-
scaffold.new.invoke(:spec, nil, %W[#{name}])
|
79
|
-
scaffold.new.invoke(:spec, nil, %W[#{name} --delete])
|
80
|
-
expect(Pathname.new("spec/#{name}_spec.rb")).to_not be_file
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'deletes a helper' do
|
84
|
-
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
85
|
-
scaffold.new.invoke(:helper, nil, %W[#{name} --delete])
|
86
|
-
expect(Pathname.new("helpers/#{name}_helper.rb")).to_not be_file
|
87
|
-
end
|
88
|
-
|
89
|
-
after(:all) do
|
90
|
-
folders = %w[test config page_objects features helpers]
|
91
|
-
folders.each do |folder|
|
92
|
-
FileUtils.rm_rf(folder)
|
93
|
-
end
|
94
|
-
FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context 'with path option' do
|
99
|
-
let(:path) { 'test_folder' }
|
100
|
-
|
101
|
-
it 'creates a page' do
|
102
|
-
scaffold.new.invoke(:page, nil, %W[#{name} --path #{path}])
|
103
|
-
expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'creates a feature' do
|
107
|
-
scaffold.new.invoke(:feature, nil, %W[#{name} --path #{path}])
|
108
|
-
expect(Pathname.new("#{path}/#{name}.feature")).to be_file
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'creates a spec' do
|
112
|
-
scaffold.new.invoke(:spec, nil, %W[#{name} --path #{path}])
|
113
|
-
expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'creates a helper' do
|
117
|
-
scaffold.new.invoke(:helper, nil, %W[#{name} --path #{path}])
|
118
|
-
expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
|
119
|
-
end
|
120
|
-
|
121
|
-
after(:each) do
|
122
|
-
FileUtils.rm_rf(path)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context 'changes the default path' do
|
127
|
-
let(:path) { 'test_folder' }
|
128
|
-
|
129
|
-
before(:all) do
|
130
|
-
ScaffoldingCommands.new.invoke(:config)
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'changes the path for pages' do
|
134
|
-
scaffold.new.invoke(:path, nil, %W[#{path}])
|
135
|
-
config = YAML.load_file('config/config.yml')
|
136
|
-
expect(config['page_path']).to eql path
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'changes the path for features' do
|
140
|
-
scaffold.new.invoke(:path, nil, %W[#{path} -f])
|
141
|
-
config = YAML.load_file('config/config.yml')
|
142
|
-
expect(config['feature_path']).to eql path
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'changes the path for specs' do
|
146
|
-
scaffold.new.invoke(:path, nil, %W[#{path} -s])
|
147
|
-
config = YAML.load_file('config/config.yml')
|
148
|
-
expect(config['spec_path']).to eql path
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'creates page' do
|
152
|
-
scaffold.new.invoke(:path, nil, %W[#{path}])
|
153
|
-
scaffold.new.invoke(:page, nil, %W[#{name}])
|
154
|
-
expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'creates feature' do
|
158
|
-
scaffold.new.invoke(:path, nil, %W[#{path} -f])
|
159
|
-
scaffold.new.invoke(:feature, nil, %W[#{name}])
|
160
|
-
expect(Pathname.new("#{path}/#{name}.feature")).to be_file
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'creates spec' do
|
164
|
-
scaffold.new.invoke(:path, nil, %W[#{path} -s])
|
165
|
-
scaffold.new.invoke(:spec, nil, %W[#{name}])
|
166
|
-
expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'creates spec' do
|
170
|
-
scaffold.new.invoke(:path, nil, %W[#{path} -h])
|
171
|
-
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
172
|
-
expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
|
173
|
-
end
|
174
|
-
|
175
|
-
after(:all) do
|
176
|
-
folders = %w[test_folder test config]
|
177
|
-
folders.each do |folder|
|
178
|
-
FileUtils.rm_rf(folder)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
context 'updates the config file' do
|
184
|
-
before(:all) do
|
185
|
-
CommonGenerator.new(%w[rspec selenium test]).invoke(:generate_config_file)
|
186
|
-
FileUtils.cp_lr('test/config', './')
|
187
|
-
end
|
188
|
-
|
189
|
-
it 'updates the url' do
|
190
|
-
scaffold.new.invoke(:url, nil, %W[test.com])
|
191
|
-
config = YAML.load_file('config/config.yml')
|
192
|
-
expect(config['url']).to eql 'test.com'
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'updates the browser' do
|
196
|
-
scaffold.new.invoke(:browser, nil, %W[:firefox])
|
197
|
-
config = YAML.load_file('config/config.yml')
|
198
|
-
expect(config['browser']).to eql ':firefox'
|
199
|
-
end
|
200
|
-
|
201
|
-
it 'updates the browser and the browser options' do
|
202
|
-
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless start-maximized start-fullscreen])
|
203
|
-
config = YAML.load_file('config/config.yml')
|
204
|
-
expect(config['browser']).to eql ':firefox'
|
205
|
-
expect(config['browser_options']).to eql %W[headless start-maximized start-fullscreen]
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'updates only the browser options' do
|
209
|
-
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless])
|
210
|
-
config = YAML.load_file('config/config.yml')
|
211
|
-
expect(config['browser_options']).to eql %w[headless]
|
212
|
-
end
|
213
|
-
|
214
|
-
it 'deletes the browser options when passed with the delete parameter' do
|
215
|
-
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless --delete])
|
216
|
-
config = YAML.load_file('config/config.yml')
|
217
|
-
expect(config['browser_options']).to be_nil
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'deletes the browser options' do
|
221
|
-
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless])
|
222
|
-
scaffold.new.invoke(:browser, nil, %W[--delete])
|
223
|
-
config = YAML.load_file('config/config.yml')
|
224
|
-
expect(config['browser_options']).to be_nil
|
225
|
-
end
|
226
|
-
|
227
|
-
after(:all) do
|
228
|
-
folders = %w[test config]
|
229
|
-
folders.each do |folder|
|
230
|
-
FileUtils.rm_rf(folder)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|