ruby_raider 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.reek.yml +3 -0
  3. data/.rubocop.yml +6 -0
  4. data/Rakefile +2 -0
  5. data/bin/raider +1 -0
  6. data/lib/generators/automation_generator.rb +43 -0
  7. data/lib/generators/common_generator.rb +31 -0
  8. data/lib/generators/cucumber_generator.rb +19 -0
  9. data/lib/generators/generator.rb +16 -0
  10. data/lib/generators/helper_generator.rb +48 -0
  11. data/lib/generators/menu_generator.rb +27 -14
  12. data/lib/generators/rspec_generator.rb +16 -0
  13. data/lib/generators/templates/automation/abstract_component.tt +7 -0
  14. data/lib/generators/templates/automation/abstract_page.tt +10 -0
  15. data/lib/generators/templates/automation/appium_settings.tt +8 -0
  16. data/lib/generators/templates/automation/component.tt +9 -0
  17. data/lib/generators/templates/automation/confirmation_page.tt +19 -0
  18. data/lib/generators/templates/automation/home_page.tt +20 -0
  19. data/lib/generators/templates/automation/login_page.tt +8 -0
  20. data/lib/generators/templates/automation/partials/appium_login.tt +28 -0
  21. data/lib/generators/templates/automation/partials/driver_selector.tt +9 -0
  22. data/lib/generators/templates/automation/partials/element.tt +5 -0
  23. data/lib/generators/templates/automation/partials/require_raider.tt +5 -0
  24. data/lib/generators/templates/automation/partials/selenium_login.tt +40 -0
  25. data/lib/generators/templates/automation/partials/url_methods.tt +13 -0
  26. data/lib/generators/templates/automation/partials/visit_method.tt +9 -0
  27. data/lib/generators/templates/automation/partials/watir_login.tt +41 -0
  28. data/lib/generators/templates/common/config.tt +1 -0
  29. data/lib/generators/templates/common/gemfile.tt +21 -0
  30. data/lib/generators/templates/common/partials/automation_gems.tt +10 -0
  31. data/lib/generators/templates/common/rakefile.tt +10 -0
  32. data/lib/generators/templates/common/read_me.tt +99 -0
  33. data/lib/generators/templates/cucumber/env.tt +8 -0
  34. data/lib/generators/templates/cucumber/feature.tt +6 -0
  35. data/lib/generators/templates/cucumber/partials/appium_env.tt +13 -0
  36. data/lib/generators/templates/cucumber/partials/mobile_steps.tt +17 -0
  37. data/lib/generators/templates/cucumber/partials/selenium_appium_env.tt +13 -0
  38. data/lib/generators/templates/cucumber/partials/watir_env.tt +13 -0
  39. data/lib/generators/templates/cucumber/partials/web_steps.tt +15 -0
  40. data/lib/generators/templates/cucumber/steps.tt +5 -0
  41. data/lib/generators/templates/helpers/allure_helper.tt +32 -0
  42. data/lib/generators/templates/helpers/browser_helper.tt +19 -0
  43. data/lib/generators/templates/helpers/driver_helper.tt +18 -0
  44. data/lib/generators/templates/helpers/partials/allure_imports.tt +5 -0
  45. data/lib/generators/templates/helpers/partials/allure_requirements.tt +6 -0
  46. data/lib/generators/templates/helpers/partials/driver_requirements.tt +14 -0
  47. data/lib/generators/templates/helpers/partials/new_driver.tt +11 -0
  48. data/lib/generators/templates/helpers/partials/quit_driver.tt +8 -0
  49. data/lib/generators/templates/helpers/partials/require_automation.tt +5 -0
  50. data/lib/generators/templates/helpers/partials/screenshot.tt +8 -0
  51. data/lib/generators/templates/helpers/pom_helper.tt +19 -0
  52. data/lib/generators/templates/helpers/raider_helper.tt +15 -0
  53. data/lib/generators/templates/helpers/selenium_helper.tt +36 -0
  54. data/lib/generators/templates/helpers/spec_helper.tt +37 -0
  55. data/lib/generators/templates/helpers/watir_helper.tt +16 -0
  56. data/lib/generators/templates/rspec/base_spec.tt +5 -0
  57. data/lib/generators/templates/rspec/spec.tt +37 -0
  58. data/lib/ruby_raider.rb +5 -4
  59. data/ruby_raider.gemspec +7 -1
  60. data/spec/automation_generator_spec.rb +192 -0
  61. data/spec/common_generator_spec.rb +141 -0
  62. data/spec/cucumber_generator_spec.rb +71 -0
  63. data/spec/helpers_generator_spec.rb +133 -0
  64. data/spec/rspec_generator_spec.rb +63 -0
  65. data/spec/spec_helper.rb +3 -3
  66. metadata +116 -43
  67. data/lib/generators/files/automation_file_generator.rb +0 -61
  68. data/lib/generators/files/common_file_generator.rb +0 -38
  69. data/lib/generators/files/cucumber_file_generator.rb +0 -33
  70. data/lib/generators/files/file_generator.rb +0 -11
  71. data/lib/generators/files/helpers_file_generator.rb +0 -70
  72. data/lib/generators/files/rspec_file_generator.rb +0 -29
  73. data/lib/generators/projects/cucumber_project_generator.rb +0 -34
  74. data/lib/generators/projects/project_generator.rb +0 -27
  75. data/lib/generators/projects/rspec_project_generator.rb +0 -26
  76. data/lib/generators/templates/automation/abstract_component_template.rb +0 -22
  77. data/lib/generators/templates/automation/abstract_page_template.rb +0 -82
  78. data/lib/generators/templates/automation/appium_settings_template.rb +0 -16
  79. data/lib/generators/templates/automation/component_template.rb +0 -16
  80. data/lib/generators/templates/automation/confirmation_page_template.rb +0 -26
  81. data/lib/generators/templates/automation/home_page_template.rb +0 -26
  82. data/lib/generators/templates/automation/login_page_template.rb +0 -113
  83. data/lib/generators/templates/common/config_template.rb +0 -9
  84. data/lib/generators/templates/common/gemfile_template.rb +0 -52
  85. data/lib/generators/templates/common/rake_file_template.rb +0 -16
  86. data/lib/generators/templates/common/read_me_template.rb +0 -104
  87. data/lib/generators/templates/cucumber/env_template.rb +0 -38
  88. data/lib/generators/templates/cucumber/example_feature_template.rb +0 -15
  89. data/lib/generators/templates/cucumber/example_steps_template.rb +0 -21
  90. data/lib/generators/templates/helpers/allure_helper_template.rb +0 -47
  91. data/lib/generators/templates/helpers/browser_helper_template.rb +0 -26
  92. data/lib/generators/templates/helpers/driver_helper_template.rb +0 -54
  93. data/lib/generators/templates/helpers/pom_helper_template.rb +0 -25
  94. data/lib/generators/templates/helpers/raider_helper_template.rb +0 -27
  95. data/lib/generators/templates/helpers/selenium_helper_template.rb +0 -42
  96. data/lib/generators/templates/helpers/spec_helper_template.rb +0 -74
  97. data/lib/generators/templates/helpers/watir_helper_template.rb +0 -24
  98. data/lib/generators/templates/rspec/base_spec_template.rb +0 -13
  99. data/lib/generators/templates/rspec/example_spec_template.rb +0 -56
  100. data/lib/generators/templates/template.rb +0 -14
  101. data/spec/automation_file_generator_spec.rb +0 -59
  102. data/spec/common_file_generator_spec.rb +0 -27
  103. data/spec/cucumber_file_generator_spec.rb +0 -26
  104. data/spec/cucumber_project_generator_spec.rb +0 -60
  105. data/spec/helpers_file_generator_spec.rb +0 -73
  106. data/spec/rspec_file_generator_spec.rb +0 -21
  107. data/spec/rspec_project_generator_spec.rb +0 -69
