howitzer 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -1
  3. data/LICENSE +1 -1
  4. data/README.md +16 -16
  5. data/generators/base_generator.rb +1 -1
  6. data/generators/config/config_generator.rb +1 -4
  7. data/generators/config/templates/boot.rb +1 -1
  8. data/generators/config/templates/capybara.rb +1 -3
  9. data/generators/config/templates/default.yml +5 -19
  10. data/generators/config/templates/drivers/browserstack.rb +1 -1
  11. data/generators/config/templates/drivers/crossbrowsertesting.rb +1 -1
  12. data/generators/config/templates/drivers/headless_chrome.rb +1 -1
  13. data/generators/config/templates/drivers/headless_firefox.rb +1 -1
  14. data/generators/config/templates/drivers/sauce.rb +1 -1
  15. data/generators/config/templates/drivers/selenium.rb +1 -1
  16. data/generators/config/templates/drivers/selenium_grid.rb +2 -2
  17. data/generators/config/templates/drivers/testingbot.rb +1 -1
  18. data/generators/cucumber/templates/env.rb +1 -1
  19. data/generators/cucumber/templates/hooks.rb +8 -2
  20. data/generators/cucumber/templates/transformers.rb +1 -1
  21. data/generators/prerequisites/templates/factory_bot.rb +1 -1
  22. data/generators/root/templates/Gemfile.erb +4 -10
  23. data/generators/rspec/templates/spec_helper.rb +4 -4
  24. data/generators/turnip/templates/spec_helper.rb +4 -4
  25. data/generators/web/templates/example_page.rb +1 -1
  26. data/lib/howitzer/cache.rb +1 -1
  27. data/lib/howitzer/capybara_helpers.rb +27 -7
  28. data/lib/howitzer/email.rb +2 -2
  29. data/lib/howitzer/exceptions.rb +21 -21
  30. data/lib/howitzer/gmail_api/client.rb +13 -4
  31. data/lib/howitzer/log.rb +6 -6
  32. data/lib/howitzer/mailgun_api/client.rb +3 -2
  33. data/lib/howitzer/mailgun_api/response.rb +1 -2
  34. data/lib/howitzer/mailtrap_api/client.rb +1 -1
  35. data/lib/howitzer/meta/actions.rb +13 -16
  36. data/lib/howitzer/meta/element.rb +12 -10
  37. data/lib/howitzer/utils/string_extensions.rb +6 -2
  38. data/lib/howitzer/version.rb +1 -1
  39. data/lib/howitzer/web/base_section.rb +1 -1
  40. data/lib/howitzer/web/capybara_methods_proxy.rb +11 -5
  41. data/lib/howitzer/web/element_dsl.rb +104 -45
  42. data/lib/howitzer/web/iframe_dsl.rb +2 -2
  43. data/lib/howitzer/web/page.rb +4 -14
  44. data/lib/howitzer/web/page_dsl.rb +15 -6
  45. data/lib/howitzer/web/page_validator.rb +25 -26
  46. data/lib/howitzer/web/section.rb +5 -2
  47. data/lib/howitzer/web/section_dsl.rb +64 -30
  48. data/lib/howitzer.rb +2 -2
  49. metadata +24 -161
  50. data/.coveralls.yml +0 -1
  51. data/.gitignore +0 -14
  52. data/.rspec +0 -3
  53. data/.rubocop.yml +0 -60
  54. data/.ruby-gemset +0 -1
  55. data/.travis.yml +0 -8
  56. data/Gemfile +0 -14
  57. data/ISSUE_TEMPLATE.md +0 -16
  58. data/MAINTENANCE.md +0 -32
  59. data/Rakefile +0 -38
  60. data/features/cli_help.feature +0 -31
  61. data/features/cli_new.feature +0 -393
  62. data/features/cli_unknown.feature +0 -17
  63. data/features/cli_update.feature +0 -223
  64. data/features/cli_version.feature +0 -14
  65. data/features/step_definitions/common_steps.rb +0 -34
  66. data/features/support/env.rb +0 -1
  67. data/generators/config/templates/drivers/poltergeist.rb +0 -11
  68. data/generators/config/templates/drivers/webkit.rb +0 -6
  69. data/generators/root/templates/.gitignore +0 -21
  70. data/generators/root/templates/.rubocop.yml.erb +0 -56
  71. data/generators/turnip/templates/.rspec +0 -1
  72. data/howitzer.gemspec +0 -39
  73. data/lib/howitzer/mail_adapters/debugmail.rb +0 -0
  74. data/spec/config/custom.yml +0 -9
  75. data/spec/spec_helper.rb +0 -73
  76. data/spec/support/generator_helper.rb +0 -21
  77. data/spec/support/logger_helper.rb +0 -13
  78. data/spec/support/shared_examples/capybara_context_holder.rb +0 -33
  79. data/spec/support/shared_examples/capybara_methods_proxy.rb +0 -94
  80. data/spec/support/shared_examples/dynamic_section_methods.rb +0 -35
  81. data/spec/support/shared_examples/element_dsl.rb +0 -242
  82. data/spec/support/shared_examples/meta_highlight_xpath.rb +0 -41
  83. data/spec/unit/generators/base_generator_spec.rb +0 -283
  84. data/spec/unit/generators/config_generator_spec.rb +0 -61
  85. data/spec/unit/generators/cucumber_generator_spec.rb +0 -62
  86. data/spec/unit/generators/emails_generator_spec.rb +0 -35
  87. data/spec/unit/generators/prerequisites_generator_spec.rb +0 -53
  88. data/spec/unit/generators/root_generator_spec.rb +0 -86
  89. data/spec/unit/generators/rspec_generator_spec.rb +0 -36
  90. data/spec/unit/generators/tasks_generator_spec.rb +0 -31
  91. data/spec/unit/generators/templates/cucumber_spec.rb +0 -97
  92. data/spec/unit/generators/templates/rspec_spec.rb +0 -88
  93. data/spec/unit/generators/templates/turnip_spec.rb +0 -98
  94. data/spec/unit/generators/turnip_generator_spec.rb +0 -52
  95. data/spec/unit/generators/web_generator_spec.rb +0 -52
  96. data/spec/unit/lib/cache_spec.rb +0 -85
  97. data/spec/unit/lib/capybara_helpers_spec.rb +0 -730
  98. data/spec/unit/lib/email_spec.rb +0 -186
  99. data/spec/unit/lib/gmail_api/client_spec.rb +0 -26
  100. data/spec/unit/lib/howitzer_spec.rb +0 -92
  101. data/spec/unit/lib/init_spec.rb +0 -2
  102. data/spec/unit/lib/log_spec.rb +0 -122
  103. data/spec/unit/lib/mail_adapters/abstract_spec.rb +0 -62
  104. data/spec/unit/lib/mail_adapters/gmail_spec.rb +0 -128
  105. data/spec/unit/lib/mail_adapters/mailgun_spec.rb +0 -158
  106. data/spec/unit/lib/mail_adapters/mailtrap_spec.rb +0 -130
  107. data/spec/unit/lib/mailgun_api/client_spec.rb +0 -80
  108. data/spec/unit/lib/mailgun_api/connector_spec.rb +0 -54
  109. data/spec/unit/lib/mailgun_api/response_spec.rb +0 -28
  110. data/spec/unit/lib/mailtrap_api/client_spec.rb +0 -67
  111. data/spec/unit/lib/meta/element_spec.rb +0 -59
  112. data/spec/unit/lib/meta/entry_spec.rb +0 -77
  113. data/spec/unit/lib/meta/iframe_spec.rb +0 -66
  114. data/spec/unit/lib/meta/section_spec.rb +0 -43
  115. data/spec/unit/lib/utils/string_extensions_spec.rb +0 -77
  116. data/spec/unit/lib/web/base_section_spec.rb +0 -43
  117. data/spec/unit/lib/web/element_dsl_spec.rb +0 -31
  118. data/spec/unit/lib/web/iframe_dsl_spec.rb +0 -203
  119. data/spec/unit/lib/web/page_dsl_spec.rb +0 -74
  120. data/spec/unit/lib/web/page_spec.rb +0 -385
  121. data/spec/unit/lib/web/page_validator_spec.rb +0 -276
  122. data/spec/unit/lib/web/section_dsl_spec.rb +0 -165
  123. data/spec/unit/lib/web/section_spec.rb +0 -70
  124. data/spec/unit/version_spec.rb +0 -8
