howitzer 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +32 -0
  4. data/.travis.yml +1 -4
  5. data/.yardopts +1 -2
  6. data/CHANGELOG.md +28 -1
  7. data/Gemfile +6 -0
  8. data/LICENSE +1 -1
  9. data/README.md +55 -85
  10. data/Rakefile +7 -7
  11. data/bin/howitzer +56 -31
  12. data/features/cli_new.feature +162 -79
  13. data/features/cli_update.feature +114 -21
  14. data/features/step_definitions/common_steps.rb +29 -9
  15. data/features/support/env.rb +1 -1
  16. data/features/support/transformers.rb +2 -2
  17. data/generators/base_generator.rb +121 -49
  18. data/generators/config/config_generator.rb +8 -5
  19. data/generators/config/templates/boot.rb +14 -0
  20. data/generators/config/templates/capybara.rb +156 -0
  21. data/generators/config/templates/custom.yml +2 -3
  22. data/generators/config/templates/default.yml +50 -82
  23. data/generators/cucumber/cucumber_generator.rb +9 -9
  24. data/generators/cucumber/templates/common_steps.rb +4 -4
  25. data/generators/cucumber/templates/cucumber.rake +63 -54
  26. data/generators/cucumber/templates/env.rb +24 -23
  27. data/generators/cucumber/templates/transformers.rb +23 -15
  28. data/generators/emails/emails_generator.rb +4 -2
  29. data/generators/emails/templates/example_email.rb +4 -4
  30. data/generators/prerequisites/prerequisites_generator.rb +24 -0
  31. data/generators/prerequisites/templates/base.rb +22 -0
  32. data/generators/prerequisites/templates/factory_girl.rb +30 -0
  33. data/generators/prerequisites/templates/user.rb +7 -0
  34. data/generators/prerequisites/templates/users.rb +12 -0
  35. data/generators/root/root_generator.rb +11 -7
  36. data/generators/root/templates/.rubocop.yml +32 -0
  37. data/generators/root/templates/Gemfile.erb +27 -0
  38. data/generators/root/templates/Rakefile +6 -8
  39. data/generators/rspec/rspec_generator.rb +7 -7
  40. data/generators/rspec/templates/example_spec.rb +1 -1
  41. data/generators/rspec/templates/rspec.rake +48 -29
  42. data/generators/rspec/templates/spec_helper.rb +33 -32
  43. data/generators/tasks/tasks_generator.rb +4 -2
  44. data/generators/tasks/templates/common.rake +1 -16
  45. data/generators/turnip/templates/.rspec +1 -0
  46. data/generators/turnip/templates/common_steps.rb +25 -0
  47. data/generators/turnip/templates/example.feature +8 -0
  48. data/generators/turnip/templates/spec_helper.rb +56 -0
  49. data/generators/turnip/templates/turnip.rake +61 -0
  50. data/generators/turnip/templates/turnip_helper.rb +6 -0
  51. data/generators/turnip/turnip_generator.rb +26 -0
  52. data/generators/web/templates/example_page.rb +15 -0
  53. data/generators/web/templates/menu_section.rb +13 -0
  54. data/generators/web/web_generator.rb +22 -0
  55. data/howitzer.gemspec +14 -21
  56. data/lib/howitzer.rb +47 -7
  57. data/lib/howitzer/cache.rb +70 -0
  58. data/lib/howitzer/capybara_helpers.rb +194 -0
  59. data/lib/howitzer/email.rb +96 -104
  60. data/lib/howitzer/exceptions.rb +10 -6
  61. data/lib/howitzer/log.rb +120 -0
  62. data/lib/howitzer/mail_adapters.rb +7 -0
  63. data/lib/howitzer/mail_adapters/abstract.rb +84 -0
  64. data/lib/howitzer/mail_adapters/mailgun.rb +115 -0
  65. data/lib/howitzer/mailgun_api.rb +9 -0
  66. data/lib/howitzer/mailgun_api/client.rb +79 -0
  67. data/lib/howitzer/mailgun_api/connector.rb +37 -0
  68. data/lib/howitzer/mailgun_api/response.rb +28 -0
  69. data/lib/howitzer/tasks/framework.rake +2 -2
  70. data/lib/howitzer/utils.rb +7 -1
  71. data/lib/howitzer/utils/string_extensions.rb +66 -0
  72. data/lib/howitzer/version.rb +2 -1
  73. data/lib/howitzer/web.rb +11 -0
  74. data/lib/howitzer/web/base_section.rb +27 -0
  75. data/lib/howitzer/web/blank_page.rb +12 -0
  76. data/lib/howitzer/web/capybara_methods_proxy.rb +29 -0
  77. data/lib/howitzer/web/element_dsl.rb +109 -0
  78. data/lib/howitzer/web/iframe_dsl.rb +93 -0
  79. data/lib/howitzer/web/page.rb +173 -0
  80. data/lib/howitzer/web/page_dsl.rb +64 -0
  81. data/lib/howitzer/web/page_validator.rb +118 -0
  82. data/lib/howitzer/web/section.rb +27 -0
  83. data/lib/howitzer/web/section_dsl.rb +154 -0
  84. data/spec/config/custom.yml +10 -1
  85. data/spec/spec_helper.rb +37 -19
  86. data/spec/support/generator_helper.rb +12 -11
  87. data/spec/support/logger_helper.rb +10 -9
  88. data/spec/support/mailgun_unit_client.rb +52 -44
  89. data/spec/support/shared_examples/capybara_context_holder.rb +33 -0
  90. data/spec/support/shared_examples/capybara_methods_proxy.rb +94 -0
  91. data/spec/support/shared_examples/dynamic_section_methods.rb +35 -0
  92. data/spec/support/shared_examples/element_dsl.rb +119 -0
  93. data/spec/unit/generators/base_generator_spec.rb +64 -33
  94. data/spec/unit/generators/config_generator_spec.rb +11 -7
  95. data/spec/unit/generators/cucumber_generator_spec.rb +26 -17
  96. data/spec/unit/generators/emails_generator_spec.rb +10 -6
  97. data/spec/unit/generators/prerequisites_generator_spec.rb +53 -0
  98. data/spec/unit/generators/root_generator_spec.rb +50 -13
  99. data/spec/unit/generators/rspec_generator_spec.rb +9 -9
  100. data/spec/unit/generators/tasks_generator_spec.rb +6 -6
  101. data/spec/unit/generators/turnip_generator_spec.rb +52 -0
  102. data/spec/unit/generators/web_generator_spec.rb +52 -0
  103. data/spec/unit/lib/cache_spec.rb +85 -0
  104. data/spec/unit/lib/capybara_helpers_spec.rb +696 -0
  105. data/spec/unit/lib/email_spec.rb +104 -91
  106. data/spec/unit/lib/howitzer.rb +31 -0
  107. data/spec/unit/lib/init_spec.rb +0 -1
  108. data/spec/unit/lib/log_spec.rb +122 -0
  109. data/spec/unit/lib/mail_adapters/abstract_spec.rb +62 -0
  110. data/spec/unit/lib/mail_adapters/mailgun_spec.rb +163 -0
  111. data/spec/unit/lib/mailgun_api/client_spec.rb +58 -0
  112. data/spec/unit/lib/mailgun_api/connector_spec.rb +54 -0
  113. data/spec/unit/lib/mailgun_api/response_spec.rb +28 -0
  114. data/spec/unit/lib/utils/string_extensions_spec.rb +77 -0
  115. data/spec/unit/lib/web/base_section_spec.rb +41 -0
  116. data/spec/unit/lib/web/element_dsl_spec.rb +17 -0
  117. data/spec/unit/lib/web/iframe_dsl_spec.rb +99 -0
  118. data/spec/unit/lib/web/page_dsl_spec.rb +52 -0
  119. data/spec/unit/lib/web/page_spec.rb +304 -0
  120. data/spec/unit/lib/web/page_validator_spec.rb +218 -0
  121. data/spec/unit/lib/web/section_dsl_spec.rb +165 -0
  122. data/spec/unit/lib/web/section_spec.rb +61 -0
  123. data/spec/unit/version_spec.rb +1 -1
  124. metadata +116 -203
  125. data/GETTING_STARTED.md +0 -774
  126. data/generators/cucumber/templates/cucumber.yml +0 -10
  127. data/generators/pages/pages_generator.rb +0 -21
  128. data/generators/pages/templates/example_menu.rb +0 -15
  129. data/generators/pages/templates/example_page.rb +0 -15
  130. data/generators/root/templates/Gemfile +0 -7
  131. data/generators/root/templates/boot.rb +0 -10
  132. data/lib/howitzer/blank_page.rb +0 -6
  133. data/lib/howitzer/capybara/dsl_ex.rb +0 -15
  134. data/lib/howitzer/capybara/settings.rb +0 -343
  135. data/lib/howitzer/helpers.rb +0 -230
  136. data/lib/howitzer/init.rb +0 -1
  137. data/lib/howitzer/mailgun/client.rb +0 -65
  138. data/lib/howitzer/mailgun/connector.rb +0 -34
  139. data/lib/howitzer/mailgun/response.rb +0 -28
  140. data/lib/howitzer/patches/rawler_patched.rb +0 -86
  141. data/lib/howitzer/settings.rb +0 -27
  142. data/lib/howitzer/utils/data_generator/data_storage.rb +0 -88
  143. data/lib/howitzer/utils/data_generator/gen.rb +0 -135
  144. data/lib/howitzer/utils/locator_store.rb +0 -217
  145. data/lib/howitzer/utils/log.rb +0 -139
  146. data/lib/howitzer/utils/page_validator.rb +0 -133
  147. data/lib/howitzer/vendor/firebug-1.12.1-fx.xpi +0 -0
  148. data/lib/howitzer/vendor/firepath-0.9.7-fx.xpi +0 -0
  149. data/lib/howitzer/web_page.rb +0 -253
  150. data/spec/active_resource.rb +0 -0
  151. data/spec/config/default.yml +0 -26
  152. data/spec/support/boot_helper.rb +0 -15
  153. data/spec/unit/generators/pages_generator_spec.rb +0 -33
  154. data/spec/unit/lib/capybara/dsl_ex_spec.rb +0 -60
  155. data/spec/unit/lib/capybara/settings_spec.rb +0 -441
  156. data/spec/unit/lib/helpers_spec.rb +0 -1129
  157. data/spec/unit/lib/mailgun/client_spec.rb +0 -36
  158. data/spec/unit/lib/mailgun/connector_spec.rb +0 -70
  159. data/spec/unit/lib/mailgun/response_spec.rb +0 -28
  160. data/spec/unit/lib/settings_spec.rb +0 -17
  161. data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +0 -80
  162. data/spec/unit/lib/utils/data_generator/gen_spec.rb +0 -90
  163. data/spec/unit/lib/utils/locator_store_spec.rb +0 -157
  164. data/spec/unit/lib/utils/log_spec.rb +0 -107
  165. data/spec/unit/lib/utils/page_validator_spec.rb +0 -265
  166. data/spec/unit/lib/web_page_spec.rb +0 -346