@@ -0,0 +1,192 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/generators/automation_generator'
4
+ require_relative 'spec_helper'
5
+
6
+ describe RubyRaider::AutomationGenerator do
7
+ context 'with selenium' do
8
+ before(:all) do
9
+ @name = 'rspec-selenium'
10
+ RubyRaider::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
+ RubyRaider::AutomationGenerator.new(['watir', 'rspec', @name]).invoke_all
38
+ end
39
+
40
+ it 'creates a login page file' do
41
+ expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
42
+ end
43
+
44
+ it 'creates an abstract page file' do
45
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
46
+ end
47
+
48
+ it 'creates an abstract component file' do
49
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
50
+ end
51
+
52
+ it 'creates a component file' do
53
+ expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
54
+ end
55
+
56
+ after(:all) do
57
+ FileUtils.rm_rf(@name)
58
+ end
59
+ end
60
+
61
+ context 'with appium' do
62
+ before(:all) do
63
+ @name = 'rspec-appium'
64
+ RubyRaider::AutomationGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
65
+ end
66
+
67
+ it 'creates a login page file' do
68
+ expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
69
+ end
70
+
71
+ it 'creates an abstract page file' do
72
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
73
+ end
74
+
75
+ it "doesn't creates an abstract component file" do
76
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_falsey
77
+ end
78
+
79
+ it "doesn't creates a component file" do
80
+ expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_falsey
81
+ end
82
+
83
+ it 'creates a login page file' do
84
+ expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
85
+ end
86
+
87
+ it 'creates a confirmation page file' do
88
+ expect(File.exist?("#{@name}/page_objects/pages/confirmation_page.rb")).to be_truthy
89
+ end
90
+
91
+ it 'creates an appium config file' do
92
+ expect(File.exist?("#{@name}/appium.txt")).to be_truthy
93
+ end
94
+
95
+ after(:all) do
96
+ FileUtils.rm_rf(@name)
97
+ end
98
+
99
+ context 'with cucumber and selenium' do
100
+ before(:all) do
101
+ @name = 'cucumber-selenium'
102
+ RubyRaider::AutomationGenerator.new(['selenium', 'cucumber', @name]).invoke_all
103
+ end
104
+
105
+ it 'creates a login page file' do
106
+ expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
107
+ end
108
+
109
+ it 'creates an abstract page file' do
110
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
111
+ end
112
+
113
+ it 'creates an abstract component file' do
114
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
115
+ end
116
+
117
+ it 'creates a component file' do
118
+ expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
119
+ end
120
+
121
+ after(:all) do
122
+ FileUtils.rm_rf(@name)
123
+ end
124
+ end
125
+
126
+ context 'with cucumber and watir' do
127
+ before(:all) do
128
+ @name = 'cucumber-watir'
129
+ RubyRaider::AutomationGenerator.new(['watir', 'cucumber', @name]).invoke_all
130
+ end
131
+
132
+ it 'creates a login page file' do
133
+ expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
134
+ end
135
+
136
+ it 'creates an abstract page file' do
137
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
138
+ end
139
+
140
+ it 'creates an abstract component file' do
141
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_truthy
142
+ end
143
+
144
+ it 'creates a component file' do
145
+ expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_truthy
146
+ end
147
+
148
+ after(:all) do
149
+ FileUtils.rm_rf(@name)
150
+ end
151
+ end
152
+
153
+ context 'with cucumber and appium' do
154
+ before(:all) do
155
+ @name = 'cucumber-appium'
156
+ RubyRaider::AutomationGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
157
+ end
158
+
159
+ it 'creates a login page file' do
160
+ expect(File.exist?("#{@name}/page_objects/pages/login_page.rb")).to be_truthy
161
+ end
162
+
163
+ it 'creates an abstract page file' do
164
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_page.rb")).to be_truthy
165
+ end
166
+
167
+ it "doesn't creates an abstract component file" do
168
+ expect(File.exist?("#{@name}/page_objects/abstract/abstract_component.rb")).to be_falsey
169
+ end
170
+
171
+ it "doesn't creates a component file" do
172
+ expect(File.exist?("#{@name}/page_objects/components/header_component.rb")).to be_falsey
173
+ end
174
+
175
+ it 'creates a login page file' do
176
+ expect(File.exist?("#{@name}/page_objects/pages/home_page.rb")).to be_truthy
177
+ end
178
+
179
+ it 'creates a confirmation page file' do
180
+ expect(File.exist?("#{@name}/page_objects/pages/confirmation_page.rb")).to be_truthy
181
+ end
182
+
183
+ it 'creates an appium config file' do
184
+ expect(File.exist?("#{@name}/appium.txt")).to be_truthy
185
+ end
186
+
187
+ after(:all) do
188
+ FileUtils.rm_rf(@name)
189
+ end
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/generators/common_generator'
4
+ require_relative 'spec_helper'
5
+
6
+ describe RubyRaider::CommonGenerator do
7
+ context 'with selenium' do
8
+ before(:all) do
9
+ @name = 'rspec-selenium'
10
+ RubyRaider::CommonGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
+ end
12
+
13
+ it 'creates a config file' do
14
+ expect(File.exist?("#{@name}/config/config.yml")).to be_truthy
15
+ end
16
+
17
+ it 'creates a rake file' do
18
+ expect(File.exist?("#{@name}/Rakefile")).to be_truthy
19
+ end
20
+
21
+ it 'creates a readMe file' do
22
+ expect(File.exist?("#{@name}/Readme.md")).to be_truthy
23
+ end
24
+
25
+ it 'creates a gemfile file' do
26
+ expect(File.exist?("#{@name}/Gemfile")).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
+ RubyRaider::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
59
+ end
60
+
61
+ context 'with appium' do
62
+ before(:all) do
63
+ @name = 'rspec-appium'
64
+ RubyRaider::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
+ RubyRaider::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
113
+
114
+ context 'with cucumber and watir' do
115
+ before(:all) do
116
+ @name = 'cucumber-watir'
117
+ RubyRaider::CommonGenerator.new(['watir', 'cucumber', @name]).invoke_all
118
+ end
119
+
120
+ it 'creates a config file' do
121
+ expect(File.exist?("#{@name}/config/config.yml")).to be_truthy
122
+ end
123
+
124
+ it 'creates a rake file' do
125
+ expect(File.exist?("#{@name}/Rakefile")).to be_truthy
126
+ end
127
+
128
+ it 'creates a readMe file' do
129
+ expect(File.exist?("#{@name}/Readme.md")).to be_truthy
130
+ end
131
+
132
+ it 'creates a gemfile file' do
133
+ expect(File.exist?("#{@name}/Gemfile")).to be_truthy
134
+ end
135
+
136
+ after(:all) do
137
+ FileUtils.rm_rf(@name)
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/generators/cucumber_generator'
4
+ require_relative 'spec_helper'
5
+
6
+ describe RubyRaider::CucumberGenerator do
7
+ context 'with selenium' do
8
+ before(:all) do
9
+ @name = 'cucumber-selenium'
10
+ RubyRaider::CucumberGenerator.new(['selenium', 'cucumber', @name]).invoke_all
11
+ end
12
+
13
+ it 'creates a feature file' do
14
+ expect(File.exist?("#{@name}/features/login.feature")).to be_truthy
15
+ end
16
+
17
+ it 'creates a step definitions file' do
18
+ expect(File.exist?("#{@name}/features/step_definitions/login_steps.rb")).to be_truthy
19
+ end
20
+
21
+ it 'creates an env file' do
22
+ expect(File.exist?("#{@name}/features/support/env.rb")).to be_truthy
23
+ end
24
+
25
+ after(:all) do
26
+ FileUtils.rm_rf(@name)
27
+ end
28
+ end
29
+
30
+ context 'with watir' do
31
+ before(:all) do
32
+ @name = 'cucumber-watir'
33
+ RubyRaider::CucumberGenerator.new(['watir', 'cucumber', @name]).invoke_all
34
+ end
35
+
36
+ it 'creates a feature file' do
37
+ expect(File.exist?("#{@name}/features/login.feature")).to be_truthy
38
+ end
39
+
40
+ it 'creates a step definitions file' do
41
+ expect(File.exist?("#{@name}/features/step_definitions/login_steps.rb")).to be_truthy
42
+ end
43
+
44
+ it 'creates an env file' do
45
+ expect(File.exist?("#{@name}/features/support/env.rb")).to be_truthy
46
+ end
47
+ end
48
+
49
+ context 'with appium' do
50
+ before(:all) do
51
+ @name = 'cucumber-appium'
52
+ RubyRaider::CucumberGenerator.new(['appium_ios', 'cucumber', @name]).invoke_all
53
+ end
54
+
55
+ it 'creates a feature file' do
56
+ expect(File.exist?("#{@name}/features/login.feature")).to be_truthy
57
+ end
58
+
59
+ it 'creates a step definitions file' do
60
+ expect(File.exist?("#{@name}/features/step_definitions/login_steps.rb")).to be_truthy
61
+ end
62
+
63
+ it 'creates an env file' do
64
+ expect(File.exist?("#{@name}/features/support/env.rb")).to be_truthy
65
+ end
66
+
67
+ after(:all) do
68
+ FileUtils.rm_rf(@name)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/generators/helper_generator'
4
+ require_relative 'spec_helper'
5
+
6
+ describe RubyRaider::HelpersGenerator do
7
+ context 'with selenium' do
8
+ before(:all) do
9
+ @name = 'rspec-selenium'
10
+ RubyRaider::HelpersGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
+ end
12
+
13
+ it 'creates a raider file' do
14
+ expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
15
+ end
16
+
17
+ it 'creates a pom helper file' do
18
+ expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
19
+ end
20
+
21
+ it 'creates an allure helper file' do
22
+ expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
23
+ end
24
+
25
+ it 'creates a driver helper file', :watir do
26
+ expect(File.exist?("#{@name}/helpers/driver_helper.rb")).to be_truthy
27
+ end
28
+
29
+ it 'creates a spec helper file' do
30
+ expect(File.exist?("#{@name}/helpers/spec_helper.rb")).to be_truthy
31
+ end
32
+
33
+ after(:all) do
34
+ FileUtils.rm_rf(@name)
35
+ end
36
+ end
37
+
38
+ context 'with watir' do
39
+ before(:all) do
40
+ @name = 'rspec-watir'
41
+ RubyRaider::HelpersGenerator.new(['watir', 'rspec', @name]).invoke_all
42
+ end
43
+
44
+ it 'creates a browser helper file', :watir do
45
+ expect(File.exist?("#{@name}/helpers/browser_helper.rb")).to be_truthy
46
+ end
47
+
48
+ it 'creates a pom helper file' do
49
+ expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
50
+ end
51
+
52
+ it 'creates a raider file' do
53
+ expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
54
+ end
55
+
56
+ it 'creates an allure helper file' do
57
+ expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
58
+ end
59
+
60
+ after(:all) do
61
+ FileUtils.rm_rf(@name)
62
+ end
63
+ end
64
+
65
+ context 'with appium' do
66
+ before(:all) do
67
+ @name = 'rspec-appium'
68
+ RubyRaider::HelpersGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
69
+ end
70
+
71
+ it 'creates a raider file' do
72
+ expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
73
+ end
74
+
75
+ it 'creates a pom helper file' do
76
+ expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
77
+ end
78
+
79
+ it 'creates an allure helper file' do
80
+ expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
81
+ end
82
+
83
+ it 'creates a driver helper file', :watir do
84
+ expect(File.exist?("#{@name}/helpers/driver_helper.rb")).to be_truthy
85
+ end
86
+
87
+ after(:all) do
88
+ FileUtils.rm_rf(@name)
89
+ end
90
+
91
+ context 'with cucumber and selenium' do
92
+ before(:all) do
93
+ @name = 'cucumber-selenium'
94
+ RubyRaider::HelpersGenerator.new(['selenium', 'cucumber', @name]).invoke_all
95
+ end
96
+
97
+ it 'creates a pom helper file' do
98
+ expect(File.exist?("#{@name}/helpers/pom_helper.rb")).to be_truthy
99
+ end
100
+
101
+ it 'creates an allure helper file' do
102
+ expect(File.exist?("#{@name}/helpers/allure_helper.rb")).to be_truthy
103
+ end
104
+
105
+ it 'creates a driver helper file', :watir do
106
+ expect(File.exist?("#{@name}/helpers/driver_helper.rb")).to be_truthy
107
+ end
108
+
109
+ after(:all) do
110
+ FileUtils.rm_rf(@name)
111
+ end
112
+ end
113
+
114
+ context 'with cucumber and watir' do
115
+ before(:all) do
116
+ @name = 'cucumber-watir'
117
+ RubyRaider::HelpersGenerator.new(['watir', 'cucumber', @name]).invoke_all
118
+ end
119
+
120
+ it 'creates a browser helper file', :watir do
121
+ expect(File.exist?("#{@name}/helpers/browser_helper.rb")).to be_truthy
122
+ end
123
+
124
+ it 'creates a raider file' do
125
+ expect(File.exist?("#{@name}/helpers/raider.rb")).to be_truthy
126
+ end
127
+
128
+ after(:all) do
129
+ FileUtils.rm_rf(@name)
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/generators/rspec_generator'
4
+ require_relative 'spec_helper'
5
+
6
+ describe RubyRaider::RspecGenerator do
7
+ context 'with selenium' do
8
+ before(:all) do
9
+ @name = 'rspec-selenium'
10
+ RubyRaider::RspecGenerator.new(['selenium', 'rspec', @name]).invoke_all
11
+ end
12
+
13
+ it 'creates a spec file' do
14
+ expect(File.exist?("#{@name}/spec/login_page_spec.rb")).to be_truthy
15
+ end
16
+
17
+ it 'creates the base spec file' do
18
+ expect(File.exist?("#{@name}/spec/base_spec.rb")).to be_truthy
19
+ end
20
+
21
+ after(:all) do
22
+ FileUtils.rm_rf(@name)
23
+ end
24
+ end
25
+
26
+ context 'with watir' do
27
+ before(:all) do
28
+ @name = 'rspec-watir'
29
+ RubyRaider::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
43
+ end
44
+
45
+ context 'with appium' do
46
+ before(:all) do
47
+ @name = 'rspec-appium'
48
+ RubyRaider::RspecGenerator.new(['appium_ios', 'rspec', @name]).invoke_all
49
+ end
50
+
51
+ it 'creates a spec file' do
52
+ expect(File.exist?("#{@name}/spec/login_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
62
+ end
63
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative '../lib/generators/projects/rspec_project_generator'
2
- require_relative '../lib/generators/projects/cucumber_project_generator'
1
+ # frozen_string_literal: true
2
+
3
3
  require 'fileutils'
4
- require 'rspec'
4
+ require 'rspec'