@@ -1,223 +0,0 @@
1
- Feature: Howitzer CLI Update Existing Project
2
-
3
- Scenario: Run with update command when rspec based project present
4
- Given created old howitzer project based on rspec
5
- When I run `howitzer update` interactively
6
- And I type "y"
7
- And I type "n"
8
- And I type "i"
9
- Then the output should contain:
10
- """
11
- * Config files generation ...
12
- Identical 'config/boot.rb' file
13
- Identical 'config/custom.yml' file
14
- Identical 'config/capybara.rb' file
15
- Added 'config/default.yml' file
16
- Identical 'config/drivers/appium.rb' file
17
- Identical 'config/drivers/browserstack.rb' file
18
- Identical 'config/drivers/crossbrowsertesting.rb' file
19
- Identical 'config/drivers/headless_chrome.rb' file
20
- Identical 'config/drivers/headless_firefox.rb' file
21
- Identical 'config/drivers/poltergeist.rb' file
22
- Identical 'config/drivers/sauce.rb' file
23
- Identical 'config/drivers/selenium.rb' file
24
- Identical 'config/drivers/selenium_grid.rb' file
25
- Identical 'config/drivers/testingbot.rb' file
26
- Identical 'config/drivers/webkit.rb' file
27
- * PageOriented pattern structure generation ...
28
- Identical 'web/pages/example_page.rb' file
29
- Identical 'web/sections/menu_section.rb' file
30
- * Base rake task generation ...
31
- Identical 'tasks/common.rake' file
32
- * Email example generation ...
33
- Identical '/emails/example_email.rb' file
34
- * Pre-requisites integration to the framework ...
35
- Identical 'prerequisites/factory_bot.rb' file
36
- Identical 'prerequisites/factories/users.rb' file
37
- Identical 'prerequisites/models/base.rb' file
38
- Identical 'prerequisites/models/user.rb' file
39
- * Root files generation ...
40
- Added '.gitignore' file
41
- Conflict with 'Rakefile' file
42
- Overwrite 'Rakefile' file? [Yn]: Forced 'Rakefile' file
43
- Added template '.rubocop.yml.erb' with params '{:rspec=>true}' to destination '.rubocop.yml'
44
- Conflict with 'Gemfile' template
45
- Overwrite 'Gemfile' template? [Yn]: Skipped 'Gemfile' template
46
- * RSpec integration to the framework ...
47
- Identical 'spec/spec_helper.rb' file
48
- Identical 'spec/example_spec.rb' file
49
- Identical 'tasks/rspec.rake' file
50
- """
51
- And the exit status should be 0
52
- When I run `howitzer update` interactively
53
- And I type "y"
54
- And I type "y"
55
- Then the output should contain:
56
- """
57
- * Config files generation ...
58
- Identical 'config/boot.rb' file
59
- Identical 'config/custom.yml' file
60
- Identical 'config/capybara.rb' file
61
- Identical 'config/default.yml' file
62
- Identical 'config/drivers/appium.rb' file
63
- Identical 'config/drivers/browserstack.rb' file
64
- Identical 'config/drivers/crossbrowsertesting.rb' file
65
- Identical 'config/drivers/headless_chrome.rb' file
66
- Identical 'config/drivers/headless_firefox.rb' file
67
- Identical 'config/drivers/poltergeist.rb' file
68
- Identical 'config/drivers/sauce.rb' file
69
- Identical 'config/drivers/selenium.rb' file
70
- Identical 'config/drivers/selenium_grid.rb' file
71
- Identical 'config/drivers/testingbot.rb' file
72
- Identical 'config/drivers/webkit.rb' file
73
- * PageOriented pattern structure generation ...
74
- Identical 'web/pages/example_page.rb' file
75
- Identical 'web/sections/menu_section.rb' file
76
- * Base rake task generation ...
77
- Identical 'tasks/common.rake' file
78
- * Email example generation ...
79
- Identical '/emails/example_email.rb' file
80
- * Pre-requisites integration to the framework ...
81
- Identical 'prerequisites/factory_bot.rb' file
82
- Identical 'prerequisites/factories/users.rb' file
83
- Identical 'prerequisites/models/base.rb' file
84
- Identical 'prerequisites/models/user.rb' file
85
- * Root files generation ...
86
- Identical '.gitignore' file
87
- Identical 'Rakefile' file
88
- Conflict with '.rubocop.yml' template
89
- Overwrite '.rubocop.yml' template? [Yn]: Forced '.rubocop.yml' template
90
- Conflict with 'Gemfile' template
91
- Overwrite 'Gemfile' template? [Yn]: Forced 'Gemfile' template
92
- * RSpec integration to the framework ...
93
- Identical 'spec/spec_helper.rb' file
94
- Identical 'spec/example_spec.rb' file
95
- Identical 'tasks/rspec.rake' file
96
- """
97
- And the exit status should be 0
98
-
99
- Scenario: Run with update command when cucumber based project present
100
- Given created old howitzer project based on cucumber
101
- When I run `howitzer update` interactively
102
- And I type "y"
103
- And I type "n"
104
- And I type "i"
105
- Then the output should contain:
106
- """
107
- * Config files generation ...
108
- Identical 'config/boot.rb' file
109
- Identical 'config/custom.yml' file
110
- Identical 'config/capybara.rb' file
111
- Added 'config/default.yml' file
112
- Identical 'config/drivers/appium.rb' file
113
- Identical 'config/drivers/browserstack.rb' file
114
- Identical 'config/drivers/crossbrowsertesting.rb' file
115
- Identical 'config/drivers/headless_chrome.rb' file
116
- Identical 'config/drivers/headless_firefox.rb' file
117
- Identical 'config/drivers/poltergeist.rb' file
118
- Identical 'config/drivers/sauce.rb' file
119
- Identical 'config/drivers/selenium.rb' file
120
- Identical 'config/drivers/selenium_grid.rb' file
121
- Identical 'config/drivers/testingbot.rb' file
122
- Identical 'config/drivers/webkit.rb' file
123
- * PageOriented pattern structure generation ...
124
- Identical 'web/pages/example_page.rb' file
125
- Identical 'web/sections/menu_section.rb' file
126
- * Base rake task generation ...
127
- Identical 'tasks/common.rake' file
128
- * Email example generation ...
129
- Identical '/emails/example_email.rb' file
130
- * Pre-requisites integration to the framework ...
131
- Identical 'prerequisites/factory_bot.rb' file
132
- Identical 'prerequisites/factories/users.rb' file
133
- Identical 'prerequisites/models/base.rb' file
134
- Identical 'prerequisites/models/user.rb' file
135
- * Root files generation ...
136
- Added '.gitignore' file
137
- Conflict with 'Rakefile' file
138
- Overwrite 'Rakefile' file? [Yn]: Forced 'Rakefile' file
139
- Added template '.rubocop.yml.erb' with params '{:cucumber=>true}' to destination '.rubocop.yml'
140
- Conflict with 'Gemfile' template
141
- Overwrite 'Gemfile' template? [Yn]: Skipped 'Gemfile' template
142
- * Cucumber integration to the framework ...
143
- Identical 'features/step_definitions/common_steps.rb' file
144
- Identical 'features/support/env.rb' file
145
- Identical 'features/support/hooks.rb' file
146
- Identical 'features/support/transformers.rb' file
147
- Identical 'features/example.feature' file
148
- Identical 'tasks/cucumber.rake' file
149
- """
150
- And the exit status should be 0
151
-
152
- Scenario: Run with update command when turnip based project present
153
- Given created old howitzer project based on turnip
154
- When I run `howitzer update` interactively
155
- And I type "y"
156
- Then the output should contain:
157
- """
158
- * Config files generation ...
159
- Identical 'config/boot.rb' file
160
- Identical 'config/custom.yml' file
161
- Identical 'config/capybara.rb' file
162
- Identical 'config/default.yml' file
163
- Identical 'config/drivers/appium.rb' file
164
- Identical 'config/drivers/browserstack.rb' file
165
- Identical 'config/drivers/crossbrowsertesting.rb' file
166
- Identical 'config/drivers/headless_chrome.rb' file
167
- Identical 'config/drivers/headless_firefox.rb' file
168
- Identical 'config/drivers/poltergeist.rb' file
169
- Identical 'config/drivers/sauce.rb' file
170
- Identical 'config/drivers/selenium.rb' file
171
- Identical 'config/drivers/selenium_grid.rb' file
172
- Identical 'config/drivers/testingbot.rb' file
173
- Identical 'config/drivers/webkit.rb' file
174
- * PageOriented pattern structure generation ...
175
- Identical 'web/pages/example_page.rb' file
176
- Identical 'web/sections/menu_section.rb' file
177
- * Base rake task generation ...
178
- Identical 'tasks/common.rake' file
179
- * Email example generation ...
180
- Identical '/emails/example_email.rb' file
181
- * Pre-requisites integration to the framework ...
182
- Identical 'prerequisites/factory_bot.rb' file
183
- Identical 'prerequisites/factories/users.rb' file
184
- Identical 'prerequisites/models/base.rb' file
185
- Identical 'prerequisites/models/user.rb' file
186
- * Root files generation ...
187
- Added '.gitignore' file
188
- Identical 'Rakefile' file
189
- Added template '.rubocop.yml.erb' with params '{:turnip=>true}' to destination '.rubocop.yml'
190
- Conflict with 'Gemfile' template
191
- Overwrite 'Gemfile' template? [Yn]: Forced 'Gemfile' template
192
- * Turnip integration to the framework ...
193
- Added '.rspec' file
194
- Identical 'spec/spec_helper.rb' file
195
- Identical 'spec/turnip_helper.rb' file
196
- Identical 'spec/acceptance/example.feature' file
197
- Identical 'spec/steps/common_steps.rb' file
198
- """
199
- And the exit status should be 0
200
-
201
- Scenario: Run with update command when project missing
202
- When I run `howitzer update`
203
- Then the output should contain:
204
- """
205
- error: Current directory is not Howitzer project
206
- """
207
- And the exit status should be 126
208
-
209
- Scenario Outline: Run with update command with help option
210
- When I run `howitzer update <option>`
211
- Then the output should contain exactly:
212
- """
213
- NAME
214
- update - Upgrade existing project
215
-
216
- SYNOPSIS
217
- howitzer [global options] update
218
- """
219
- And the exit status should be 0
220
- Examples:
221
- | option |
222
- | --help |
223
- | -h |
@@ -1,14 +0,0 @@
1
- Feature: Howitzer CLI Version
2
-
3
- Scenario Outline: Run with version global option
4
- When I run `howitzer <option>`
5
- Then the output should be exactly:
6
- """
7
- howitzer version <HOWITZER_VERSION>
8
-
9
- """
10
- And the exit status should be 0
11
- Examples:
12
- | option |
13
- | --version |
14
- | -v |
@@ -1,34 +0,0 @@
1
- Given /^created old howitzer project based on rspec$/ do
2
- run_command_and_stop 'howitzer new test_automation --rspec'
3
- all_commands.shift
4
-
5
- FileUtils.move(Dir.glob("#{expand_path('.')}/test_automation/*"), expand_path('.'))
6
- FileUtils.remove_dir File.join(expand_path('.'), 'test_automation'), true
7
- overwrite_file('Rakefile', "Dir.chdir(File.join(__dir__, '.'))")
8
- overwrite_file('Gemfile', 'Hello')
9
- remove 'config/default.yml'
10
- end
11
-
12
- Given /^created old howitzer project based on cucumber$/ do
13
- run_command_and_stop 'howitzer new test_automation --cucumber'
14
- all_commands.shift
15
-
16
- FileUtils.move(Dir.glob("#{expand_path('.')}/test_automation/*"), expand_path('.'))
17
- FileUtils.remove_dir File.join(expand_path('.'), 'test_automation'), true
18
- overwrite_file('Rakefile', "Dir.chdir(File.join(__dir__, '.'))")
19
- overwrite_file('Gemfile', 'Hello')
20
- remove 'config/default.yml'
21
- end
22
-
23
- Given /^created old howitzer project based on turnip$/ do
24
- run_command_and_stop 'howitzer new test_automation --turnip'
25
- all_commands.shift
26
-
27
- FileUtils.move(Dir.glob("#{expand_path('.')}/test_automation/*"), expand_path('.'))
28
- FileUtils.remove_dir File.join(expand_path('.'), 'test_automation'), true
29
- end
30
-
31
- Then 'the output should be exactly:' do |text|
32
- text.gsub!('<HOWITZER_VERSION>', Howitzer::VERSION)
33
- step 'the output should contain exactly:', text
34
- end
@@ -1 +0,0 @@
1
- require 'aruba/cucumber'
@@ -1,11 +0,0 @@
1
- # :poltergeist driver
2
-
3
- CapybaraHelpers.load_driver_gem!(:poltergeist, 'capybara/poltergeist', 'poltergeist')
4
-
5
- Capybara.register_driver :poltergeist do |app|
6
- Capybara::Poltergeist::Driver.new(
7
- app,
8
- js_errors: !Howitzer.phantom_ignore_js_errors,
9
- phantomjs_options: ["--ignore-ssl-errors=#{Howitzer.phantom_ignore_ssl_errors ? 'yes' : 'no'}"]
10
- )
11
- end
@@ -1,6 +0,0 @@
1
- # :webkit driver
2
-
3
- CapybaraHelpers.load_driver_gem!(:webkit, 'capybara-webkit', 'capybara-webkit')
4
- Capybara::Webkit.configure do |config|
5
- config.allow_url(Howitzer.app_host)
6
- end
@@ -1,21 +0,0 @@
1
- .idea/
2
- custom.yml
3
- bin/
4
- log/
5
- eylogs/
6
- spec/results/
7
- spec/sandbox/
8
- tmp/
9
- *.swp
10
- *.orig
11
- .rakeTasks
12
- .bundle
13
- .DS_STORE
14
- .DS_Store
15
- *.xml
16
- *.log
17
- *.pem
18
- build-number.txt
19
- sauce_connect.log*
20
- *.*~
21
- capybara-*.html
@@ -1,56 +0,0 @@
1
- # See full list of defaults here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
- # To see all cops used see here: https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
3
-
4
- AllCops:
5
- DisplayCopNames: true
6
- TargetRubyVersion: 2.4
7
-
8
- Layout/CaseIndentation:
9
- Enabled: false
10
- <% if cucumber -%>
11
-
12
- Lint/AmbiguousBlockAssociation:
13
- Enabled: false
14
- <% end -%>
15
-
16
- Lint/AmbiguousRegexpLiteral:
17
- Enabled: false
18
-
19
- Metrics/BlockLength:
20
- Enabled: false
21
-
22
- Metrics/LineLength:
23
- Max: 120
24
-
25
- Metrics/ModuleLength:
26
- Max: 150
27
-
28
- Style/CaseEquality:
29
- Enabled: false
30
-
31
- Style/Documentation:
32
- Enabled: false
33
-
34
- Style/EmptyElse:
35
- Enabled: false
36
-
37
- Style/FrozenStringLiteralComment:
38
- Enabled: false
39
- <% if turnip -%>
40
-
41
- Style/MixinGrouping:
42
- EnforcedStyle: separated
43
- Exclude:
44
- - '**/*_steps.rb'
45
- <% end -%>
46
- <% if cucumber || turnip -%>
47
-
48
- Style/SymbolProc:
49
- Exclude:
50
- <% if cucumber -%>
51
- - 'features/step_definitions/**/*.rb'
52
- <%- end -%>
53
- <% if turnip -%>
54
- - 'spec/steps/**/*.rb'
55
- <%- end -%>
56
- <% end -%>
@@ -1 +0,0 @@
1
- -r turnip/rspec
data/howitzer.gemspec DELETED
@@ -1,39 +0,0 @@
1
- require File.expand_path('lib/howitzer/version', __dir__)
2
-
3
- Gem::Specification.new do |gem|
4
- gem.author = 'Roman Parashchenko'
5
- gem.email = 'howitzer@strongqa.com'
6
- gem.description = 'Howitzer uses the best practices and design patterns allowing to generate a test project in' \
7
- ' less than 5 minutes. It has out-of-the-box configurations for parallel cross-browser testing in the cloud.'
8
- gem.summary = 'Ruby based framework for acceptance testing'
9
- gem.homepage = 'http://strongqa.github.io/howitzer/'
10
- gem.license = 'MIT'
11
-
12
- gem.bindir = 'bin'
13
- gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
14
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
15
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
- gem.name = 'howitzer'
17
- gem.require_paths = ['lib']
18
- gem.version = Howitzer::VERSION
19
- gem.required_ruby_version = '>= 2.3'
20
-
21
- gem.add_runtime_dependency 'activesupport', '~>5.0'
22
- gem.add_runtime_dependency 'capybara', '< 4.0'
23
- gem.add_runtime_dependency 'colorize'
24
- gem.add_runtime_dependency 'gli'
25
- gem.add_runtime_dependency 'gmail'
26
- gem.add_runtime_dependency 'launchy'
27
- gem.add_runtime_dependency 'log4r', '~>1.1.10'
28
- gem.add_runtime_dependency 'nokogiri', '~> 1.6' if gem.platform.to_s =~ /mswin|mingw/
29
- gem.add_runtime_dependency 'rake'
30
- gem.add_runtime_dependency 'rspec', '~>3.2'
31
- gem.add_runtime_dependency 'rspec-wait'
32
- gem.add_runtime_dependency 'selenium-webdriver', ['>= 3.4.1', '< 4.0']
33
- gem.add_runtime_dependency 'sexy_settings'
34
-
35
- gem.add_development_dependency('aruba')
36
- gem.add_development_dependency('ffaker')
37
- gem.add_development_dependency('fuubar')
38
- gem.add_development_dependency('yard')
39
- end
File without changes
@@ -1,9 +0,0 @@
1
- log_dir: "spec/log"
2
- driver: selenium
3
- mailgun_domain: mailgun@test.domain
4
- mail_sleep_time: 0.05
5
- page_load_idle_timeout: 0.1
6
- capybara_wait_time: 5
7
- cloud_http_idle_timeout: 10
8
- hide_datetime_from_log: true
9
- maximized_window: false
data/spec/spec_helper.rb DELETED
@@ -1,73 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'simplecov'
4
- require 'coveralls'
5
- Coveralls.wear!
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
7
- [
8
- SimpleCov::Formatter::HTMLFormatter,
9
- Coveralls::SimpleCov::Formatter
10
- ]
11
- )
12
-
13
- SimpleCov.start do
14
- add_filter '/spec/'
15
- add_filter '/config/'
16
- add_filter do |source_file|
17
- source_file.lines.count < 5
18
- end
19
- add_group 'generators', '/generators'
20
- add_group 'lib', '/lib'
21
- end
22
-
23
- require 'tmpdir'
24
- require 'ffaker'
25
- require 'capybara'
26
- require 'json'
27
- require 'capybara/dsl'
28
- require 'active_support'
29
- require 'active_support/deprecation'
30
- require 'active_support/deprecation/method_wrappers'
31
- require 'active_support/core_ext'
32
- require 'repeater'
33
- require 'sexy_settings'
34
- require 'fake_web'
35
-
36
- SexySettings.configure do |config|
37
- config.path_to_default_settings = File.expand_path(
38
- 'default.yml',
39
- File.join(__dir__, '..', 'generators', 'config', 'templates')
40
- )
41
- config.path_to_custom_settings = File.expand_path(
42
- 'custom.yml',
43
- File.join(__dir__, 'config')
44
- )
45
- end
46
-
47
- puts SexySettings::Base.instance.as_formatted_text
48
-
49
- require 'howitzer'
50
- require 'howitzer/exceptions'
51
-
52
- def project_path
53
- File.expand_path(File.join(__dir__, '..'))
54
- end
55
-
56
- def lib_path
57
- File.join(project_path, 'lib')
58
- end
59
-
60
- def generators_path
61
- File.join(project_path, 'generators')
62
- end
63
-
64
- def log_path
65
- File.join(project_path, 'spec/log')
66
- end
67
-
68
- Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }
69
-
70
- RSpec.configure do |config|
71
- config.include Howitzer::GeneratorHelper
72
- config.disable_monkey_patching!
73
- end
@@ -1,21 +0,0 @@
1
- require 'fileutils'
2
- require_relative '../../generators/base_generator'
3
-
4
- module Howitzer
5
- module GeneratorHelper
6
- def file_tree_info(root)
7
- Dir["#{root}/**/.*", "#{root}/**/*"].sort_by { |name| name.sub(root, '') }.map do |name|
8
- hash = { name: name.sub(root, ''), is_directory: File.directory?(name) }
9
- hash[:size] = File.stat(name).size unless hash[:is_directory]
10
- hash
11
- end
12
- end
13
-
14
- def template_file_size(root_directory, file)
15
- File.size(File.join(generators_path, root_directory, 'templates', file))
16
- end
17
- end
18
- end
19
- Howitzer::BaseGenerator.logger = StringIO.new
20
- Howitzer::BaseGenerator.destination = Dir.mktmpdir
21
- Dir[File.join(generators_path, '**', '*_generator.rb')].each { |f| require f }
@@ -1,13 +0,0 @@
1
- module Howitzer
2
- module LoggerHelper
3
- def read_file(file)
4
- path = File.expand_path(file, __FILE__)
5
- IO.read(path)
6
- end
7
-
8
- def clear_file(file)
9
- path = File.expand_path(file, __FILE__)
10
- File.open(path, 'w') {}
11
- end
12
- end
13
- end
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.shared_examples :capybara_context_holder do
4
- describe '#capybara_context' do
5
- let(:web_page_class) do
6
- klass = described_class
7
- Class.new do
8
- include klass
9
- end
10
- end
11
- subject { web_page_class.new.capybara_context }
12
- context 'when parent class has the method' do
13
- before do
14
- web_page_class.class_eval do
15
- def capybara_scopes
16
- @capybara_scopes ||= [true]
17
- end
18
- end
19
- end
20
- it 'should execute parent method' do
21
- is_expected.to eq(true)
22
- end
23
- end
24
- context 'when parent class does not have the method' do
25
- it 'should raise error' do
26
- expect { subject }.to raise_error(
27
- NotImplementedError,
28
- "Please define 'capybara_scopes' method for class holder"
29
- )
30
- end
31
- end
32
- end
33
- end
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.shared_examples :capybara_methods_proxy do
4
- let(:session) { double(:session) }
5
- before do
6
- allow(Capybara).to receive(:current_session) { session }
7
- allow(Howitzer).to receive(:driver) { driver_name }
8
- allow(session).to receive(:current_url) { 'google.com' }
9
- end
10
-
11
- describe '#driver' do
12
- it 'should proxy #driver method' do
13
- expect(session).to receive(:driver).once
14
- reciever.driver
15
- end
16
- end
17
-
18
- describe '#text' do
19
- it 'should proxy #text method' do
20
- expect(session).to receive(:text).once
21
- reciever.text
22
- end
23
- end
24
-
25
- context 'when capybara session method' do
26
- it 'should proxy method' do
27
- expect(session).to receive(:visit).once
28
- reciever.visit
29
- end
30
- end
31
-
32
- context 'when capybara modal method' do
33
- it 'should proxy method' do
34
- expect(session).to receive(:dismiss_prompt).with(:some_text).once
35
- reciever.dismiss_prompt(:some_text)
36
- end
37
- end
38
-
39
- describe '#click_alert_box' do
40
- subject { reciever.click_alert_box(flag_value) }
41
- context 'when flag true and correct driver specified' do
42
- let(:flag_value) { true }
43
- let(:page) { double }
44
- let(:alert) { double }
45
- let(:driver) { double }
46
- let(:browser) { double }
47
- let(:switch_to) { double }
48
- let(:driver_name) { 'selenium' }
49
- it do
50
- expect(session).to receive(:driver).ordered.and_return(driver)
51
- expect(driver).to receive(:browser).ordered.and_return(browser)
52
- expect(browser).to receive(:switch_to).ordered.and_return(switch_to)
53
- expect(switch_to).to receive(:alert).ordered.and_return(alert)
54
- expect(alert).to receive(:accept).once
55
- subject
56
- end
57
- end
58
- context 'when flag false and correct driver specified' do
59
- let(:flag_value) { false }
60
- let(:page) { double }
61
- let(:alert) { double }
62
- let(:driver) { double }
63
- let(:browser) { double }
64
- let(:switch_to) { double }
65
- let(:driver_name) { 'selenium' }
66
- it do
67
- expect(session).to receive(:driver).ordered.and_return(driver)
68
- expect(driver).to receive(:browser).ordered.and_return(browser)
69
- expect(browser).to receive(:switch_to).ordered.and_return(switch_to)
70
- expect(switch_to).to receive(:alert).ordered.and_return(alert)
71
- expect(alert).to receive(:dismiss).once
72
- subject
73
- end
74
- end
75
- context 'when flag true and wrong driver specified' do
76
- let(:flag_value) { true }
77
- let(:page) { double }
78
- let(:driver_name) { 'ff' }
79
- it do
80
- expect(session).to receive(:evaluate_script).with('window.confirm = function() { return true; }')
81
- subject
82
- end
83
- end
84
- context 'when flag false and wrong driver specified' do
85
- let(:driver_name) { 'ff' }
86
- let(:flag_value) { false }
87
- let(:page) { double }
88
- it do
89
- expect(session).to receive(:evaluate_script).with('window.confirm = function() { return false; }')
90
- subject
91
- end
92
- end
93
- end
94
- end