@@ -1,1129 +0,0 @@
1
- require 'spec_helper'
2
- require 'howitzer/helpers'
3
-
4
- RSpec.describe 'Helpers' do
5
- let(:settings) { double('settings')}
6
- let(:selenium_driver) { false }
7
- let(:selenium_grid_driver) { false }
8
- let(:phantomjs_driver) { false }
9
- let(:sauce_driver) { false }
10
- let(:testingbot_driver) { false }
11
-
12
- describe '#sauce_driver?' do
13
- subject { sauce_driver? }
14
- before { allow(settings).to receive(:driver) { driver_setting } }
15
- context 'when :sauce' do
16
- let(:driver_setting) {:sauce}
17
- it{ is_expected.to be_truthy }
18
- end
19
- context 'when not :sauce' do
20
- let(:driver_setting) {:phantomjs}
21
- it{ is_expected.to be_falsey }
22
- end
23
- context 'when driver specified as String' do
24
- let(:driver_setting) { 'sauce' }
25
- it{ is_expected.to be true }
26
- end
27
- context 'when driver is not specified' do
28
- let(:driver_setting) { nil }
29
- it do
30
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
31
- expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
32
- end
33
- end
34
- end
35
-
36
- describe '#testingbot_driver?' do
37
- subject { testingbot_driver? }
38
- before { allow(settings).to receive(:driver) { driver_setting } }
39
- context 'when :testingbot' do
40
- let(:driver_setting) {:testingbot}
41
- it{ is_expected.to be_truthy }
42
- end
43
- context 'when not :testingbot' do
44
- let(:driver_setting) {:phantomjs}
45
- it{ is_expected.to be_falsey }
46
- end
47
- context 'when driver specified as String' do
48
- let(:driver_setting) { 'testingbot' }
49
- it{ is_expected.to be_truthy }
50
- end
51
- context 'when driver is not specified' do
52
- let(:driver_setting) { nil }
53
- it do
54
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
55
- expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
56
- end
57
- end
58
- end
59
-
60
- describe '#phantomjs_driver?' do
61
- subject { phantomjs_driver? }
62
- before { allow(settings).to receive(:driver) { driver_setting } }
63
- context 'when :phantomjs' do
64
- let(:driver_setting) {:phantomjs}
65
- it{ is_expected.to be_truthy }
66
- end
67
- context 'when not :phantomjs' do
68
- let(:driver_setting) {:selenium}
69
- it{ is_expected.to be_falsey }
70
- end
71
- context 'when :selenium_grid' do
72
- let(:driver_setting) {:selenium_grid}
73
- it{ is_expected.to be_falsey }
74
- end
75
- context 'when driver specified as String' do
76
- let(:driver_setting) { 'phantomjs' }
77
- it{ is_expected.to be_truthy }
78
- end
79
- context 'when driver is not specified' do
80
- let(:driver_setting) { nil }
81
- it do
82
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
83
- expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
84
- end
85
- end
86
- end
87
-
88
- describe '#selenium_driver?' do
89
- subject { selenium_driver? }
90
- before { allow(settings).to receive(:driver) { driver_setting } }
91
- context 'when :selenium' do
92
- let(:driver_setting) {:selenium}
93
- it{ is_expected.to be_truthy }
94
- end
95
- context 'when :selenium_grid' do
96
- let(:driver_setting) {:selenium_grid}
97
- it{ is_expected.to be_falsey }
98
- end
99
- context 'when not :selenium' do
100
- let(:driver_setting) {:phantomjs}
101
- it{ is_expected.to be_falsey }
102
- end
103
- context 'when driver specified as String' do
104
- let(:driver_setting) { 'selenium' }
105
- it{ is_expected.to be_truthy }
106
- end
107
- context 'when driver is not specified' do
108
- let(:driver_setting) { nil }
109
- it do
110
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
111
- expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
112
- end
113
- end
114
- end
115
-
116
- describe '#selenium_grid_driver?' do
117
- subject { selenium_grid_driver? }
118
- before { allow(settings).to receive(:driver) { driver_setting } }
119
- context 'when :selenium_grid' do
120
- let(:driver_setting) {:selenium_grid}
121
- it{ is_expected.to be_truthy }
122
- end
123
- context 'when :selenium' do
124
- let(:driver_setting) {:selenium}
125
- it{ is_expected.to be_falsey }
126
- end
127
- context 'when not :selenium' do
128
- let(:driver_setting) {:phantomjs}
129
- it{ is_expected.to be_falsey }
130
- end
131
- context 'when driver specified as String' do
132
- let(:driver_setting) { 'selenium_grid' }
133
- it{ is_expected.to be_truthy }
134
- end
135
- context 'when driver is not specified' do
136
- let(:driver_setting) { nil }
137
- it do
138
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
139
- expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
140
- end
141
- end
142
- end
143
-
144
- describe '#ie_browser?' do
145
- subject { ie_browser? }
146
- before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
147
- before { allow(self).to receive(:testingbot_driver?) { testingbot_driver } }
148
- before { allow(self).to receive(:selenium_grid_driver?) { selenium_grid_driver } }
149
- context 'when sauce_driver? is TRUE' do
150
- let(:sauce_driver) { true }
151
- context 'settings.sl_browser_name = :ie' do
152
- before { allow(settings).to receive(:sl_browser_name) { :ie } }
153
- it { is_expected.to be_truthy }
154
- end
155
- context 'settings.sl_browser_name = :iexplore' do
156
- before { allow(settings).to receive(:sl_browser_name) { :iexplore } }
157
- it { is_expected.to be_truthy }
158
- end
159
- context 'settings.sl_browser_name = :chrome' do
160
- before { allow(settings).to receive(:sl_browser_name) { :chrome } }
161
- it { is_expected.to be_falsey }
162
- end
163
- context 'settings.sl_browser_name is not specified' do
164
- before { allow(settings).to receive(:sl_browser_name) { nil } }
165
- it do
166
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
167
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
168
- end
169
- end
170
- end
171
- context 'when sauce_driver? is FALSE' do
172
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
173
- context 'when selenium_driver? is TRUE' do
174
- let(:selenium_driver) { true }
175
- context 'settings.sel_browser = :ie' do
176
- before { allow(settings).to receive(:sel_browser) { :ie } }
177
- it { is_expected.to be_truthy }
178
- end
179
- context 'settings.sel_browser = :iexplore' do
180
- before { allow(settings).to receive(:sel_browser) { :iexplore } }
181
- it { is_expected.to be_truthy }
182
- end
183
- context 'settings.sel_browser = :chrome' do
184
- before { allow(settings).to receive(:sel_browser) { :chrome } }
185
- it { is_expected.to be_falsey }
186
- end
187
- context 'settings.sel_browser is not specified' do
188
- before { allow(settings).to receive(:sel_browser) { nil } }
189
- it do
190
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
191
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
192
- end
193
- end
194
- end
195
- context 'when selenium_driver? is FALSE' do
196
- it { is_expected.to be_falsey }
197
- end
198
- context 'when selenium_grid_driver? is TRUE' do
199
- let(:selenium_grid_driver) { true }
200
- context 'settings.sel_browser = :ie' do
201
- before { allow(settings).to receive(:sel_browser) { :ie } }
202
- it { is_expected.to be_truthy }
203
- end
204
- context 'settings.sel_browser = :iexplore' do
205
- before { allow(settings).to receive(:sel_browser) { :iexplore } }
206
- it { is_expected.to be_truthy }
207
- end
208
- context 'settings.sel_browser = :chrome' do
209
- before { allow(settings).to receive(:sel_browser) { :chrome } }
210
- it { is_expected.to be_falsey }
211
- end
212
- context 'settings.sel_browser is not specified' do
213
- before { allow(settings).to receive(:sel_browser) { nil } }
214
- it do
215
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
216
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
217
- end
218
- end
219
- end
220
- context 'when selenium_grid_driver? is FALSE' do
221
- it { is_expected.to be_falsey }
222
- end
223
- end
224
- context 'when testingbot_driver? is TRUE' do
225
- let(:testingbot_driver) { true }
226
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
227
- context 'settings.sel_browser = :ie' do
228
- before do
229
- allow(settings).to receive(:tb_browser_name) { :ie }
230
- allow(settings).to receive(:tb_browser_version) { 9 }
231
- end
232
- it { is_expected.to be_truthy }
233
- end
234
- context 'settings.tb_browser_name = :iexplore' do
235
- before do
236
- allow(settings).to receive(:tb_browser_name) { :iexplore }
237
- allow(settings).to receive(:tb_browser_version) { 9 }
238
- end
239
- it { is_expected.to be_truthy }
240
- end
241
- context 'settings.tb_browser_name = :firefox' do
242
- before do
243
- allow(settings).to receive(:tb_browser_name) { :firefox }
244
- allow(settings).to receive(:tb_browser_version) { 8 }
245
- end
246
- it { is_expected.to be_falsey }
247
- end
248
- context 'settings.tb_browser_name is not specified' do
249
- before { allow(settings).to receive(:tb_browser_name) { nil } }
250
- it do
251
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
252
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
253
- end
254
- end
255
- end
256
- context 'when testingbot_driver? is FALSE' do
257
- before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
258
- context 'when sauce_driver? is TRUE' do
259
- let(:sauce_driver) { true }
260
- context 'settings.sl_browser_name = :ie' do
261
- before { allow(settings).to receive(:sl_browser_name) { :ie } }
262
- it { is_expected.to be_truthy }
263
- end
264
- context 'settings.sl_browser_name = :iexplore' do
265
- before { allow(settings).to receive(:sl_browser_name) { :iexplore } }
266
- it { is_expected.to be_truthy }
267
- end
268
- context 'settings.sl_browser_name = :chrome' do
269
- before { allow(settings).to receive(:sl_browser_name) { :chrome } }
270
- it { is_expected.to be_falsey }
271
- end
272
- context 'settings.sl_browser_name is not specified' do
273
- before { allow(settings).to receive(:sl_browser_name) { nil } }
274
- it do
275
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
276
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
277
- end
278
- end
279
- end
280
- end
281
- context 'when selenium_driver? is TRUE' do
282
- before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
283
- context 'when selenium_driver? is TRUE' do
284
- let(:selenium_driver) { true }
285
- context 'settings.sel_browser = :ie' do
286
- before { allow(settings).to receive(:sel_browser) { :ie } }
287
- it { is_expected.to be_truthy }
288
- end
289
- context 'settings.sel_browser = :iexplore' do
290
- before { allow(settings).to receive(:sel_browser) { :iexplore } }
291
- it { is_expected.to be_truthy }
292
- end
293
- context 'settings.sel_browser = :chrome' do
294
- before { allow(settings).to receive(:sel_browser) { :chrome } }
295
- it { is_expected.to be_falsey }
296
- end
297
- context 'settings.sel_browser is not specified' do
298
- before { allow(settings).to receive(:sel_browser) { nil } }
299
- it do
300
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
301
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
302
- end
303
- end
304
- end
305
- end
306
- context 'when selenium_driver? is FALSE' do
307
- before { allow(self).to receive(:selenium_driver?) { false } }
308
- context 'when testingbot_driver? is TRUE' do
309
- let(:testingbot_driver) { true }
310
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
311
- context 'settings.sl_browser_name = :ie' do
312
- before do
313
- allow(settings).to receive(:tb_browser_name) { :ie }
314
- allow(settings).to receive(:tb_browser_version) { 9 }
315
- end
316
- it { is_expected.to be_truthy }
317
- end
318
- context 'settings.tb_browser_name = :iexplore' do
319
- before do
320
- allow(settings).to receive(:tb_browser_name) { :iexplore }
321
- allow(settings).to receive(:tb_browser_version) { 9 }
322
- end
323
- it { is_expected.to be_truthy }
324
- end
325
- context 'settings.tb_browser_name = :firefox' do
326
- before do
327
- allow(settings).to receive(:tb_browser_name) { :firefox }
328
- allow(settings).to receive(:tb_browser_version) { 8 }
329
- end
330
- it { is_expected.to be_falsey }
331
- end
332
- context 'settings.tb_browser_name is not specified' do
333
- before { allow(settings).to receive(:tb_browser_name) { nil } }
334
- it do
335
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
336
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
337
- end
338
- end
339
- end
340
- end
341
- end
342
-
343
- describe '#ff_browser?' do
344
- subject { ff_browser? }
345
- before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
346
- before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
347
- before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
348
- context 'when sauce_driver? is TRUE' do
349
- let(:sauce_driver) { true }
350
- context 'settings.sl_browser_name = :ff' do
351
- before { allow(settings).to receive(:sl_browser_name) { :ff } }
352
- it { is_expected.to be_truthy }
353
- end
354
- context 'settings.sl_browser_name = :firefox' do
355
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
356
- it { is_expected.to be_truthy }
357
- end
358
- context 'settings.sl_browser_name = :chrome' do
359
- before { allow(settings).to receive(:sl_browser_name) { :chrome } }
360
- it { is_expected.to be_falsey }
361
- end
362
- context 'settings.sl_browser_name is not specified' do
363
- before { allow(settings).to receive(:sl_browser_name) { nil } }
364
- it do
365
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
366
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
367
- end
368
- end
369
- end
370
- context 'when sauce_driver? is FALSE' do
371
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
372
- context 'when selenium_driver? is TRUE' do
373
- let(:selenium_driver) { true }
374
- context 'settings.sel_browser = :ff' do
375
- before { allow(settings).to receive(:sel_browser) { :ff } }
376
- it { is_expected.to be_truthy }
377
- end
378
- context 'settings.sel_browser = :firefox' do
379
- before { allow(settings).to receive(:sel_browser) { :firefox } }
380
- it { is_expected.to be_truthy }
381
- end
382
- context 'settings.sel_browser = :chrome' do
383
- before { allow(settings).to receive(:sel_browser) { :chrome } }
384
- it { is_expected.to be_falsey }
385
- end
386
- context 'settings.sel_browser is not specified' do
387
- before { allow(settings).to receive(:sel_browser) { nil } }
388
- it do
389
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
390
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
391
- end
392
- end
393
- end
394
- context 'when selenium_driver? is FALSE' do
395
- it { is_expected.to be_falsey }
396
- end
397
- end
398
- context 'when testingbot_driver? is TRUE' do
399
- let(:testingbot_driver) { true }
400
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
401
- context 'settings.tb_browser_name = :ff' do
402
- before do
403
- allow(settings).to receive(:tb_browser_name) { :ff }
404
- allow(settings).to receive(:tb_browser_version) { 8 }
405
- end
406
- it { is_expected.to be_truthy }
407
- end
408
- context 'settings.tb_browser_name = :firefox' do
409
- before do
410
- allow(settings).to receive(:tb_browser_name) { :firefox }
411
- allow(settings).to receive(:tb_browser_version) { 8 }
412
- end
413
- it { is_expected.to be_truthy }
414
- end
415
- context 'settings.tb_browser_name = :iexplore' do
416
- before do
417
- allow(settings).to receive(:tb_browser_name) { :iexplore }
418
- allow(settings).to receive(:tb_browser_version) { 9 }
419
- end
420
- it { is_expected.to be_falsey }
421
- end
422
- context 'settings.tb_browser_name is not specified' do
423
- before { allow(settings).to receive(:tb_browser_name) { nil } }
424
- it do
425
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
426
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
427
- end
428
- end
429
- end
430
- context 'when testingbot_driver? is FALSE' do
431
- before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
432
- context 'when sauce_driver? is TRUE' do
433
- let(:sauce_driver) { true }
434
- context 'settings.sl_browser_name = :ff' do
435
- before { allow(settings).to receive(:sl_browser_name) { :ff } }
436
- it { is_expected.to be_truthy }
437
- end
438
- context 'settings.sl_browser_name = :firefox' do
439
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
440
- it { is_expected.to be_truthy }
441
- end
442
- context 'settings.sl_browser_name = :chrome' do
443
- before { allow(settings).to receive(:sl_browser_name) { :chrome } }
444
- it { is_expected.to be_falsey }
445
- end
446
- context 'settings.sl_browser_name is not specified' do
447
- before { allow(settings).to receive(:sl_browser_name) { nil } }
448
- it do
449
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
450
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
451
- end
452
- end
453
- end
454
- end
455
- context 'when selenium_driver? is TRUE' do
456
- before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
457
- context 'when selenium_driver? is TRUE' do
458
- let(:selenium_driver) { true }
459
- context 'settings.sel_browser = :ff' do
460
- before { allow(settings).to receive(:sel_browser) { :ff } }
461
- it { is_expected.to be_truthy }
462
- end
463
- context 'settings.sel_browser = :firefox' do
464
- before { allow(settings).to receive(:sel_browser) { :firefox } }
465
- it { is_expected.to be_truthy }
466
- end
467
- context 'settings.sel_browser = :chrome' do
468
- before { allow(settings).to receive(:sel_browser) { :chrome } }
469
- it { is_expected.to be_falsey }
470
- end
471
- context 'settings.sel_browser is not specified' do
472
- before { allow(settings).to receive(:sel_browser) { nil } }
473
- it do
474
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
475
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
476
- end
477
- end
478
- end
479
- end
480
- context 'when selenium_driver? is FALSE' do
481
- before { allow(self).to receive(:selenium_driver?) { false } }
482
- context 'when testingbot_driver? is TRUE' do
483
- let(:testingbot_driver) { true }
484
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
485
- context 'settings.tb_browser_name = :firefox' do
486
- before do
487
- allow(settings).to receive(:tb_browser_name) { :firefox }
488
- allow(settings).to receive(:tb_browser_version) { 8 }
489
- end
490
- it { is_expected.to be_truthy }
491
- end
492
- context 'settings.tb_browser_name = :ff' do
493
- before do
494
- allow(settings).to receive(:tb_browser_name) { :ff }
495
- allow(settings).to receive(:tb_browser_version) { 8 }
496
- end
497
- it { is_expected.to be_truthy }
498
- end
499
- context 'settings.tb_browser_name = :iexplore' do
500
- before do
501
- allow(settings).to receive(:tb_browser_name) { :iexplore }
502
- allow(settings).to receive(:tb_browser_version) { 9 }
503
- end
504
- it { is_expected.to be_falsey }
505
- end
506
- context 'settings.tb_browser_name is not specified' do
507
- before { allow(settings).to receive(:tb_browser_name) { nil } }
508
- it do
509
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
510
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
511
- end
512
- end
513
- end
514
- context 'when selenium_grid_driver? is TRUE' do
515
- before { allow(self).to receive(:selenium_grid_driver?) { selenium_grid_driver } }
516
- context 'when selenium_grid_driver? is TRUE' do
517
- let(:selenium_grid_driver) { true }
518
- context 'settings.sel_browser = :ff' do
519
- before { allow(settings).to receive(:sel_browser) { :ff } }
520
- it { is_expected.to be_truthy }
521
- end
522
- context 'settings.sel_browser = :firefox' do
523
- before { allow(settings).to receive(:sel_browser) { :firefox } }
524
- it { is_expected.to be_truthy }
525
- end
526
- context 'settings.sel_browser = :chrome' do
527
- before { allow(settings).to receive(:sel_browser) { :chrome } }
528
- it { is_expected.to be_falsey }
529
- end
530
- context 'settings.sel_browser is not specified' do
531
- before { allow(settings).to receive(:sel_browser) { nil } }
532
- it do
533
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
534
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
535
- end
536
- end
537
- end
538
- end
539
- context 'when selenium_grid_driver? is FALSE' do
540
- before { allow(self).to receive(:selenium_grid_driver?) { false } }
541
- context 'when testingbot_driver? is TRUE' do
542
- let(:testingbot_driver) { true }
543
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
544
- context 'settings.tb_browser_name = :firefox' do
545
- before do
546
- allow(settings).to receive(:tb_browser_name) { :firefox }
547
- allow(settings).to receive(:tb_browser_version) { 8 }
548
- end
549
- it { is_expected.to be_truthy }
550
- end
551
- context 'settings.tb_browser_name = :ff' do
552
- before do
553
- allow(settings).to receive(:tb_browser_name) { :ff }
554
- allow(settings).to receive(:tb_browser_version) { 8 }
555
- end
556
- it { is_expected.to be_truthy }
557
- end
558
- context 'settings.tb_browser_name = :iexplore' do
559
- before do
560
- allow(settings).to receive(:tb_browser_name) { :iexplore }
561
- allow(settings).to receive(:tb_browser_version) { 9 }
562
- end
563
- it { is_expected.to be_falsey }
564
- end
565
- context 'settings.tb_browser_name is not specified' do
566
- before { allow(settings).to receive(:tb_browser_name) { nil } }
567
- it do
568
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
569
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
570
- end
571
- end
572
- end
573
- end
574
- end
575
- end
576
-
577
- describe '#chrome_browser?' do
578
- subject { chrome_browser? }
579
- before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
580
- before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
581
- before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
582
- context 'when sauce_driver? is TRUE' do
583
- let(:sauce_driver) { true }
584
- let(:testingbot_driver) { true }
585
- context 'settings.sl_browser_name = :chrome' do
586
- before { allow(settings).to receive(:sl_browser_name) { :chrome } }
587
- it { is_expected.to be_truthy }
588
- end
589
- context 'settings.sl_browser_name = :firefox' do
590
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
591
- it { is_expected.to be_falsey }
592
- end
593
- context 'settings.sl_browser_name is not specified' do
594
- before { allow(settings).to receive(:sl_browser_name) { nil } }
595
- it do
596
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
597
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
598
- end
599
- end
600
- end
601
- context 'when sauce_driver? is FALSE' do
602
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
603
- context 'when selenium_driver? is TRUE' do
604
- let(:selenium_driver) { true }
605
- context 'settings.sel_browser = :chrome' do
606
- before { allow(settings).to receive(:sel_browser) { :chrome } }
607
- it { is_expected.to be_truthy }
608
- end
609
- context 'settings.sel_browser = :firefox' do
610
- before { allow(settings).to receive(:sel_browser) { :firefox } }
611
- it { is_expected.to be_falsey }
612
- end
613
- context 'settings.sel_browser is not specified' do
614
- before { allow(settings).to receive(:sel_browser) { nil } }
615
- it do
616
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
617
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
618
- end
619
- end
620
- end
621
- context 'when selenium_driver? is FALSE' do
622
- it { is_expected.to be_falsey }
623
- end
624
- end
625
- context 'when testingbot_driver? is TRUE' do
626
- let(:testingbot_driver) { true }
627
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
628
- context 'settings.tb_browser_name = :chrome' do
629
- before do
630
- allow(settings).to receive(:tb_browser_name) { :chrome }
631
- allow(settings).to receive(:tb_browser_version) { 9 }
632
- end
633
- it { is_expected.to be_truthy }
634
- end
635
- context 'settings.tb_browser_name = :iexplore' do
636
- before do
637
- allow(settings).to receive(:tb_browser_name) { :iexplore }
638
- allow(settings).to receive(:tb_browser_version) { 9 }
639
- end
640
- it { is_expected.to be_falsey }
641
- end
642
- context 'settings.tb_browser_name is not specified' do
643
- before { allow(settings).to receive(:tb_browser_name) { nil } }
644
- it do
645
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
646
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
647
- end
648
- end
649
- end
650
- context 'when testingbot_driver? is FALSE' do
651
- before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
652
- context 'when sauce_driver? is TRUE' do
653
- let(:sauce_driver) { true }
654
- context 'settings.sl_browser_name = :chrome' do
655
- before { allow(settings).to receive(:sl_browser_name) { :chrome } }
656
- it { is_expected.to be_truthy }
657
- end
658
- context 'settings.sl_browser_name = :firefox' do
659
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
660
- it { is_expected.to be_falsey }
661
- end
662
- context 'settings.sl_browser_name is not specified' do
663
- before { allow(settings).to receive(:sl_browser_name) { nil } }
664
- it do
665
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
666
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
667
- end
668
- end
669
- end
670
- end
671
- context 'when selenium_driver? is TRUE' do
672
- before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
673
- context 'when selenium_driver? is TRUE' do
674
- let(:selenium_driver) { true }
675
- context 'settings.sel_browser = :chrome' do
676
- before { allow(settings).to receive(:sel_browser) { :chrome } }
677
- it { is_expected.to be_truthy }
678
- end
679
- context 'settings.sel_browser = :firefox' do
680
- before { allow(settings).to receive(:sel_browser) { :firefox } }
681
- it { is_expected.to be_falsey }
682
- end
683
- context 'settings.sel_browser is not specified' do
684
- before { allow(settings).to receive(:sel_browser) { nil } }
685
- it do
686
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
687
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
688
- end
689
- end
690
- end
691
- end
692
- context 'when selenium_driver? is FALSE' do
693
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
694
- context 'when selenium_driver? is TRUE' do
695
- let(:selenium_driver) { true }
696
- context 'settings.sel_browser = :chrome' do
697
- before { allow(settings).to receive(:sel_browser) { :chrome } }
698
- it { is_expected.to be_truthy }
699
- end
700
- context 'settings.sel_browser = :firefox' do
701
- before { allow(settings).to receive(:sel_browser) { :firefox } }
702
- it { is_expected.to be_falsey }
703
- end
704
- context 'settings.sel_browser is not specified' do
705
- before { allow(settings).to receive(:sel_browser) { nil } }
706
- it do
707
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
708
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
709
- end
710
- end
711
- end
712
- context 'when selenium_driver? is FALSE' do
713
- it { is_expected.to be_falsey }
714
- end
715
- end
716
- end
717
-
718
- describe '#opera_browser?' do
719
- subject { opera_browser? }
720
- before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
721
- before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
722
- before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
723
- context 'when sauce_driver? is TRUE' do
724
- let(:sauce_driver) { true }
725
- let(:testingbot_driver) { true }
726
- context 'settings.sl_browser_name = :opera' do
727
- before { allow(settings).to receive(:sl_browser_name) { :opera } }
728
- it { is_expected.to be_truthy }
729
- end
730
- context 'settings.sl_browser_name = :firefox' do
731
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
732
- it { is_expected.to be_falsey }
733
- end
734
- context 'settings.sl_browser_name is not specified' do
735
- before { allow(settings).to receive(:sl_browser_name) { nil } }
736
- it do
737
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
738
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
739
- end
740
- end
741
- end
742
- context 'when sauce_driver? is FALSE' do
743
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
744
- context 'when selenium_driver? is TRUE' do
745
- let(:selenium_driver) { true }
746
- context 'settings.sel_browser = :opera' do
747
- before { allow(settings).to receive(:sel_browser) { :opera } }
748
- it { is_expected.to be_truthy }
749
- end
750
- context 'settings.sel_browser = :firefox' do
751
- before { allow(settings).to receive(:sel_browser) { :firefox } }
752
- it { is_expected.to be_falsey }
753
- end
754
- context 'settings.sel_browser is not specified' do
755
- before { allow(settings).to receive(:sel_browser) { nil } }
756
- it do
757
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
758
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
759
- end
760
- end
761
- end
762
- context 'when selenium_driver? is FALSE' do
763
- it { is_expected.to be_falsey }
764
- end
765
- end
766
- context 'when testingbot_driver? is TRUE' do
767
- let(:testingbot_driver) { true }
768
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
769
- context 'settings.tb_browser_name = :opera' do
770
- before do
771
- allow(settings).to receive(:tb_browser_name) { :opera }
772
- allow(settings).to receive(:tb_browser_version) { 9 }
773
- end
774
- it { is_expected.to be_truthy }
775
- end
776
- context 'settings.tb_browser_name = :iexplore' do
777
- before do
778
- allow(settings).to receive(:tb_browser_name) { :iexplore }
779
- allow(settings).to receive(:tb_browser_version) { 9 }
780
- end
781
- it { is_expected.to be_falsey }
782
- end
783
- context 'settings.tb_browser_name is not specified' do
784
- before { allow(settings).to receive(:tb_browser_name) { nil } }
785
- it do
786
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
787
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
788
- end
789
- end
790
- end
791
- context 'when testingbot_driver? is FALSE' do
792
- before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
793
- context 'when sauce_driver? is TRUE' do
794
- let(:sauce_driver) { true }
795
- context 'settings.sl_browser_name = :opera' do
796
- before { allow(settings).to receive(:sl_browser_name) { :opera } }
797
- it { is_expected.to be_truthy }
798
- end
799
- context 'settings.sl_browser_name = :firefox' do
800
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
801
- it { is_expected.to be_falsey }
802
- end
803
- context 'settings.sl_browser_name is not specified' do
804
- before { allow(settings).to receive(:sl_browser_name) { nil } }
805
- it do
806
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
807
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
808
- end
809
- end
810
- end
811
- end
812
- context 'when selenium_driver? is TRUE' do
813
- before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
814
- context 'when selenium_driver? is TRUE' do
815
- let(:selenium_driver) { true }
816
- context 'settings.sel_browser = :opera' do
817
- before { allow(settings).to receive(:sel_browser) { :opera } }
818
- it { is_expected.to be_truthy }
819
- end
820
- context 'settings.sel_browser = :firefox' do
821
- before { allow(settings).to receive(:sel_browser) { :firefox } }
822
- it { is_expected.to be_falsey }
823
- end
824
- context 'settings.sel_browser is not specified' do
825
- before { allow(settings).to receive(:sel_browser) { nil } }
826
- it do
827
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
828
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
829
- end
830
- end
831
- end
832
- end
833
- context 'when selenium_driver? is FALSE' do
834
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
835
- context 'when selenium_driver? is TRUE' do
836
- let(:selenium_driver) { true }
837
- context 'settings.sel_browser = :opera' do
838
- before { allow(settings).to receive(:sel_browser) { :opera } }
839
- it { is_expected.to be_truthy }
840
- end
841
- context 'settings.sel_browser = :firefox' do
842
- before { allow(settings).to receive(:sel_browser) { :firefox } }
843
- it { is_expected.to be_falsey }
844
- end
845
- context 'settings.sel_browser is not specified' do
846
- before { allow(settings).to receive(:sel_browser) { nil } }
847
- it do
848
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
849
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
850
- end
851
- end
852
- end
853
- context 'when selenium_driver? is FALSE' do
854
- it { is_expected.to be_falsey }
855
- end
856
- end
857
- end
858
-
859
- describe '#safari_browser?' do
860
- subject { safari_browser? }
861
- before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
862
- before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
863
- before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
864
- context 'when sauce_driver? is TRUE' do
865
- let(:sauce_driver) { true }
866
- let(:testingbot_driver) { true }
867
- context 'settings.sl_browser_name = :safari' do
868
- before { allow(settings).to receive(:sl_browser_name) { :safari } }
869
- it { is_expected.to be_truthy }
870
- end
871
- context 'settings.sl_browser_name = :firefox' do
872
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
873
- it { is_expected.to be_falsey }
874
- end
875
- context 'settings.sl_browser_name is not specified' do
876
- before { allow(settings).to receive(:sl_browser_name) { nil } }
877
- it do
878
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
879
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
880
- end
881
- end
882
- end
883
- context 'when sauce_driver? is FALSE' do
884
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
885
- context 'when selenium_driver? is TRUE' do
886
- let(:selenium_driver) { true }
887
- context 'settings.sel_browser = :safari' do
888
- before { allow(settings).to receive(:sel_browser) { :safari } }
889
- it { is_expected.to be_truthy }
890
- end
891
- context 'settings.sel_browser = :firefox' do
892
- before { allow(settings).to receive(:sel_browser) { :firefox } }
893
- it { is_expected.to be_falsey }
894
- end
895
- context 'settings.sel_browser is not specified' do
896
- before { allow(settings).to receive(:sel_browser) { nil } }
897
- it do
898
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
899
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
900
- end
901
- end
902
- end
903
- context 'when selenium_driver? is FALSE' do
904
- it { is_expected.to be_falsey }
905
- end
906
- end
907
- context 'when testingbot_driver? is TRUE' do
908
- let(:testingbot_driver) { true }
909
- before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
910
- context 'settings.tb_browser_name = :safari' do
911
- before do
912
- allow(settings).to receive(:tb_browser_name) { :safari }
913
- allow(settings).to receive(:tb_browser_version) { 9 }
914
- end
915
- it { is_expected.to be_truthy }
916
- end
917
- context 'settings.tb_browser_name = :iexplore' do
918
- before do
919
- allow(settings).to receive(:tb_browser_name) { :iexplore }
920
- allow(settings).to receive(:tb_browser_version) { 9 }
921
- end
922
- it { is_expected.to be_falsey }
923
- end
924
- context 'settings.tb_browser_name is not specified' do
925
- before { allow(settings).to receive(:tb_browser_name) { nil } }
926
- it do
927
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
928
- expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
929
- end
930
- end
931
- end
932
- context 'when testingbot_driver? is FALSE' do
933
- before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
934
- context 'when sauce_driver? is TRUE' do
935
- let(:sauce_driver) { true }
936
- context 'settings.sl_browser_name = :safari' do
937
- before { allow(settings).to receive(:sl_browser_name) { :safari } }
938
- it { is_expected.to be_truthy }
939
- end
940
- context 'settings.sl_browser_name = :firefox' do
941
- before { allow(settings).to receive(:sl_browser_name) { :firefox } }
942
- it { is_expected.to be_falsey }
943
- end
944
- context 'settings.sl_browser_name is not specified' do
945
- before { allow(settings).to receive(:sl_browser_name) { nil } }
946
- it do
947
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
948
- expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
949
- end
950
- end
951
- end
952
- end
953
- context 'when selenium_driver? is TRUE' do
954
- before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
955
- context 'when selenium_driver? is TRUE' do
956
- let(:selenium_driver) { true }
957
- context 'settings.sel_browser = :safari' do
958
- before { allow(settings).to receive(:sel_browser) { :safari } }
959
- it { is_expected.to be_truthy }
960
- end
961
- context 'settings.sel_browser = :firefox' do
962
- before { allow(settings).to receive(:sel_browser) { :firefox } }
963
- it { is_expected.to be_falsey }
964
- end
965
- context 'settings.sel_browser is not specified' do
966
- before { allow(settings).to receive(:sel_browser) { nil } }
967
- it do
968
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
969
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
970
- end
971
- end
972
- end
973
- end
974
- context 'when selenium_driver? is FALSE' do
975
- before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
976
- context 'when selenium_driver? is TRUE' do
977
- let(:selenium_driver) { true }
978
- context 'settings.sel_browser = :safari' do
979
- before { allow(settings).to receive(:sel_browser) { :safari } }
980
- it { is_expected.to be_truthy }
981
- end
982
- context 'settings.sel_browser = :firefox' do
983
- before { allow(settings).to receive(:sel_browser) { :firefox } }
984
- it { is_expected.to be_falsey }
985
- end
986
- context 'settings.sel_browser is not specified' do
987
- before { allow(settings).to receive(:sel_browser) { nil } }
988
- it do
989
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
990
- expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
991
- end
992
- end
993
- end
994
- context 'when selenium_driver? is FALSE' do
995
- it { is_expected.to be_falsey }
996
- end
997
- end
998
- end
999
-
1000
- describe '#app_url' do
1001
- subject { app_url }
1002
- before do
1003
- allow(settings).to receive(:app_base_auth_login) { app_base_auth_login_setting }
1004
- allow(settings).to receive(:app_base_auth_pass) { app_base_auth_pass_setting }
1005
- allow(settings).to receive(:app_protocol) { app_protocol_setting }
1006
- allow(settings).to receive(:app_host) { app_host_setting }
1007
- end
1008
- let(:app_protocol_setting) { nil }
1009
- let(:app_host_setting) { 'redmine.strongqa.com' }
1010
- context 'when login and password present' do
1011
- let(:app_base_auth_login_setting) { 'alex' }
1012
- let(:app_base_auth_pass_setting) { 'pa$$w0rd' }
1013
- it{ is_expected.to eq('http://alex:pa$$w0rd@redmine.strongqa.com') }
1014
- end
1015
- context 'when login and password blank' do
1016
- let(:app_base_auth_login_setting) { '' }
1017
- let(:app_base_auth_pass_setting) { '' }
1018
- it{ is_expected.to eq('http://redmine.strongqa.com') }
1019
- end
1020
- end
1021
-
1022
- describe '#app_base_url' do
1023
- subject { app_base_url(prefix) }
1024
- before do
1025
- allow(settings).to receive(:app_protocol) { app_protocol_setting }
1026
- allow(settings).to receive(:app_host) { app_host_setting }
1027
- end
1028
- let(:app_protocol_setting) { nil }
1029
- let(:app_host_setting) { 'redmine.strongqa.com' }
1030
- context 'when login and password present' do
1031
- let(:prefix) { 'alex:pa$$w0rd@' }
1032
- it{ is_expected.to eq('http://alex:pa$$w0rd@redmine.strongqa.com') }
1033
- end
1034
- context 'when login and password blank' do
1035
- let(:prefix) { nil }
1036
- it{ is_expected.to eq('http://redmine.strongqa.com') }
1037
- end
1038
- end
1039
-
1040
- describe '#duration' do
1041
- context 'when more than hour' do
1042
- it{ expect(duration(10000)).to eq('[2h 46m 40s]') }
1043
- end
1044
- context 'when 1 hour exactly' do
1045
- it{ expect(duration(3600)).to eq('[1h 0m 0s]') }
1046
- end
1047
- context 'when 0 hours and more than minute' do
1048
- it{ expect(duration(2000)).to eq('[33m 20s]') }
1049
- end
1050
- context 'when 1 minute exactly' do
1051
- it{ expect(duration(60)).to eq('[1m 0s]') }
1052
- end
1053
- context 'when less than minute' do
1054
- it{ expect(duration(45)).to eq('[0m 45s]') }
1055
- end
1056
- context 'when zero' do
1057
- it{ expect(duration(0)).to eq('[0m 0s]') }
1058
- end
1059
- end
1060
-
1061
- describe '#ri' do
1062
- subject { ri 'boom' }
1063
- it { expect {subject}.to raise_error(RuntimeError, /boom/) }
1064
- end
1065
-
1066
- describe String do
1067
- let(:page_name) { 'my' }
1068
- let(:page_object) { double }
1069
- before { stub_const('MyPage', page_object) }
1070
- describe '#open' do
1071
- subject { page_name.open(:exit) }
1072
- before do
1073
- expect(page_object).to receive(:open).with(:exit).once
1074
- end
1075
- it { is_expected.to be_nil }
1076
- end
1077
- describe '#given' do
1078
- subject { page_name.given }
1079
- before do
1080
- allow(page_name).to receive(:as_page_class){ page_object }
1081
- expect(page_object).to receive(:given).once
1082
- end
1083
- it { is_expected.to be_nil }
1084
- end
1085
- describe '#wait_for_opened' do
1086
- subject { page_name.wait_for_opened }
1087
- before do
1088
- allow(page_name).to receive(:as_page_class){ page_object }
1089
- expect(page_object).to receive(:wait_for_opened).once
1090
- end
1091
- it { is_expected.to be_nil }
1092
- end
1093
- describe '#as_page_class' do
1094
- subject { page_name.as_page_class }
1095
- context 'when 1 word' do
1096
- it { is_expected.to eql(page_object) }
1097
- end
1098
- context 'when more 1 word' do
1099
- let(:page_name) { 'my super mega' }
1100
- before { stub_const('MySuperMegaPage', page_object) }
1101
- it { is_expected.to eql(page_object) }
1102
- end
1103
- context 'when plural word' do
1104
- let(:page_name) { 'user notifications' }
1105
- before { stub_const('UserNotificationsPage', page_object) }
1106
- it { is_expected.to eql(page_object) }
1107
- end
1108
- end
1109
- describe '#as_email_class' do
1110
- subject { email_name.as_email_class }
1111
- let(:my_email) { double }
1112
- context 'when 1 word' do
1113
- let(:email_name) { 'my' }
1114
- before { stub_const('MyEmail', my_email) }
1115
- it { is_expected.to eql(my_email) }
1116
- end
1117
- context 'when more 1 word' do
1118
- let(:email_name) { 'my super mega' }
1119
- before { stub_const('MySuperMegaEmail', my_email) }
1120
- it { is_expected.to eql(my_email) }
1121
- end
1122
- context 'when plural word' do
1123
- let(:email_name) { 'email notifications' }
1124
- before { stub_const('EmailNotificationsEmail', my_email) }
1125
- it { is_expected.to eql(my_email) }
1126
- end
1127
- end
1128
- end
1129
- end